[Bug 61882] New: Some paths can create an XSSFColor instance with a null CTColor reference

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

[Bug 61882] New: Some paths can create an XSSFColor instance with a null CTColor reference

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

            Bug ID: 61882
           Summary: Some paths can create an XSSFColor instance with a
                    null CTColor reference
           Product: POI
           Version: 3.17-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Created attachment 35596
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35596&action=edit
sample workbook with cell styles without colors

The attached workbook, saved from Excel 2016, contains a cell style with a fill
with a pattern but no background or foreground color.

Currently, POI will happily return an XSSFColor instance for this style's
foreground and background color, with null for the CTColor field.  This will
then lead to later NPEs in unexpected places, of course.

Since this is a normal and valid way to construct fills, and probably other
format features, I don't think just checking for a null constructor parameter
and throwing an exception is sufficient.  We need to replace constructors that
take a CTColor object directly with a factory method that can check the input
and return null if needed instead of an invalid XSSFColor object.

--
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 61882] Some paths can create an XSSFColor instance with a null CTColor reference

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

--- Comment #1 from Greg Woolsey <[hidden email]> ---
My internal bug report appears to be against an older version of POI - I'm
unable to reproduce this with a unit test making the same call as the error my
user reported.

However, I see we do have a lot of code where an inline null check or similar
is done on the CTColor argument to decide whether to return null or create an
XSSFColor instance.  That pattern is definitely safer as a factory, so I'll
still investigate that.

--
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 61882] Some paths can create an XSSFColor instance with a null CTColor reference

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=61882

Greg Woolsey <[hidden email]> changed:

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

--- Comment #2 from Greg Woolsey <[hidden email]> ---
added factory and deprecated CTColor based constructors in r1817796.

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