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

ExifReWriter always writes EXIF segment before JFIF segment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.94-incubator, 0.97, 1.x
    • 1.0-alpha1
    • Format: JPEG
    • All

    Description

      ExifRewriter.writeSegmentsReplacingExif () always writes the EXIF segment as the first segment written to the output stream even when there is JFIF segment present.

      The code checks for the existence of the JFIF segment and it looks like the intention was then to insert the EXIF segment at index 1 but it is instead always inserted at index 0, the variable 'index' is not used after being set to 1.

      'index' should be passed as the first parameter to the segments.add() call.

      org.apache.sanselan.formats.jpeg.exifRewrite.ExifRewriter.java
      int index = 0;
      JFIFPieceSegment firstSegment = (JFIFPieceSegment) segments.get(index);
      
      if (firstSegment.marker == JFIFMarker)
          index = 1;
              
      segments.add(0, new JFIFPieceSegmentExif(JPEG_APP1_Marker,
      markerBytes, markerLengthBytes, newBytes));
      
      

      Attachments

        1. ExifRewriter.java.patch
          0.7 kB
          Gavin Shiels

        Activity

          People

            Unassigned Unassigned
            Shecks Gavin Shiels
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: