Bug 55484 - The wrong usage of byte in RGB
Summary: The wrong usage of byte in RGB
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.9-dev
Hardware: All All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-26 15:13 UTC by wenhua.wang
Modified: 2015-03-22 21:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wenhua.wang 2013-08-26 15:13:15 UTC
I found the bug when I used POI 3.7. I thought it must have been found, so I did not report. Today, when I downloaded  version 3.9, I found the bug was still there.

The root of the bug is the wrong understanding of type "byte".  The author thought that "byte" is unsigned, so it was used to represent data range from 0 to 255, e.g. in file HSSFPalette.java, PaleteRecord.java, XSSFColor.java, and even in the xmlschema generated code, etc. This results completely wrong results.

This bug spreads in many places, I think this is serious. We'd better fix it in the version 3.10. I don't have the source of xml schema, so I can not fix that part. I wish somebody can coordinate this bug fixing.

Thanks.
Comment 1 Dominik Stadler 2013-08-26 18:16:26 UTC
Can you provide a unit test or at least some java code which reproduces an actual problem you see because of usage of byte? 

After all, color-values are three byte so it is possible to use three bytes to represent it and there is nothing wrong per see with using a range from +/-127 instead of from 0 to 255 as long as you handle conversion to other datatypes (short, int, ..) correctly.
Comment 2 Dominik Stadler 2015-03-22 21:51:01 UTC
No response in quite some time, therefore resolving this for now, please reopen with some sample code that shows a problem due to conversion between bytes and other data types.