skytin1004 opened a new pull request, #907:
URL: https://github.com/apache/fesod/pull/907

   <!--
   Thanks very much for contributing to Apache Fesod (Incubating)! Please make 
sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   Closed: #ISSUE
   Related: #ISSUE
   
   -->
   
   ## Purpose of the pull request
   
   <!-- Describe the purpose of this pull request. For example: Closed: 
#ISSUE-->
   
   While looking at the CSV row API from a workbook write handler, I noticed 
that `CsvRow#getPhysicalNumberOfCells()` was returning the row index instead of 
the number of cells in the row.
   
   I checked the implementation and found that `getPhysicalNumberOfCells()` was 
calling `getRowNum()`. That means the first row returns `0`, even when the row 
actually contains cells. For example, a CSV header row with `No`, `Name`, and 
`Age` should report `3` physical cells, but it reported `0`.
   
   ## What's changed?
   
   <!--- Describe the change below, including rationale and design decisions -->
   
   I changed `CsvRow#getPhysicalNumberOfCells()` to return `cellList.size()` 
instead of `getRowNum()`.
   
   I also added a regression test in `CsvFormatTest`. The test writes a CSV 
file with three header cells, then checks the first row from a workbook write 
handler and verifies that `getPhysicalNumberOfCells()` returns `3`.
   
   Tested with:
   
   - `bash ./mvnw -pl fesod-sheet -Dmaven.test.skip=false 
-Dtest=CsvFormatTest#testPhysicalNumberOfCells test`
   - `bash ./mvnw -pl fesod-sheet -Dmaven.test.skip=false -Dtest=CsvFormatTest 
test`
   - `bash ./mvnw spotless:check`
   
   ## Checklist
   
   - [x] I have read the [Contributor 
Guide](https://fesod.apache.org/community/contribution/).
   - [x] I have written the necessary doc or comment.
   - [x] I have added the necessary unit tests and all cases have passed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to