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