[GitHub] [poi] aschott-looker opened a new pull request #234: Ensure the hours position is correct after string replacements and perform y to yy conversion in the part handler

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [poi] aschott-looker opened a new pull request #234: Ensure the hours position is correct after string replacements and perform y to yy conversion in the part handler

GitBox

aschott-looker opened a new pull request #234:
URL: https://github.com/apache/poi/pull/234


   * This PR addresses two bugs described below. Consider the following format: `"d \d\a\y\s h"`.
   * For one, The logic in `org.apache.poi.ss.format.CellDateFormatter.DatePartHandler#finish` uses the position of the "h" to upcase unless AM/PM formatting was requested in the string. The example format will blow up with an index out of bounds exception because the `\d\a\y\s` section is replaced with `'days'` which changes the length of the string. My fix was to update the position whenever we update the length of the string so that we don't go out of bounds of the string.
   * Secondly, there was a previous fix that regex'd the "y" out of the string and replaced it with "yy". This does not work since it does not account for "y"'s in an escaped text block like in my example so you would get an output of `dayys`. It is better to do this type of thing in the part handler while we are parsing/tokenizing the string.


--
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.

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



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

Reply | Threaded
Open this post in threaded view
|

[GitHub] [poi] aschott-looker commented on pull request #234: Ensure the hours position is correct after string replacements and perform y to yy conversion in the part handler

GitBox

aschott-looker commented on pull request #234:
URL: https://github.com/apache/poi/pull/234#issuecomment-814361934


   @centic9 -- Any thoughts on this?


--
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.

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



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

Reply | Threaded
Open this post in threaded view
|

[GitHub] [poi] pjfanning commented on pull request #234: Ensure the hours position is correct after string replacements and perform y to yy conversion in the part handler

GitBox
In reply to this post by GitBox

pjfanning commented on pull request #234:
URL: https://github.com/apache/poi/pull/234#issuecomment-817045287


   could you add a unit test that uses DateFormatTests.xlsx ?


--
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.

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



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