Gary Lucas created IMAGING-364:
----------------------------------

             Summary: NullPointerException in TiffDirectory.getTiffImage()
                 Key: IMAGING-364
                 URL: https://issues.apache.org/jira/browse/IMAGING-364
             Project: Commons Imaging
          Issue Type: Bug
          Components: Format: TIFF
    Affects Versions: 1.0-alpha3
            Reporter: Gary Lucas


When calling TiffDirectory.getTiffImage(), Commons Imaging throws a null 
pointer exception.  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. 
{code:java}
   public BufferedImage getTiffImage() throws ImagingException, IOException {
        if (null == abstractTiffImageData) {
            return null;
        }
        return new TiffImageParser().getBufferedImage(
                      this, headerByteOrder, null);
    }

{code}
 

We could either make TiffImageParser more robust, or we could avoid passing in 
a null value for the third argument.

 
{code:java}
  TiffImagingParameters defaultParameters = new TiffImagingParameters();
        return new TiffImageParser().getBufferedImage(
                     this, headerByteOrder, defaultParameters);{code}
 

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to