Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-364

NullPointerException in TiffDirectory.getTiffImage()

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0-alpha3
    • None
    • Format: TIFF
    • 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);

       

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            gwlucas Gary Lucas

            Dates

              Created:
              Updated:

              Slack

                Issue deployment