Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.0-alpha3
-
None
-
None
Description
When calling TiffDirectory.getTiffImage(), Commons Imaging throws a null pointer exception.
java.lang.NullPointerException at org.apache.commons.imaging.formats.tiff.TiffImageParser.checkForSubImage(TiffImageParser.java:78) at org.apache.commons.imaging.formats.tiff.TiffImageParser.getBufferedImage(TiffImageParser.java:261) at org.apache.commons.imaging.formats.tiff.TiffDirectory.getTiffImage(TiffDirectory.java:776)
If you call the alternate method TiffDirectory.getTiffImage(TiffImagingParameters), it works okay. The problem is that the internal method TiffImageParser().getBufferedImage() cannot handle a null reference.
Here's the problematic code from TiffDirectory.java
public BufferedImage getTiffImage() throws ImagingException, IOException { if (null == abstractTiffImageData) { return null; } return new TiffImageParser().getBufferedImage( this, headerByteOrder, null); }
We could either make TiffImageParser more robust, or we could avoid passing in a null value for the third argument.
TiffImagingParameters defaultParameters = new TiffImagingParameters(); return new TiffImageParser().getBufferedImage( this, headerByteOrder, defaultParameters);