Bug 19321 - Off-By-One error on HSSFPalette.getColor()
Summary: Off-By-One error on HSSFPalette.getColor()
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-pre3
Hardware: PC All
: P3 blocker with 4 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-25 13:27 UTC by Wes Gilster
Modified: 2006-08-26 15:38 UTC (History)
0 users



Attachments
Excel file that caused me problems. (Any would probably work) (14.50 KB, application/octet-stream)
2003-04-25 13:28 UTC, Wes Gilster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Gilster 2003-04-25 13:27:11 UTC
It is possible, correctly I don't know, to get a 64 from the 
cell.getCellStyle().getFillForegroundColor()

From looking at the code inside of the 
getColor() method it looks like 64 - 8=56 is 1 out of range for palette entries.  Yet I am getting a 64 
from the getFillForegroundColor() method.

I'm guessing that the problem is with whoever is 
calling the org.apache.poi.hssf.record.ExtendedFormatRecord.setFillForeground() or in 
the
org.apache.poi.hssf.record.ExtendedFormatRecord.fillFields().

It looks like 
getFillForegroundColor() is returning a 1-based index and getColor() is asking for a 0-based 
index.  But don't take my word on it.
Comment 1 Wes Gilster 2003-04-25 13:28:40 UTC
Created attachment 6011 [details]
Excel file that caused me problems.  (Any would probably work)
Comment 2 Andy Oliver 2003-07-24 16:22:01 UTC
this sounds serious
Comment 3 Wes Gilster 2003-07-24 17:19:54 UTC
I thought so too, but I would think that someone would have found this problem 
long ago.  I'm might be missusing these methods...
Comment 4 Avik Sengupta 2003-10-30 17:12:02 UTC
Once again, I dont understand this bug. In the absence of a compilable testcase,
it will have to wait for someone else. 
Comment 5 Jason Height 2006-08-26 22:38:39 UTC
64 is used for the default/automatic/no fill colour. This is handled now in the
HSSFPallette class and the HSSFColor.AUTOMATIC class.

Jason