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 2018/11/13 12:30:48 UTC

[Bug 62908] New: CellFormatPart getColor warnings are logged and the method does not return a color

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

            Bug ID: 62908
           Summary: CellFormatPart getColor warnings are logged and the
                    method does not return a color
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: christoph.kaser@iconparc.de
  Target Milestone: ---

When using apache tika which uses apache POI 4.0.0, I stumbled over the follow
logged warnings:

Nov 13, 2018 1:22:16 PM org.apache.poi.ss.format.CellFormatPart getColor
WARNUNG: Unknown color: "Green"
Nov 13, 2018 1:22:21 PM org.apache.poi.ss.format.CellFormatPart getColor
WARNUNG: Unknown color: "Red"
Nov 13, 2018 1:22:21 PM org.apache.poi.ss.format.CellFormatPart getColor
WARNUNG: Unknown color: "Yellow"
Nov 13, 2018 1:22:21 PM org.apache.poi.ss.format.CellFormatPart getColor
WARNUNG: Unknown color: "Blue"

Digging deeper, I found that the issue is caused by the fact that the static
CellFormatPart.NAMED_COLORS-map is empty. It looks like its initialization code
does not work (any more).

See this line in the class:
https://github.com/apache/poi/blob/3885cb0839541211981dc65bc2891d9bac4aa6bb/src/java/org/apache/poi/ss/format/CellFormatPart.java#L66

The name that is returned here is always HSSFColor. (There is no class
extending this class other than CustomColor). As the following condition checks
whether this name is in ALLCAPS, its body is never executed.

I guess this code used to work on something like enums that has been changed in
the mean time.

-- 
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 62908] CellFormatPart getColor warnings are logged and the method does not return a color

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

--- Comment #3 from christophk <ch...@iconparc.de> ---
Thank you very much for the quick fix!

Unfortunately, I do not have a short code snippet to demonstrate the problem
(apart from the one that PJ Fanning has already used in his unit test), as all
functions that exhibit the problem are private. I only found the problem when I
used POI to parse an excel file that uses conditional formatting, and the only
way the problem shows itself is the logged warning.

-- 
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 62908] CellFormatPart getColor warnings are logged and the method does not return a color

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

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Hopefully one of our enum change experts can be along soon to help!

In the mean time, do you have a short code snippet that triggers the problem,
which we can turn into a junit unit test? That'll help us check it's fixed, and
prevent future accidental breakages too!

-- 
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 62908] CellFormatPart getColor warnings are logged and the method does not return a color

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

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

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

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
Seems to be fixed and no more information is likely to be provided, a simple
unit test is available to verify, thus resolving this now.

-- 
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 62908] CellFormatPart getColor warnings are logged and the method does not return a color

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

--- Comment #2 from PJ Fanning <fa...@yahoo.com> ---
https://svn.apache.org/viewvc?view=revision&revision=1846520 might help. The
main colours (that appear in the warning message) are now added to the map.

The relevant CellFormatPart code hasn't changed in years. Possibly, the
IndexedHash map returned a different set of HSSFColors instances in the past.

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