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

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

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

Bugzilla from bugzilla@apache.org
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: [hidden email]
          Reporter: [hidden email]
  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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

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

Hyeonmin Park <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

Dominik Stadler <[hidden email]> changed:

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

--- Comment #1 from Dominik Stadler <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64244

--- Comment #2 from Hyeonmin Park <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]