commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gavin Shiels (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (IMAGING-140) ExifReWriter always writes EXIF segment before JFIF segment
Date Fri, 22 Aug 2014 12:44:11 GMT

     [ https://issues.apache.org/jira/browse/IMAGING-140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gavin Shiels updated IMAGING-140:
---------------------------------

    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.

{code:title=org.apache.sanselan.formats.jpeg.exifRewrite.ExifRewriter.java|borderStyle=solid}

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));

{code}


  was:
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.

/* ----------------------------------------------------------------------- */
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));

/* ----------------------------------------------------------------------- */



> ExifReWriter always writes EXIF segment before JFIF segment
> -----------------------------------------------------------
>
>                 Key: IMAGING-140
>                 URL: https://issues.apache.org/jira/browse/IMAGING-140
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: JPEG
>    Affects Versions: 1.x, 0.97, 0.94-incubator
>         Environment: All
>            Reporter: Gavin Shiels
>              Labels: EXIF
>
> 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.
> {code:title=org.apache.sanselan.formats.jpeg.exifRewrite.ExifRewriter.java|borderStyle=solid}
> 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));
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message