https://bz.apache.org/bugzilla/show_bug.cgi?id=59224
Bug ID: 59224
Summary: XSSFColor.hasTint() has wrong implementation
Product: POI
Version: 3.14-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
It appears that XSSFColor.hasTint() has an incorrect implementation. It checks
to see if the RGB array is length 4 as the determining factor. But other
methods in this class indicate that an length of 4 means the color has an
*alpha* value.
As a concrete example, try creating a xlsx spreadsheet in Excel, with a color
that has a tint value. The hasTint() method will return false, but the
getTint() method returns a non-zero value.
So, I think hasTint() should just be renamed to hasAlpha() (and method's
javadoc comment updated), and a new method created called hasTint(), with an
implemention like below:
/**
* A boolean value indicating if the ctColor has alpha or not
*/
public boolean hasAlpha() {
if (! ctColor.isSetRgb()) {
return false;
}
return ctColor.getRgb().length == 4;
}
/**
* A boolean value indicating if the ctColor has a tint or not
*/
public boolean hasTint() {
return ctColor.getTint() != 0;
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]