Bug 64972 - HSSFPictureData#getPictureType() disagrees with documented interface
Summary: HSSFPictureData#getPictureType() disagrees with documented interface
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 4.1.2-FINAL
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2020-12-09 19:57 UTC by Marius Volkhart
Modified: 2020-12-09 21:03 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Marius Volkhart 2020-12-09 19:57:28 UTC
HSSFPictureData#getPictureType() is documented as returning -1 if the image type is unknown. However, the interface, PictureData, which HssfPictureData implements, documents that function as returning 0 if the image type is unknown. 

XSSFPictureData follows the interface spec.

I don't know what POI's policy is on interface implementations, but I would think HSSFPictureData should match the documented behavior, or the documentation should be updated to something like "0 or less" if the type is unknown.

There was previous discussion around a switch to enums for this method on XWPFPictureData: https://bz.apache.org/bugzilla/show_bug.cgi?id=59836 but it looks like that change wasn't made.
Comment 1 PJ Fanning 2020-12-09 21:03:35 UTC
added r1884270