You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2020/03/19 13:39:50 UTC

[Bug 64244] New: [PATCH] Fix exception from using applyFont for unicode representation _xHHHH_

https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

            Bug ID: 64244
           Summary: [PATCH] Fix exception from using applyFont for unicode
                    representation _xHHHH_
           Product: POI
           Version: 4.1.2-FINAL
          Hardware: PC
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: hyeonmin.park@kennysoft.kr
  Target Milestone: ---

Created attachment 37107
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37107&action=edit
Add testUtfDecode_withApplyFont and patch XSSFRichTextString.getFormatMap

If you use `applyFont()` for `XSSFRichString` having unicode representation
_xHHHH_ format, an IllegalArgumentException is thrown.
`testUtfDecode_withApplyFont` is a new test made by myself, also in the patch.

> Text length was 8 but the last format index was 20
> java.lang.IllegalArgumentException: Text length was 8 but the last format index was 20
> 	at org.apache.poi.xssf.usermodel.XSSFRichTextString.buildCTRst(XSSFRichTextString.java:590)
> 	at org.apache.poi.xssf.usermodel.XSSFRichTextString.applyFont(XSSFRichTextString.java:157)
> 	at org.apache.poi.xssf.usermodel.XSSFRichTextString.applyFont(XSSFRichTextString.java:167)
> 	at org.apache.poi.xssf.usermodel.TestXSSFRichTextString.testUtfDecode_withApplyFont(TestXSSFRichTextString.java:269)
> 	...

So I modified `XSSFRichTextString.getFormatMap()` to sum length after
utf-decoded. Then the test and all tests are passed well.

Actually, I have an original xlsx file that makes this problem, but due to the
security reason, I can't share the file. I think someone can help making MWE.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64244] [PATCH] Fix exception from using applyFont for unicode representation _xHHHH_

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
The changelog is now updated with some more entries that were missing.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64244] [PATCH] Fix exception from using applyFont for unicode representation _xHHHH_

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

Hyeonmin Park <hy...@kennysoft.kr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hyeonmin.park@kennysoft.kr

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64244] [PATCH] Fix exception from using applyFont for unicode representation _xHHHH_

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
Fixed via r1875571, I ended up adding a more optimized utfLength() method which
avoids constructing the full replaced string when only the resulting length is
required.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64244] [PATCH] Fix exception from using applyFont for unicode representation _xHHHH_

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

--- Comment #3 from Hyeonmin Park <hy...@kennysoft.kr> ---
Suggestion: add this ticket to History of Changes
http://poi.apache.org/changes.html#5.0.0

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 64244] [PATCH] Fix exception from using applyFont for unicode representation _xHHHH_

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

--- Comment #2 from Hyeonmin Park <hy...@kennysoft.kr> ---
Thanks a lot, and looking forward to release soon. :)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org