Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5937C112B3 for ; Fri, 22 Aug 2014 12:36:12 +0000 (UTC) Received: (qmail 12794 invoked by uid 500); 22 Aug 2014 12:36:12 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 12709 invoked by uid 500); 22 Aug 2014 12:36:12 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 12684 invoked by uid 99); 22 Aug 2014 12:36:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Aug 2014 12:36:12 +0000 Date: Fri, 22 Aug 2014 12:36:11 +0000 (UTC) From: "Gavin Shiels (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (IMAGING-140) ExifReWriter always writes EXIF segment before JFIF segment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Gavin Shiels created IMAGING-140: ------------------------------------ Summary: 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 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)); /* ----------------------------------------------------------------------- */ -- This message was sent by Atlassian JIRA (v6.2#6252)