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

   <!--
   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-->
   
   Closed: #714
   
   I've fixed `WriteCellData(Date)` when the actual value is `java.sql.Date` or 
`java.sql.Time`.
   
   I reproduced the failure locally and confirmed that both SQL date/time types 
can throw `UnsupportedOperationException` when `toInstant()` is called directly.
   
   ## What's changed?
   
   <!--- Describe the change below, including rationale and design decisions -->
   
   `WriteCellData(Date)` now uses an epoch-millis fallback only for 
`java.sql.Date` and `java.sql.Time`, because those types do not support 
`toInstant()`.
   
   The existing `toInstant()` path is kept for `java.util.Date` and 
`java.sql.Timestamp`. This keeps the behavior unchanged for regular date values 
and preserves `java.sql.Timestamp` nano precision.
   
   I added regression tests for:
   
   - `java.sql.Date`
   - `java.sql.Time`
   - `java.sql.Timestamp`
   
   
   To verify the fix, I first confirmed that the new `WriteCellDataTest` failed 
before the change with `UnsupportedOperationException` from 
`java.sql.Date.toInstant()` and `java.sql.Time.toInstant()`. After applying the 
fix, I confirmed that the new test passed, the existing related 
`CellDataDataTest` passed together with it, and the full `fesod-sheet` test 
suite also passed.
   
   ## 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