You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by GitBox <gi...@apache.org> on 2021/03/31 00:36:05 UTC

[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

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[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

Posted by GitBox <gi...@apache.org>.
aschott-looker commented on pull request #234:
URL: https://github.com/apache/poi/pull/234#issuecomment-817960780


   @pjfanning -- https://github.com/apache/poi/blob/382714eccd92667fc83f70115b736c64ebff9700/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java#L132


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


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

Posted by GitBox <gi...@apache.org>.
pjfanning commented on a change in pull request #234:
URL: https://github.com/apache/poi/pull/234#discussion_r614419892



##########
File path: poi/src/main/java/org/apache/poi/ss/format/CellDateFormatter.java
##########
@@ -96,6 +96,10 @@ public String handlePart(Matcher m, String part, CellFormatType type,
                 mStart = -1;
                 if (part.length() == 3)
                     part = "yyyy";
+                // tweak the format pattern to pass tests on JDK 1.7,

Review comment:
       we don't support jdk1.7




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


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

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #234:
URL: https://github.com/apache/poi/pull/234


   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[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

Posted by GitBox <gi...@apache.org>.
pjfanning commented on pull request #234:
URL: https://github.com/apache/poi/pull/234#issuecomment-820804308


   Thanks - merged with https://github.com/apache/poi/commit/e7a2df7dda2458b78a4d5495703289d3ec31c69f


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org