commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1417043 [8/21] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/ main/java/org/apache/commons/imaging/color/ main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/bytesource/ m...
Date Tue, 04 Dec 2012 17:24:32 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java Tue Dec  4 17:23:16 2012
@@ -62,12 +62,12 @@ public class JpegDecoder extends BinaryF
         return true;
     }
 
-    public void visitSOS(int marker, byte markerBytes[], byte imageData[]) {
-        ByteArrayInputStream is = new ByteArrayInputStream(imageData);
+    public void visitSOS(final int marker, final byte markerBytes[], final byte imageData[]) {
+        final ByteArrayInputStream is = new ByteArrayInputStream(imageData);
         try {
-            int segmentLength = read2Bytes("segmentLength", is,
+            final int segmentLength = read2Bytes("segmentLength", is,
                     "Not a Valid JPEG File");
-            byte[] sosSegmentBytes = readByteArray("SosSegment",
+            final byte[] sosSegmentBytes = readByteArray("SosSegment",
                     segmentLength - 2, is, "Not a Valid JPEG File");
             sosSegment = new SosSegment(marker, sosSegmentBytes);
 
@@ -79,18 +79,18 @@ public class JpegDecoder extends BinaryF
                 vMax = Math.max(vMax,
                         sofnSegment.components[i].verticalSamplingFactor);
             }
-            int hSize = 8 * hMax;
-            int vSize = 8 * vMax;
+            final int hSize = 8 * hMax;
+            final int vSize = 8 * vMax;
 
-            JpegInputStream bitInputStream = new JpegInputStream(is);
-            int xMCUs = (sofnSegment.width + hSize - 1) / hSize;
-            int yMCUs = (sofnSegment.height + vSize - 1) / vSize;
-            Block[] mcu = allocateMCUMemory();
-            Block[] scaledMCU = new Block[mcu.length];
+            final JpegInputStream bitInputStream = new JpegInputStream(is);
+            final int xMCUs = (sofnSegment.width + hSize - 1) / hSize;
+            final int yMCUs = (sofnSegment.height + vSize - 1) / vSize;
+            final Block[] mcu = allocateMCUMemory();
+            final Block[] scaledMCU = new Block[mcu.length];
             for (int i = 0; i < scaledMCU.length; i++) {
                 scaledMCU[i] = new Block(hSize, vSize);
             }
-            int[] preds = new int[sofnSegment.numberOfComponents];
+            final int[] preds = new int[sofnSegment.numberOfComponents];
             ColorModel colorModel;
             WritableRaster raster;
             if (sofnSegment.numberOfComponents == 3) {
@@ -115,7 +115,7 @@ public class JpegDecoder extends BinaryF
                 throw new ImageReadException(sofnSegment.numberOfComponents
                         + " components are invalid or unsupported");
             }
-            DataBuffer dataBuffer = raster.getDataBuffer();
+            final DataBuffer dataBuffer = raster.getDataBuffer();
 
             for (int y1 = 0; y1 < vSize * yMCUs; y1 += vSize) {
                 for (int x1 = 0; x1 < hSize * xMCUs; x1 += hSize) {
@@ -127,14 +127,14 @@ public class JpegDecoder extends BinaryF
                         for (int x2 = 0; x2 < hSize
                                 && x1 + x2 < sofnSegment.width; x2++) {
                             if (scaledMCU.length == 3) {
-                                int Y = scaledMCU[0].samples[srcRowOffset + x2];
-                                int Cb = scaledMCU[1].samples[srcRowOffset + x2];
-                                int Cr = scaledMCU[2].samples[srcRowOffset + x2];
-                                int rgb = YCbCrConverter.convertYCbCrToRGB(Y,
+                                final int Y = scaledMCU[0].samples[srcRowOffset + x2];
+                                final int Cb = scaledMCU[1].samples[srcRowOffset + x2];
+                                final int Cr = scaledMCU[2].samples[srcRowOffset + x2];
+                                final int rgb = YCbCrConverter.convertYCbCrToRGB(Y,
                                         Cb, Cr);
                                 dataBuffer.setElem(dstRowOffset + x2, rgb);
                             } else if (mcu.length == 1) {
-                                int Y = scaledMCU[0].samples[srcRowOffset + x2];
+                                final int Y = scaledMCU[0].samples[srcRowOffset + x2];
                                 dataBuffer.setElem(dstRowOffset + x2, (Y << 16)
                                         | (Y << 8) | Y);
                             } else {
@@ -156,19 +156,19 @@ public class JpegDecoder extends BinaryF
             // System.out.println("" + i + " = " +
             // Integer.toHexString(remainder[i]));
             // }
-        } catch (ImageReadException imageReadEx) {
+        } catch (final ImageReadException imageReadEx) {
             imageReadException = imageReadEx;
-        } catch (IOException ioEx) {
+        } catch (final IOException ioEx) {
             ioException = ioEx;
-        } catch (RuntimeException ex) {
+        } catch (final RuntimeException ex) {
             // Corrupt images can throw NPE and IOOBE
             imageReadException = new ImageReadException("Error parsing JPEG",
                     ex);
         }
     }
 
-    public boolean visitSegment(int marker, byte[] markerBytes,
-            int segmentLength, byte[] segmentLengthBytes, byte[] segmentData)
+    public boolean visitSegment(final int marker, final byte[] markerBytes,
+            final int segmentLength, final byte[] segmentLengthBytes, final byte[] segmentData)
             throws ImageReadException, IOException {
         final int[] sofnSegments = { SOF0Marker, SOF1Marker, SOF2Marker,
                 SOF3Marker, SOF5Marker, SOF6Marker, SOF7Marker, SOF9Marker,
@@ -182,9 +182,9 @@ public class JpegDecoder extends BinaryF
             }
             sofnSegment = new SofnSegment(marker, segmentData);
         } else if (marker == DQTMarker) {
-            DqtSegment dqtSegment = new DqtSegment(marker, segmentData);
+            final DqtSegment dqtSegment = new DqtSegment(marker, segmentData);
             for (int i = 0; i < dqtSegment.quantizationTables.size(); i++) {
-                DqtSegment.QuantizationTable table = dqtSegment.quantizationTables
+                final DqtSegment.QuantizationTable table = dqtSegment.quantizationTables
                         .get(i);
                 if (0 > table.destinationIdentifier
                         || table.destinationIdentifier >= quantizationTables.length) {
@@ -193,9 +193,9 @@ public class JpegDecoder extends BinaryF
                                     + table.destinationIdentifier);
                 }
                 quantizationTables[table.destinationIdentifier] = table;
-                int[] quantizationMatrixInt = new int[64];
+                final int[] quantizationMatrixInt = new int[64];
                 ZigZag.zigZagToBlock(table.elements, quantizationMatrixInt);
-                float[] quantizationMatrixFloat = new float[64];
+                final float[] quantizationMatrixFloat = new float[64];
                 for (int j = 0; j < 64; j++) {
                     quantizationMatrixFloat[j] = quantizationMatrixInt[j];
                 }
@@ -203,9 +203,9 @@ public class JpegDecoder extends BinaryF
                 scaledQuantizationTables[table.destinationIdentifier] = quantizationMatrixFloat;
             }
         } else if (marker == DHTMarker) {
-            DhtSegment dhtSegment = new DhtSegment(marker, segmentData);
+            final DhtSegment dhtSegment = new DhtSegment(marker, segmentData);
             for (int i = 0; i < dhtSegment.huffmanTables.size(); i++) {
-                DhtSegment.HuffmanTable table = dhtSegment.huffmanTables.get(i);
+                final DhtSegment.HuffmanTable table = dhtSegment.huffmanTables.get(i);
                 DhtSegment.HuffmanTable[] tables;
                 if (table.tableClass == 0) {
                     tables = huffmanDCTables;
@@ -227,21 +227,21 @@ public class JpegDecoder extends BinaryF
         return true;
     }
 
-    private void rescaleMCU(Block[] dataUnits, int hSize, int vSize, Block[] ret) {
+    private void rescaleMCU(final Block[] dataUnits, final int hSize, final int vSize, final Block[] ret) {
         for (int i = 0; i < dataUnits.length; i++) {
-            Block block = dataUnits[i];
+            final Block block = dataUnits[i];
             if (block.width == hSize && block.height == vSize) {
                 System.arraycopy(block.samples, 0, ret[i].samples, 0, hSize
                         * vSize);
             } else {
-                int hScale = hSize / block.width;
-                int vScale = vSize / block.height;
+                final int hScale = hSize / block.width;
+                final int vScale = vSize / block.height;
                 if (hScale == 2 && vScale == 2) {
                     int srcRowOffset = 0;
                     int dstRowOffset = 0;
                     for (int y = 0; y < block.height; y++) {
                         for (int x = 0; x < hSize; x++) {
-                            int sample = block.samples[srcRowOffset + (x >> 1)];
+                            final int sample = block.samples[srcRowOffset + (x >> 1)];
                             ret[i].samples[dstRowOffset + x] = sample;
                             ret[i].samples[dstRowOffset + hSize + x] = sample;
                         }
@@ -264,9 +264,9 @@ public class JpegDecoder extends BinaryF
     }
 
     private Block[] allocateMCUMemory() throws ImageReadException {
-        Block[] mcu = new Block[sosSegment.numberOfComponents];
+        final Block[] mcu = new Block[sosSegment.numberOfComponents];
         for (int i = 0; i < sosSegment.numberOfComponents; i++) {
-            SosSegment.Component scanComponent = sosSegment.components[i];
+            final SosSegment.Component scanComponent = sosSegment.components[i];
             SofnSegment.Component frameComponent = null;
             for (int j = 0; j < sofnSegment.numberOfComponents; j++) {
                 if (sofnSegment.components[j].componentIdentifier == scanComponent.scanComponentSelector) {
@@ -277,7 +277,7 @@ public class JpegDecoder extends BinaryF
             if (frameComponent == null) {
                 throw new ImageReadException("Invalid component");
             }
-            Block fullBlock = new Block(
+            final Block fullBlock = new Block(
                     8 * frameComponent.horizontalSamplingFactor,
                     8 * frameComponent.verticalSamplingFactor);
             mcu[i] = fullBlock;
@@ -289,10 +289,10 @@ public class JpegDecoder extends BinaryF
     private final int[] blockInt = new int[64];
     private final float[] block = new float[64];
 
-    private void readMCU(JpegInputStream is, int[] preds, Block[] mcu)
+    private void readMCU(final JpegInputStream is, final int[] preds, final Block[] mcu)
             throws IOException, ImageReadException {
         for (int i = 0; i < sosSegment.numberOfComponents; i++) {
-            SosSegment.Component scanComponent = sosSegment.components[i];
+            final SosSegment.Component scanComponent = sosSegment.components[i];
             SofnSegment.Component frameComponent = null;
             for (int j = 0; j < sofnSegment.numberOfComponents; j++) {
                 if (sofnSegment.components[j].componentIdentifier == scanComponent.scanComponentSelector) {
@@ -303,12 +303,12 @@ public class JpegDecoder extends BinaryF
             if (frameComponent == null) {
                 throw new ImageReadException("Invalid component");
             }
-            Block fullBlock = mcu[i];
+            final Block fullBlock = mcu[i];
             for (int y = 0; y < frameComponent.verticalSamplingFactor; y++) {
                 for (int x = 0; x < frameComponent.horizontalSamplingFactor; x++) {
                     Arrays.fill(zz, 0);
                     // page 104 of T.81
-                    int t = decode(
+                    final int t = decode(
                             is,
                             huffmanDCTables[scanComponent.dcCodingTableSelector]);
                     int diff = receive(t, is);
@@ -319,12 +319,12 @@ public class JpegDecoder extends BinaryF
                     // "Decode_AC_coefficients", figure F.13, page 106 of T.81
                     int k = 1;
                     while (true) {
-                        int rs = decode(
+                        final int rs = decode(
                                 is,
                                 huffmanACTables[scanComponent.acCodingTableSelector]);
-                        int ssss = rs & 0xf;
-                        int rrrr = rs >> 4;
-                        int r = rrrr;
+                        final int ssss = rs & 0xf;
+                        final int rrrr = rs >> 4;
+                        final int r = rrrr;
 
                         if (ssss == 0) {
                             if (r == 15) {
@@ -350,7 +350,7 @@ public class JpegDecoder extends BinaryF
                     final int shift = (1 << (sofnSegment.precision - 1));
                     final int max = (1 << sofnSegment.precision) - 1;
 
-                    float[] scaledQuantizationTable = scaledQuantizationTables[frameComponent.quantTabDestSelector];
+                    final float[] scaledQuantizationTable = scaledQuantizationTables[frameComponent.quantTabDestSelector];
                     ZigZag.zigZagToBlock(zz, blockInt);
                     for (int j = 0; j < 64; j++) {
                         block[j] = blockInt[j] * scaledQuantizationTable[j];
@@ -381,11 +381,11 @@ public class JpegDecoder extends BinaryF
         }
     }
 
-    private static int fastRound(float x) {
+    private static int fastRound(final float x) {
         return (int) (x + 0.5f);
     }
 
-    private int extend(int v, int t) {
+    private int extend(int v, final int t) {
         // "EXTEND", section F.2.2.1, figure F.12, page 105 of T.81
         int vt = (1 << (t - 1));
         while (v < vt) {
@@ -395,7 +395,7 @@ public class JpegDecoder extends BinaryF
         return v;
     }
 
-    private int receive(int ssss, JpegInputStream is) throws IOException,
+    private int receive(final int ssss, final JpegInputStream is) throws IOException,
             ImageReadException {
         // "RECEIVE", section F.2.2.4, figure F.17, page 110 of T.81
         int i = 0;
@@ -407,7 +407,7 @@ public class JpegDecoder extends BinaryF
         return v;
     }
 
-    private int decode(JpegInputStream is, DhtSegment.HuffmanTable huffmanTable)
+    private int decode(final JpegInputStream is, final DhtSegment.HuffmanTable huffmanTable)
             throws IOException, ImageReadException {
         // "DECODE", section F.2.2.3, figure F.16, page 109 of T.81
         int i = 1;
@@ -418,13 +418,13 @@ public class JpegDecoder extends BinaryF
         }
         int j = huffmanTable.valPtr[i];
         j += code - huffmanTable.minCode[i];
-        int value = huffmanTable.huffVal[j];
+        final int value = huffmanTable.huffVal[j];
         return value;
     }
 
-    public BufferedImage decode(ByteSource byteSource) throws IOException,
+    public BufferedImage decode(final ByteSource byteSource) throws IOException,
             ImageReadException {
-        JpegUtils jpegUtils = new JpegUtils();
+        final JpegUtils jpegUtils = new JpegUtils();
         jpegUtils.traverseJFIF(byteSource, this);
         if (imageReadException != null) {
             throw imageReadException;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java Tue Dec  4 17:23:16 2012
@@ -27,7 +27,7 @@ public class JpegInputStream {
     private int cnt = 0;
     private int b;
 
-    public JpegInputStream(InputStream is) {
+    public JpegInputStream(final InputStream is) {
         this.is = is;
     }
 
@@ -39,7 +39,7 @@ public class JpegInputStream {
             }
             cnt = 8;
             if (b == 0xff) {
-                int b2 = is.read();
+                final int b2 = is.read();
                 if (b2 < 0) {
                     throw new ImageReadException("Premature End of File");
                 }
@@ -53,7 +53,7 @@ public class JpegInputStream {
                 }
             }
         }
-        int bit = (b >> 7) & 0x1;
+        final int bit = (b >> 7) & 0x1;
         cnt--;
         b <<= 1;
         return bit;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java Tue Dec  4 17:23:16 2012
@@ -81,7 +81,7 @@ public class YCbCrConverter {
         // but is clamped to [0, 255]
         for (int Cb = 0; Cb < 256; Cb++) {
             for (int Cr = 0; Cr < 256; Cr++) {
-                int value = fastRound(0.34414f * (Cb - 128) + 0.71414f
+                final int value = fastRound(0.34414f * (Cb - 128) + 0.71414f
                         * (Cr - 128));
                 greens1[(Cb << 8) | Cr] = value + 135;
             }
@@ -99,16 +99,16 @@ public class YCbCrConverter {
         }
     }
 
-    private static int fastRound(float x) {
+    private static int fastRound(final float x) {
         // Math.round() is very slow
         return (int) (x + 0.5f);
     }
 
-    public static int convertYCbCrToRGB(int Y, int Cb, int Cr) {
-        int r = reds[(Cr << 8) | Y];
-        int g1 = greens1[(Cb << 8) | Cr];
-        int g = greens2[(g1 << 8) | Y];
-        int b = blues[(Cb << 8) | Y];
+    public static int convertYCbCrToRGB(final int Y, final int Cb, final int Cr) {
+        final int r = reds[(Cr << 8) | Y];
+        final int g1 = greens1[(Cb << 8) | Cr];
+        final int g = greens2[(g1 << 8) | Y];
+        final int b = blues[(Cb << 8) | Y];
         return r | g | b;
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java Tue Dec  4 17:23:16 2012
@@ -65,7 +65,7 @@ public class ExifRewriter extends Binary
      * @param byteOrder
      *            byte order of EXIF segment.
      */
-    public ExifRewriter(ByteOrder byteOrder) {
+    public ExifRewriter(final ByteOrder byteOrder) {
         setByteOrder(byteOrder);
     }
 
@@ -100,7 +100,7 @@ public class ExifRewriter extends Binary
         }
 
         @Override
-        protected void write(OutputStream os) throws IOException {
+        protected void write(final OutputStream os) throws IOException {
             os.write(markerBytes);
             os.write(markerLengthBytes);
             os.write(segmentData);
@@ -127,34 +127,34 @@ public class ExifRewriter extends Binary
         }
 
         @Override
-        protected void write(OutputStream os) throws IOException {
+        protected void write(final OutputStream os) throws IOException {
             os.write(markerBytes);
             os.write(imageData);
         }
     }
 
-    private JFIFPieces analyzeJFIF(ByteSource byteSource)
+    private JFIFPieces analyzeJFIF(final ByteSource byteSource)
             throws ImageReadException, IOException
     // , ImageWriteException
     {
         final List<JFIFPiece> pieces = new ArrayList<JFIFPiece>();
         final List<JFIFPiece> exifPieces = new ArrayList<JFIFPiece>();
 
-        JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
+        final JpegUtils.Visitor visitor = new JpegUtils.Visitor() {
             // return false to exit before reading image data.
             public boolean beginSOS() {
                 return true;
             }
 
-            public void visitSOS(int marker, byte markerBytes[],
-                    byte imageData[]) {
+            public void visitSOS(final int marker, final byte markerBytes[],
+                    final byte imageData[]) {
                 pieces.add(new JFIFPieceImageData(markerBytes, imageData));
             }
 
             // return false to exit traversal.
-            public boolean visitSegment(int marker, byte markerBytes[],
-                    int markerLength, byte markerLengthBytes[],
-                    byte segmentData[]) throws
+            public boolean visitSegment(final int marker, final byte markerBytes[],
+                    final int markerLength, final byte markerLengthBytes[],
+                    final byte segmentData[]) throws
             // ImageWriteException,
                     ImageReadException, IOException {
                 if (marker != JPEG_APP1_Marker) {
@@ -169,7 +169,7 @@ public class ExifRewriter extends Binary
                 // throw new ImageReadException(
                 // "More than one APP1 EXIF segment.");
                 } else {
-                    JFIFPiece piece = new JFIFPieceSegmentExif(marker,
+                    final JFIFPiece piece = new JFIFPieceSegmentExif(marker,
                             markerBytes, markerLengthBytes, segmentData);
                     pieces.add(piece);
                     exifPieces.add(piece);
@@ -205,9 +205,9 @@ public class ExifRewriter extends Binary
      * @see java.io.File
      * @see java.io.OutputStream
      */
-    public void removeExifMetadata(File src, OutputStream os)
+    public void removeExifMetadata(final File src, final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        ByteSource byteSource = new ByteSourceFile(src);
+        final ByteSource byteSource = new ByteSourceFile(src);
         removeExifMetadata(byteSource, os);
     }
 
@@ -221,9 +221,9 @@ public class ExifRewriter extends Binary
      * @param os
      *            OutputStream to write the image to.
      */
-    public void removeExifMetadata(byte src[], OutputStream os)
+    public void removeExifMetadata(final byte src[], final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        ByteSource byteSource = new ByteSourceArray(src);
+        final ByteSource byteSource = new ByteSourceArray(src);
         removeExifMetadata(byteSource, os);
     }
 
@@ -237,9 +237,9 @@ public class ExifRewriter extends Binary
      * @param os
      *            OutputStream to write the image to.
      */
-    public void removeExifMetadata(InputStream src, OutputStream os)
+    public void removeExifMetadata(final InputStream src, final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        ByteSource byteSource = new ByteSourceInputStream(src, null);
+        final ByteSource byteSource = new ByteSourceInputStream(src, null);
         removeExifMetadata(byteSource, os);
     }
 
@@ -253,10 +253,10 @@ public class ExifRewriter extends Binary
      * @param os
      *            OutputStream to write the image to.
      */
-    public void removeExifMetadata(ByteSource byteSource, OutputStream os)
+    public void removeExifMetadata(final ByteSource byteSource, final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        JFIFPieces jfifPieces = analyzeJFIF(byteSource);
-        List<JFIFPiece> pieces = jfifPieces.pieces;
+        final JFIFPieces jfifPieces = analyzeJFIF(byteSource);
+        final List<JFIFPiece> pieces = jfifPieces.pieces;
 
         // Debug.debug("pieces", pieces);
 
@@ -286,10 +286,10 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossless(File src, OutputStream os,
-            TiffOutputSet outputSet) throws ImageReadException, IOException,
+    public void updateExifMetadataLossless(final File src, final OutputStream os,
+            final TiffOutputSet outputSet) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceFile(src);
+        final ByteSource byteSource = new ByteSourceFile(src);
         updateExifMetadataLossless(byteSource, os, outputSet);
     }
 
@@ -312,10 +312,10 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossless(byte src[], OutputStream os,
-            TiffOutputSet outputSet) throws ImageReadException, IOException,
+    public void updateExifMetadataLossless(final byte src[], final OutputStream os,
+            final TiffOutputSet outputSet) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceArray(src);
+        final ByteSource byteSource = new ByteSourceArray(src);
         updateExifMetadataLossless(byteSource, os, outputSet);
     }
 
@@ -338,10 +338,10 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossless(InputStream src, OutputStream os,
-            TiffOutputSet outputSet) throws ImageReadException, IOException,
+    public void updateExifMetadataLossless(final InputStream src, final OutputStream os,
+            final TiffOutputSet outputSet) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceInputStream(src, null);
+        final ByteSource byteSource = new ByteSourceInputStream(src, null);
         updateExifMetadataLossless(byteSource, os, outputSet);
     }
 
@@ -364,12 +364,12 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossless(ByteSource byteSource,
-            OutputStream os, TiffOutputSet outputSet)
+    public void updateExifMetadataLossless(final ByteSource byteSource,
+            final OutputStream os, final TiffOutputSet outputSet)
             throws ImageReadException, IOException, ImageWriteException {
         // List outputDirectories = outputSet.getDirectories();
-        JFIFPieces jfifPieces = analyzeJFIF(byteSource);
-        List<JFIFPiece> pieces = jfifPieces.pieces;
+        final JFIFPieces jfifPieces = analyzeJFIF(byteSource);
+        final List<JFIFPiece> pieces = jfifPieces.pieces;
 
         TiffImageWriterBase writer;
         // Just use first APP1 segment for now.
@@ -387,8 +387,8 @@ public class ExifRewriter extends Binary
             writer = new TiffImageWriterLossy(outputSet.byteOrder);
         }
 
-        boolean includeEXIFPrefix = true;
-        byte newBytes[] = writeExifSegment(writer, outputSet, includeEXIFPrefix);
+        final boolean includeEXIFPrefix = true;
+        final byte newBytes[] = writeExifSegment(writer, outputSet, includeEXIFPrefix);
 
         writeSegmentsReplacingExif(os, pieces, newBytes);
     }
@@ -409,10 +409,10 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossy(byte src[], OutputStream os,
-            TiffOutputSet outputSet) throws ImageReadException, IOException,
+    public void updateExifMetadataLossy(final byte src[], final OutputStream os,
+            final TiffOutputSet outputSet) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceArray(src);
+        final ByteSource byteSource = new ByteSourceArray(src);
         updateExifMetadataLossy(byteSource, os, outputSet);
     }
 
@@ -432,10 +432,10 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossy(InputStream src, OutputStream os,
-            TiffOutputSet outputSet) throws ImageReadException, IOException,
+    public void updateExifMetadataLossy(final InputStream src, final OutputStream os,
+            final TiffOutputSet outputSet) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceInputStream(src, null);
+        final ByteSource byteSource = new ByteSourceInputStream(src, null);
         updateExifMetadataLossy(byteSource, os, outputSet);
     }
 
@@ -455,10 +455,10 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossy(File src, OutputStream os,
-            TiffOutputSet outputSet) throws ImageReadException, IOException,
+    public void updateExifMetadataLossy(final File src, final OutputStream os,
+            final TiffOutputSet outputSet) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceFile(src);
+        final ByteSource byteSource = new ByteSourceFile(src);
         updateExifMetadataLossy(byteSource, os, outputSet);
     }
 
@@ -478,25 +478,25 @@ public class ExifRewriter extends Binary
      * @param outputSet
      *            TiffOutputSet containing the EXIF data to write.
      */
-    public void updateExifMetadataLossy(ByteSource byteSource, OutputStream os,
-            TiffOutputSet outputSet) throws ImageReadException, IOException,
+    public void updateExifMetadataLossy(final ByteSource byteSource, final OutputStream os,
+            final TiffOutputSet outputSet) throws ImageReadException, IOException,
             ImageWriteException {
-        JFIFPieces jfifPieces = analyzeJFIF(byteSource);
-        List<JFIFPiece> pieces = jfifPieces.pieces;
+        final JFIFPieces jfifPieces = analyzeJFIF(byteSource);
+        final List<JFIFPiece> pieces = jfifPieces.pieces;
 
-        TiffImageWriterBase writer = new TiffImageWriterLossy(
+        final TiffImageWriterBase writer = new TiffImageWriterLossy(
                 outputSet.byteOrder);
 
-        boolean includeEXIFPrefix = true;
-        byte newBytes[] = writeExifSegment(writer, outputSet, includeEXIFPrefix);
+        final boolean includeEXIFPrefix = true;
+        final byte newBytes[] = writeExifSegment(writer, outputSet, includeEXIFPrefix);
 
         writeSegmentsReplacingExif(os, pieces, newBytes);
     }
 
-    private void writeSegmentsReplacingExif(OutputStream os,
-            List<JFIFPiece> segments, byte newBytes[])
+    private void writeSegmentsReplacingExif(final OutputStream os,
+            final List<JFIFPiece> segments, final byte newBytes[])
             throws ImageWriteException, IOException {
-        ByteOrder byteOrder = getByteOrder();
+        final ByteOrder byteOrder = getByteOrder();
 
         try {
             SOI.writeTo(os);
@@ -504,25 +504,25 @@ public class ExifRewriter extends Binary
             boolean hasExif = false;
 
             for (int i = 0; i < segments.size(); i++) {
-                JFIFPiece piece = segments.get(i);
+                final JFIFPiece piece = segments.get(i);
                 if (piece instanceof JFIFPieceSegmentExif) {
                     hasExif = true;
                 }
             }
 
             if (!hasExif && newBytes != null) {
-                byte markerBytes[] = convertShortToByteArray(JPEG_APP1_Marker,
+                final byte markerBytes[] = convertShortToByteArray(JPEG_APP1_Marker,
                         byteOrder);
                 if (newBytes.length > 0xffff) {
                     throw new ExifOverflowException(
                             "APP1 Segment is too long: " + newBytes.length);
                 }
-                int markerLength = newBytes.length + 2;
-                byte markerLengthBytes[] = convertShortToByteArray(
+                final int markerLength = newBytes.length + 2;
+                final byte markerLengthBytes[] = convertShortToByteArray(
                         markerLength, byteOrder);
 
                 int index = 0;
-                JFIFPieceSegment firstSegment = (JFIFPieceSegment) segments
+                final JFIFPieceSegment firstSegment = (JFIFPieceSegment) segments
                         .get(index);
                 if (firstSegment.marker == JFIFMarker) {
                     index = 1;
@@ -534,7 +534,7 @@ public class ExifRewriter extends Binary
             boolean APP1Written = false;
 
             for (int i = 0; i < segments.size(); i++) {
-                JFIFPiece piece = segments.get(i);
+                final JFIFPiece piece = segments.get(i);
                 if (piece instanceof JFIFPieceSegmentExif) {
                     // only replace first APP1 segment; skips others.
                     if (APP1Written) {
@@ -546,14 +546,14 @@ public class ExifRewriter extends Binary
                         continue;
                     }
 
-                    byte markerBytes[] = convertShortToByteArray(
+                    final byte markerBytes[] = convertShortToByteArray(
                             JPEG_APP1_Marker, byteOrder);
                     if (newBytes.length > 0xffff) {
                         throw new ExifOverflowException(
                                 "APP1 Segment is too long: " + newBytes.length);
                     }
-                    int markerLength = newBytes.length + 2;
-                    byte markerLengthBytes[] = convertShortToByteArray(
+                    final int markerLength = newBytes.length + 2;
+                    final byte markerLengthBytes[] = convertShortToByteArray(
                             markerLength, byteOrder);
 
                     os.write(markerBytes);
@@ -566,7 +566,7 @@ public class ExifRewriter extends Binary
         } finally {
             try {
                 os.close();
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 Debug.debug(e);
             }
         }
@@ -575,15 +575,15 @@ public class ExifRewriter extends Binary
     public static class ExifOverflowException extends ImageWriteException {
         private static final long serialVersionUID = 1401484357224931218L;
 
-        public ExifOverflowException(String s) {
+        public ExifOverflowException(final String s) {
             super(s);
         }
     }
 
-    private byte[] writeExifSegment(TiffImageWriterBase writer,
-            TiffOutputSet outputSet, boolean includeEXIFPrefix)
+    private byte[] writeExifSegment(final TiffImageWriterBase writer,
+            final TiffOutputSet outputSet, final boolean includeEXIFPrefix)
             throws IOException, ImageWriteException {
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
 
         if (includeEXIFPrefix) {
             EXIF_IDENTIFIER_CODE.writeTo(os);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java Tue Dec  4 17:23:16 2012
@@ -24,7 +24,7 @@ public class IptcBlock {
     public final byte[] blockNameBytes;
     public final byte[] blockData;
 
-    public IptcBlock(int blockType, byte[] blockNameBytes, byte[] blockData) {
+    public IptcBlock(final int blockType, final byte[] blockNameBytes, final byte[] blockData) {
         this.blockData = blockData;
         this.blockNameBytes = blockNameBytes;
         this.blockType = blockType;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java Tue Dec  4 17:23:16 2012
@@ -42,13 +42,13 @@ public class IptcParser extends BinaryFi
         setByteOrder(ByteOrder.NETWORK);
     }
 
-    public boolean isPhotoshopJpegSegment(byte segmentData[]) {
+    public boolean isPhotoshopJpegSegment(final byte segmentData[]) {
         if (!BinaryFileParser.byteArrayHasPrefix(segmentData,
                 PHOTOSHOP_IDENTIFICATION_STRING)) {
             return false;
         }
 
-        int index = PHOTOSHOP_IDENTIFICATION_STRING.size();
+        final int index = PHOTOSHOP_IDENTIFICATION_STRING.size();
         if (index + CONST_8BIM.size() > segmentData.length) {
             return false;
         }
@@ -97,25 +97,25 @@ public class IptcParser extends BinaryFi
      * Some IPTC blocks are missing this first "record version" record, so we
      * don't require it.
      */
-    public PhotoshopApp13Data parsePhotoshopSegment(byte bytes[], Map<String,Object> params)
+    public PhotoshopApp13Data parsePhotoshopSegment(final byte bytes[], final Map<String,Object> params)
             throws ImageReadException, IOException {
-        boolean strict = ParamMap.getParamBoolean(params,
+        final boolean strict = ParamMap.getParamBoolean(params,
                 ImagingConstants.PARAM_KEY_STRICT, false);
-        boolean verbose = ParamMap.getParamBoolean(params,
+        final boolean verbose = ParamMap.getParamBoolean(params,
                 ImagingConstants.PARAM_KEY_VERBOSE, false);
 
         return parsePhotoshopSegment(bytes, verbose, strict);
     }
 
-    public PhotoshopApp13Data parsePhotoshopSegment(byte bytes[],
-            boolean verbose, boolean strict) throws ImageReadException,
+    public PhotoshopApp13Data parsePhotoshopSegment(final byte bytes[],
+            final boolean verbose, final boolean strict) throws ImageReadException,
             IOException {
-        List<IptcRecord> records = new ArrayList<IptcRecord>();
+        final List<IptcRecord> records = new ArrayList<IptcRecord>();
 
-        List<IptcBlock> allBlocks = parseAllBlocks(bytes, verbose, strict);
+        final List<IptcBlock> allBlocks = parseAllBlocks(bytes, verbose, strict);
 
         for (int i = 0; i < allBlocks.size(); i++) {
-            IptcBlock block = allBlocks.get(i);
+            final IptcBlock block = allBlocks.get(i);
 
             // Ignore everything but IPTC data.
             if (!block.isIPTCBlock()) {
@@ -128,14 +128,14 @@ public class IptcParser extends BinaryFi
         return new PhotoshopApp13Data(records, allBlocks);
     }
 
-    protected List<IptcRecord> parseIPTCBlock(byte bytes[], boolean verbose)
+    protected List<IptcRecord> parseIPTCBlock(final byte bytes[], final boolean verbose)
             throws ImageReadException, IOException {
-        List<IptcRecord> elements = new ArrayList<IptcRecord>();
+        final List<IptcRecord> elements = new ArrayList<IptcRecord>();
 
         int index = 0;
         // Integer recordVersion = null;
         while (index + 1 < bytes.length) {
-            int tagMarker = 0xff & bytes[index++];
+            final int tagMarker = 0xff & bytes[index++];
             if (verbose) {
                 Debug.debug("tagMarker",
                         tagMarker + " (0x" + Integer.toHexString(tagMarker)
@@ -149,7 +149,7 @@ public class IptcParser extends BinaryFi
                 return elements;
             }
 
-            int recordNumber = 0xff & bytes[index++];
+            final int recordNumber = 0xff & bytes[index++];
             if (verbose) {
                 Debug.debug(
                         "recordNumber",
@@ -175,7 +175,7 @@ public class IptcParser extends BinaryFi
             // throw new ImageReadException(
             // "Unexpected record prefix in IPTC data.");
 
-            int recordType = 0xff & bytes[index];
+            final int recordType = 0xff & bytes[index];
             if (verbose) {
                 Debug.debug("recordType",
                         recordType + " (0x" + Integer.toHexString(recordType)
@@ -183,11 +183,11 @@ public class IptcParser extends BinaryFi
             }
             index++;
 
-            int recordSize = convertByteArrayToShort("recordSize", index, bytes);
+            final int recordSize = convertByteArrayToShort("recordSize", index, bytes);
             index += 2;
 
-            boolean extendedDataset = recordSize > IPTC_NON_EXTENDED_RECORD_MAXIMUM_SIZE;
-            int dataFieldCountLength = recordSize & 0x7fff;
+            final boolean extendedDataset = recordSize > IPTC_NON_EXTENDED_RECORD_MAXIMUM_SIZE;
+            final int dataFieldCountLength = recordSize & 0x7fff;
             if (extendedDataset && verbose) {
                 Debug.debug("extendedDataset. dataFieldCountLength: "
                         + dataFieldCountLength);
@@ -197,7 +197,7 @@ public class IptcParser extends BinaryFi
                 return elements;
             }
 
-            byte recordData[] = readBytearray("recordData", bytes, index,
+            final byte recordData[] = readBytearray("recordData", bytes, index,
                     recordSize);
             index += recordSize;
 
@@ -240,9 +240,9 @@ public class IptcParser extends BinaryFi
             // continue;
             // }
 
-            String value = new String(recordData, "ISO-8859-1");
+            final String value = new String(recordData, "ISO-8859-1");
 
-            IptcType iptcType = IptcTypeLookup.getIptcType(recordType);
+            final IptcType iptcType = IptcTypeLookup.getIptcType(recordType);
 
             // Debug.debug("iptcType", iptcType);
             // debugByteArray("iptcData", iptcData);
@@ -255,16 +255,16 @@ public class IptcParser extends BinaryFi
             // Debug.debug("index", IPTC_TYPE_CREDIT.name);
             // }
 
-            IptcRecord element = new IptcRecord(iptcType, recordData, value);
+            final IptcRecord element = new IptcRecord(iptcType, recordData, value);
             elements.add(element);
         }
 
         return elements;
     }
 
-    protected List<IptcBlock> parseAllBlocks(byte bytes[], boolean verbose,
-            boolean strict) throws ImageReadException, IOException {
-        List<IptcBlock> blocks = new ArrayList<IptcBlock>();
+    protected List<IptcBlock> parseAllBlocks(final byte bytes[], final boolean verbose,
+            final boolean strict) throws ImageReadException, IOException {
+        final List<IptcBlock> blocks = new ArrayList<IptcBlock>();
 
         BinaryInputStream bis = null;
         try {
@@ -273,7 +273,7 @@ public class IptcParser extends BinaryFi
             // Note that these are unsigned quantities. Name is always an even
             // number of bytes (including the 1st byte, which is the size.)
     
-            byte[] idString = bis.readByteArray(
+            final byte[] idString = bis.readByteArray(
                     PHOTOSHOP_IDENTIFICATION_STRING.size(),
                     "App13 Segment missing identification string");
             if (!PHOTOSHOP_IDENTIFICATION_STRING.equals(idString)) {
@@ -283,7 +283,7 @@ public class IptcParser extends BinaryFi
             // int index = PHOTOSHOP_IDENTIFICATION_STRING.length;
     
             while (true) {
-                byte[] imageResourceBlockSignature = bis
+                final byte[] imageResourceBlockSignature = bis
                         .readByteArray(CONST_8BIM.size(),
                                 "App13 Segment missing identification string",
                                 false, false);
@@ -295,7 +295,7 @@ public class IptcParser extends BinaryFi
                             "Invalid Image Resource Block Signature");
                 }
     
-                int blockType = bis
+                final int blockType = bis
                         .read2ByteInteger("Image Resource Block missing type");
                 if (verbose) {
                     Debug.debug("blockType",
@@ -303,7 +303,7 @@ public class IptcParser extends BinaryFi
                                     + ")");
                 }
     
-                int blockNameLength = bis
+                final int blockNameLength = bis
                         .read1ByteInteger("Image Resource Block missing name length");
                 if (verbose && blockNameLength > 0) {
                     Debug.debug("blockNameLength", blockNameLength + " (0x"
@@ -325,7 +325,7 @@ public class IptcParser extends BinaryFi
                     }
                 }
     
-                int blockSize = bis
+                final int blockSize = bis
                         .read4ByteInteger("Image Resource Block missing size");
                 if (verbose) {
                     Debug.debug("blockSize",
@@ -342,7 +342,7 @@ public class IptcParser extends BinaryFi
                             + blockSize + " > " + bytes.length);
                 }
     
-                byte[] blockData = bis.readByteArray(blockSize,
+                final byte[] blockData = bis.readByteArray(blockSize,
                         "Invalid Image Resource Block data", verbose, strict);
                 if (null == blockData) {
                     break;
@@ -365,16 +365,16 @@ public class IptcParser extends BinaryFi
 
     // private void writeIPTCRecord(BinaryOutputStream bos, )
 
-    public byte[] writePhotoshopApp13Segment(PhotoshopApp13Data data)
+    public byte[] writePhotoshopApp13Segment(final PhotoshopApp13Data data)
             throws IOException, ImageWriteException {
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
-        BinaryOutputStream bos = new BinaryOutputStream(os);
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
+        final BinaryOutputStream bos = new BinaryOutputStream(os);
 
         PHOTOSHOP_IDENTIFICATION_STRING.writeTo(bos);
 
-        List<IptcBlock> blocks = data.getRawBlocks();
+        final List<IptcBlock> blocks = data.getRawBlocks();
         for (int i = 0; i < blocks.size(); i++) {
-            IptcBlock block = blocks.get(i);
+            final IptcBlock block = blocks.get(i);
 
             CONST_8BIM.writeTo(bos);
 
@@ -412,8 +412,8 @@ public class IptcParser extends BinaryFi
     public byte[] writeIPTCBlock(List<IptcRecord> elements)
             throws ImageWriteException, IOException {
         byte blockData[];
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        BinaryOutputStream bos = new BinaryOutputStream(baos,
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final BinaryOutputStream bos = new BinaryOutputStream(baos,
                 getByteOrder());
 
         // first, right record version record
@@ -428,8 +428,8 @@ public class IptcParser extends BinaryFi
         elements = new ArrayList<IptcRecord>(elements);
 
         // sort the list. Records must be in numerical order.
-        Comparator<IptcRecord> comparator = new Comparator<IptcRecord>() {
-            public int compare(IptcRecord e1, IptcRecord e2) {
+        final Comparator<IptcRecord> comparator = new Comparator<IptcRecord>() {
+            public int compare(final IptcRecord e1, final IptcRecord e2) {
                 return e2.iptcType.getType() - e1.iptcType.getType();
             }
         };
@@ -438,7 +438,7 @@ public class IptcParser extends BinaryFi
 
         // write the list.
         for (int i = 0; i < elements.size(); i++) {
-            IptcRecord element = elements.get(i);
+            final IptcRecord element = elements.get(i);
 
             if (element.iptcType == IptcTypes.RECORD_VERSION) {
                 continue; // ignore
@@ -453,7 +453,7 @@ public class IptcParser extends BinaryFi
             }
             bos.write(element.iptcType.getType());
 
-            byte recordData[] = element.value.getBytes("ISO-8859-1");
+            final byte recordData[] = element.value.getBytes("ISO-8859-1");
             if (!new String(recordData, "ISO-8859-1").equals(element.value)) {
                 throw new ImageWriteException(
                         "Invalid record value, not ISO-8859-1");

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java Tue Dec  4 17:23:16 2012
@@ -27,18 +27,18 @@ public class IptcRecord {
     private final byte[] bytes;
     public final String value;
 
-    public IptcRecord(IptcType iptcType, byte[] bytes, String value) {
+    public IptcRecord(final IptcType iptcType, final byte[] bytes, final String value) {
         this.iptcType = iptcType;
         this.bytes = bytes;
         this.value = value;
     }
 
-    public IptcRecord(IptcType iptcType, String value) {
+    public IptcRecord(final IptcType iptcType, final String value) {
         this.iptcType = iptcType;
         byte[] bytes;
         try {
             bytes = value.getBytes("ISO-8859-1");
-        } catch (UnsupportedEncodingException cannotHappen) {
+        } catch (final UnsupportedEncodingException cannotHappen) {
             bytes = null;
         }
         this.bytes = bytes;
@@ -58,7 +58,7 @@ public class IptcRecord {
     }
 
     public static final Comparator<IptcRecord> COMPARATOR = new Comparator<IptcRecord>() {
-        public int compare(IptcRecord e1, IptcRecord e2) {
+        public int compare(final IptcRecord e1, final IptcRecord e2) {
             return e1.iptcType.getType() - e2.iptcType.getType();
         }
     };

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java Tue Dec  4 17:23:16 2012
@@ -23,12 +23,12 @@ public abstract class IptcTypeLookup imp
 
     private static final Map<Integer, IptcType> IPTC_TYPE_MAP = new HashMap<Integer, IptcType>();
     static {
-        for (IptcType iptcType : IptcTypes.values()) {
+        for (final IptcType iptcType : IptcTypes.values()) {
             IPTC_TYPE_MAP.put(iptcType.getType(), iptcType);
         }
     }
 
-    public static final IptcType getIptcType(int type) {
+    public static final IptcType getIptcType(final int type) {
         if (!IPTC_TYPE_MAP.containsKey(type)) {
             return IptcTypes.getUnknown(type);
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java Tue Dec  4 17:23:16 2012
@@ -135,7 +135,7 @@ public enum IptcTypes implements IptcTyp
     public final int type;
     public final String name;
     
-    IptcTypes(int type, String name) {
+    IptcTypes(final int type, final String name) {
         this.type = type;
         this.name = name;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java Tue Dec  4 17:23:16 2012
@@ -53,9 +53,9 @@ public class JpegIptcRewriter extends Jp
      * @see java.io.File
      * @see java.io.OutputStream
      */
-    public void removeIPTC(File src, OutputStream os)
+    public void removeIPTC(final File src, final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        ByteSource byteSource = new ByteSourceFile(src);
+        final ByteSource byteSource = new ByteSourceFile(src);
         removeIPTC(byteSource, os);
     }
 
@@ -70,9 +70,9 @@ public class JpegIptcRewriter extends Jp
      * @param os
      *            OutputStream to write the image to.
      */
-    public void removeIPTC(byte src[], OutputStream os)
+    public void removeIPTC(final byte src[], final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        ByteSource byteSource = new ByteSourceArray(src);
+        final ByteSource byteSource = new ByteSourceArray(src);
         removeIPTC(byteSource, os);
     }
 
@@ -87,9 +87,9 @@ public class JpegIptcRewriter extends Jp
      * @param os
      *            OutputStream to write the image to.
      */
-    public void removeIPTC(InputStream src, OutputStream os)
+    public void removeIPTC(final InputStream src, final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        ByteSource byteSource = new ByteSourceInputStream(src, null);
+        final ByteSource byteSource = new ByteSourceInputStream(src, null);
         removeIPTC(byteSource, os);
     }
 
@@ -104,30 +104,30 @@ public class JpegIptcRewriter extends Jp
      * @param os
      *            OutputStream to write the image to.
      */
-    public void removeIPTC(ByteSource byteSource, OutputStream os)
+    public void removeIPTC(final ByteSource byteSource, final OutputStream os)
             throws ImageReadException, IOException, ImageWriteException {
-        JFIFPieces jfifPieces = analyzeJFIF(byteSource);
-        List<JFIFPiece> oldPieces = jfifPieces.pieces;
-        List<JFIFPiece> photoshopApp13Segments = findPhotoshopApp13Segments(oldPieces);
+        final JFIFPieces jfifPieces = analyzeJFIF(byteSource);
+        final List<JFIFPiece> oldPieces = jfifPieces.pieces;
+        final List<JFIFPiece> photoshopApp13Segments = findPhotoshopApp13Segments(oldPieces);
 
         if (photoshopApp13Segments.size() > 1) {
             throw new ImageReadException(
                     "Image contains more than one Photoshop App13 segment.");
         }
-        List<JFIFPiece> newPieces = removePhotoshopApp13Segments(oldPieces);
+        final List<JFIFPiece> newPieces = removePhotoshopApp13Segments(oldPieces);
         if (photoshopApp13Segments.size() == 1) {
-            JFIFPieceSegment oldSegment = (JFIFPieceSegment) photoshopApp13Segments
+            final JFIFPieceSegment oldSegment = (JFIFPieceSegment) photoshopApp13Segments
                     .get(0);
-            Map<String,Object> params = new HashMap<String,Object>();
-            PhotoshopApp13Data oldData = new IptcParser()
+            final Map<String,Object> params = new HashMap<String,Object>();
+            final PhotoshopApp13Data oldData = new IptcParser()
                     .parsePhotoshopSegment(oldSegment.segmentData, params);
-            List<IptcBlock> newBlocks = oldData.getNonIptcBlocks();
-            List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
-            PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+            final List<IptcBlock> newBlocks = oldData.getNonIptcBlocks();
+            final List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
+            final PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
                     newBlocks);
-            byte segmentBytes[] = new IptcParser()
+            final byte segmentBytes[] = new IptcParser()
                     .writePhotoshopApp13Segment(newData);
-            JFIFPieceSegment newSegment = new JFIFPieceSegment(
+            final JFIFPieceSegment newSegment = new JFIFPieceSegment(
                     oldSegment.marker, segmentBytes);
             newPieces.add(oldPieces.indexOf(oldSegment), newSegment);
         }
@@ -146,10 +146,10 @@ public class JpegIptcRewriter extends Jp
      * @param newData
      *            structure containing IPTC data.
      */
-    public void writeIPTC(byte src[], OutputStream os,
-            PhotoshopApp13Data newData) throws ImageReadException, IOException,
+    public void writeIPTC(final byte src[], final OutputStream os,
+            final PhotoshopApp13Data newData) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceArray(src);
+        final ByteSource byteSource = new ByteSourceArray(src);
         writeIPTC(byteSource, os, newData);
     }
 
@@ -165,10 +165,10 @@ public class JpegIptcRewriter extends Jp
      * @param newData
      *            structure containing IPTC data.
      */
-    public void writeIPTC(InputStream src, OutputStream os,
-            PhotoshopApp13Data newData) throws ImageReadException, IOException,
+    public void writeIPTC(final InputStream src, final OutputStream os,
+            final PhotoshopApp13Data newData) throws ImageReadException, IOException,
             ImageWriteException {
-        ByteSource byteSource = new ByteSourceInputStream(src, null);
+        final ByteSource byteSource = new ByteSourceInputStream(src, null);
         writeIPTC(byteSource, os, newData);
     }
 
@@ -184,9 +184,9 @@ public class JpegIptcRewriter extends Jp
      * @param newData
      *            structure containing IPTC data.
      */
-    public void writeIPTC(File src, OutputStream os, PhotoshopApp13Data newData)
+    public void writeIPTC(final File src, final OutputStream os, final PhotoshopApp13Data newData)
             throws ImageReadException, IOException, ImageWriteException {
-        ByteSource byteSource = new ByteSourceFile(src);
+        final ByteSource byteSource = new ByteSourceFile(src);
         writeIPTC(byteSource, os, newData);
     }
 
@@ -202,12 +202,12 @@ public class JpegIptcRewriter extends Jp
      * @param newData
      *            structure containing IPTC data.
      */
-    public void writeIPTC(ByteSource byteSource, OutputStream os,
+    public void writeIPTC(final ByteSource byteSource, final OutputStream os,
             PhotoshopApp13Data newData) throws ImageReadException, IOException,
             ImageWriteException {
-        JFIFPieces jfifPieces = analyzeJFIF(byteSource);
-        List<JFIFPiece> oldPieces = jfifPieces.pieces;
-        List<JFIFPiece> photoshopApp13Segments = findPhotoshopApp13Segments(oldPieces);
+        final JFIFPieces jfifPieces = analyzeJFIF(byteSource);
+        final List<JFIFPiece> oldPieces = jfifPieces.pieces;
+        final List<JFIFPiece> photoshopApp13Segments = findPhotoshopApp13Segments(oldPieces);
 
         if (photoshopApp13Segments.size() > 1) {
             throw new ImageReadException(
@@ -217,21 +217,21 @@ public class JpegIptcRewriter extends Jp
 
         {
             // discard old iptc blocks.
-            List<IptcBlock> newBlocks = newData.getNonIptcBlocks();
-            byte[] newBlockBytes = new IptcParser().writeIPTCBlock(newData
+            final List<IptcBlock> newBlocks = newData.getNonIptcBlocks();
+            final byte[] newBlockBytes = new IptcParser().writeIPTCBlock(newData
                     .getRecords());
 
-            int blockType = IMAGE_RESOURCE_BLOCK_IPTC_DATA;
-            byte[] blockNameBytes = new byte[0];
-            IptcBlock newBlock = new IptcBlock(blockType, blockNameBytes,
+            final int blockType = IMAGE_RESOURCE_BLOCK_IPTC_DATA;
+            final byte[] blockNameBytes = new byte[0];
+            final IptcBlock newBlock = new IptcBlock(blockType, blockNameBytes,
                     newBlockBytes);
             newBlocks.add(newBlock);
 
             newData = new PhotoshopApp13Data(newData.getRecords(), newBlocks);
 
-            byte segmentBytes[] = new IptcParser()
+            final byte segmentBytes[] = new IptcParser()
                     .writePhotoshopApp13Segment(newData);
-            JFIFPieceSegment newSegment = new JFIFPieceSegment(
+            final JFIFPieceSegment newSegment = new JFIFPieceSegment(
                     JPEG_APP13_Marker, segmentBytes);
 
             newPieces = insertAfterLastAppSegments(newPieces,

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java Tue Dec  4 17:23:16 2012
@@ -24,8 +24,8 @@ public class PhotoshopApp13Data implemen
     private final List<IptcRecord> records;
     private final List<IptcBlock> rawBlocks;
 
-    public PhotoshopApp13Data(List<IptcRecord> records,
-            List<IptcBlock> rawBlocks) {
+    public PhotoshopApp13Data(final List<IptcRecord> records,
+            final List<IptcBlock> rawBlocks) {
         this.rawBlocks = rawBlocks;
         this.records = records;
     }
@@ -39,9 +39,9 @@ public class PhotoshopApp13Data implemen
     }
 
     public List<IptcBlock> getNonIptcBlocks() {
-        List<IptcBlock> result = new ArrayList<IptcBlock>();
+        final List<IptcBlock> result = new ArrayList<IptcBlock>();
         for (int i = 0; i < rawBlocks.size(); i++) {
-            IptcBlock block = rawBlocks.get(i);
+            final IptcBlock block = rawBlocks.get(i);
             if (!block.isIPTCBlock()) {
                 result.add(block);
             }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App13Segment.java Tue Dec  4 17:23:16 2012
@@ -32,14 +32,14 @@ public class App13Segment extends AppnSe
     // public final List elements = new ArrayList();
     // public final boolean isIPTCJpegSegment;
 
-    public App13Segment(JpegImageParser parser, int marker, byte segmentData[])
+    public App13Segment(final JpegImageParser parser, final int marker, final byte segmentData[])
             throws IOException {
         this(parser, marker, segmentData.length, new ByteArrayInputStream(
                 segmentData));
     }
 
-    public App13Segment(JpegImageParser parser, int marker, int marker_length,
-            InputStream is) throws IOException {
+    public App13Segment(final JpegImageParser parser, final int marker, final int marker_length,
+            final InputStream is) throws IOException {
         super(marker, marker_length, is);
         this.parser = parser;
 
@@ -62,7 +62,7 @@ public class App13Segment extends AppnSe
         return new IptcParser().isPhotoshopJpegSegment(bytes);
     }
 
-    public PhotoshopApp13Data parsePhotoshopSegment(Map<String,Object> params)
+    public PhotoshopApp13Data parsePhotoshopSegment(final Map<String,Object> params)
             throws ImageReadException, IOException {
         /*
          * In practice, App13 segments are only used for Photoshop/IPTC

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java Tue Dec  4 17:23:16 2012
@@ -36,18 +36,18 @@ public class App14Segment extends AppnSe
         byte[] adobe = null;
         try {
             adobe = "Adobe".getBytes("US-ASCII");
-        } catch (UnsupportedEncodingException cannotHappen) {
+        } catch (final UnsupportedEncodingException cannotHappen) {
         }
         adobePrefix = adobe;
     }
 
-    public App14Segment(int marker, byte segmentData[])
+    public App14Segment(final int marker, final byte segmentData[])
             throws IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(
                 segmentData));
     }
     
-    public App14Segment(int marker, int marker_length, InputStream is)
+    public App14Segment(final int marker, final int marker_length, final InputStream is)
             throws IOException {
         super(marker, marker_length, is);
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java Tue Dec  4 17:23:16 2012
@@ -28,18 +28,18 @@ public class App2Segment extends AppnSeg
     public final byte icc_bytes[];
     public final int cur_marker, num_markers;
 
-    public App2Segment(int marker, byte segmentData[])
+    public App2Segment(final int marker, final byte segmentData[])
             throws ImageReadException, IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public App2Segment(int marker, int marker_length, InputStream is2)
+    public App2Segment(final int marker, int marker_length, final InputStream is2)
             throws ImageReadException, IOException {
         super(marker, marker_length, is2);
 
         if (BinaryFileParser.byteArrayHasPrefix(bytes,
                 JpegImageParser.icc_profile_label)) {
-            InputStream is = new ByteArrayInputStream(bytes);
+            final InputStream is = new ByteArrayInputStream(bytes);
 
             readAndVerifyBytes(is, JpegImageParser.icc_profile_label,
                     "Not a Valid App2 Segment: missing ICC Profile label");
@@ -61,9 +61,9 @@ public class App2Segment extends AppnSeg
     }
 
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (obj instanceof App2Segment) {
-            App2Segment other = (App2Segment) obj;
+            final App2Segment other = (App2Segment) obj;
             return cur_marker == other.cur_marker;
         }
         return false;
@@ -74,7 +74,7 @@ public class App2Segment extends AppnSeg
         return cur_marker;
     }
 
-    public int compareTo(App2Segment other) {
+    public int compareTo(final App2Segment other) {
         return cur_marker - other.cur_marker;
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java Tue Dec  4 17:23:16 2012
@@ -22,7 +22,7 @@ import java.io.InputStream;
 import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
 
 public class AppnSegment extends GenericSegment {
-    public AppnSegment(int marker, int marker_length, InputStream is)
+    public AppnSegment(final int marker, final int marker_length, final InputStream is)
             throws IOException {
         super(marker, marker_length, is);
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java Tue Dec  4 17:23:16 2012
@@ -24,11 +24,11 @@ import java.io.UnsupportedEncodingExcept
 public class ComSegment extends Segment {
     public final byte[] comment;
 
-    public ComSegment(int marker, byte segmentData[]) throws IOException {
+    public ComSegment(final int marker, final byte segmentData[]) throws IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public ComSegment(int marker, int marker_length, InputStream is)
+    public ComSegment(final int marker, final int marker_length, final InputStream is)
             throws IOException {
         super(marker, marker_length);
 
@@ -49,7 +49,7 @@ public class ComSegment extends Segment 
         String commentString = "";
         try {
             commentString = new String(comment, "UTF-8");
-        } catch (UnsupportedEncodingException cannotHappen) {
+        } catch (final UnsupportedEncodingException cannotHappen) {
         }
         return "COM (" + commentString + ")";
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java Tue Dec  4 17:23:16 2012
@@ -39,8 +39,8 @@ public class DhtSegment extends Segment 
         public final int[] maxCode = new int[1 + 16]; // 1-based
         public final int[] valPtr = new int[1 + 16]; // 1-based
 
-        public HuffmanTable(int tableClass, int destinationIdentifier,
-                int[] bits, int[] huffVal) {
+        public HuffmanTable(final int tableClass, final int destinationIdentifier,
+                final int[] bits, final int[] huffVal) {
             this.tableClass = tableClass;
             this.destinationIdentifier = destinationIdentifier;
             this.bits = bits;
@@ -113,28 +113,28 @@ public class DhtSegment extends Segment 
         }
     }
 
-    public DhtSegment(int marker, byte[] segmentData) throws IOException {
+    public DhtSegment(final int marker, final byte[] segmentData) throws IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public DhtSegment(int marker, int length, InputStream is)
+    public DhtSegment(final int marker, int length, final InputStream is)
             throws IOException {
         super(marker, length);
 
         while (length > 0) {
-            int tableClassAndDestinationId = 0xff & readByte(
+            final int tableClassAndDestinationId = 0xff & readByte(
                     "TableClassAndDestinationId", is, "Not a Valid JPEG File");
             length--;
-            int tableClass = (tableClassAndDestinationId >> 4) & 0xf;
-            int destinationIdentifier = tableClassAndDestinationId & 0xf;
-            int[] bits = new int[1 + 16];
+            final int tableClass = (tableClassAndDestinationId >> 4) & 0xf;
+            final int destinationIdentifier = tableClassAndDestinationId & 0xf;
+            final int[] bits = new int[1 + 16];
             int bitsSum = 0;
             for (int i = 1; i < bits.length; i++) {
                 bits[i] = 0xff & readByte("Li", is, "Not a Valid JPEG File");
                 length--;
                 bitsSum += bits[i];
             }
-            int[] huffVal = new int[bitsSum];
+            final int[] huffVal = new int[bitsSum];
             for (int i = 0; i < bitsSum; i++) {
                 huffVal[i] = 0xff & readByte("Vij", is, "Not a Valid JPEG File");
                 length--;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java Tue Dec  4 17:23:16 2012
@@ -31,32 +31,32 @@ public class DqtSegment extends Segment 
         public final int destinationIdentifier;
         public final int[] elements;
 
-        public QuantizationTable(int precision, int destinationIdentifier,
-                int[] elements) {
+        public QuantizationTable(final int precision, final int destinationIdentifier,
+                final int[] elements) {
             this.precision = precision;
             this.destinationIdentifier = destinationIdentifier;
             this.elements = elements;
         }
     }
 
-    public DqtSegment(int marker, byte[] segmentData)
+    public DqtSegment(final int marker, final byte[] segmentData)
             throws ImageReadException, IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public DqtSegment(int marker, int length, InputStream is)
+    public DqtSegment(final int marker, int length, final InputStream is)
             throws ImageReadException, IOException {
         super(marker, length);
 
         while (length > 0) {
-            int precisionAndDestination = readByte(
+            final int precisionAndDestination = readByte(
                     "QuantizationTablePrecisionAndDestination", is,
                     "Not a Valid JPEG File");
             length--;
-            int precision = (precisionAndDestination >> 4) & 0xf;
-            int destinationIdentifier = precisionAndDestination & 0xf;
+            final int precision = (precisionAndDestination >> 4) & 0xf;
+            final int destinationIdentifier = precisionAndDestination & 0xf;
 
-            int[] elements = new int[64];
+            final int[] elements = new int[64];
             for (int i = 0; i < 64; i++) {
                 if (precision == 0) {
                     elements[i] = 0xff & readByte("QuantizationTableElement",

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java Tue Dec  4 17:23:16 2012
@@ -23,7 +23,7 @@ import java.io.PrintWriter;
 public abstract class GenericSegment extends Segment {
     public final byte bytes[];
 
-    public GenericSegment(int marker, int marker_length, InputStream is)
+    public GenericSegment(final int marker, final int marker_length, final InputStream is)
             throws IOException {
         super(marker, marker_length);
 
@@ -31,18 +31,18 @@ public abstract class GenericSegment ext
                 "Invalid Segment: insufficient data");
     }
 
-    public GenericSegment(int marker, byte bytes[]) {
+    public GenericSegment(final int marker, final byte bytes[]) {
         super(marker, bytes.length);
 
         this.bytes = bytes;
     }
 
     @Override
-    public void dump(PrintWriter pw) {
+    public void dump(final PrintWriter pw) {
         dump(pw, 0);
     }
 
-    public void dump(PrintWriter pw, int start) {
+    public void dump(final PrintWriter pw, final int start) {
         for (int i = 0; (i < 50) && ((i + start) < bytes.length); i++) {
             debugNumber(pw, "\t" + (i + start), bytes[i + start]);
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java Tue Dec  4 17:23:16 2012
@@ -39,16 +39,16 @@ public class JfifSegment extends Segment
         return "JFIF (" + getSegmentType() + ")";
     }
 
-    public JfifSegment(int marker, byte segmentData[])
+    public JfifSegment(final int marker, final byte segmentData[])
             throws ImageReadException, IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public JfifSegment(int marker, int marker_length, InputStream is)
+    public JfifSegment(final int marker, final int marker_length, final InputStream is)
             throws ImageReadException, IOException {
         super(marker, marker_length);
 
-        byte signature[] = readBytes(is, JFIF0_SIGNATURE.size());
+        final byte signature[] = readBytes(is, JFIF0_SIGNATURE.size());
         if (!JFIF0_SIGNATURE.equals(signature)
                 && !JFIF0_SIGNATURE_ALTERNATIVE.equals(signature)) {
             throw new ImageReadException(

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/Segment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/Segment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/Segment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/Segment.java Tue Dec  4 17:23:16 2012
@@ -24,14 +24,14 @@ public abstract class Segment extends Bi
     public final int marker;
     public final int length;
 
-    public Segment(int marker, int length) {
+    public Segment(final int marker, final int length) {
         // super();
 
         this.marker = marker;
         this.length = length;
     }
 
-    public void dump(PrintWriter pw) {
+    public void dump(final PrintWriter pw) {
     }
 
     public abstract String getDescription();

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java Tue Dec  4 17:23:16 2012
@@ -35,8 +35,8 @@ public class SofnSegment extends Segment
         public final int verticalSamplingFactor;
         public final int quantTabDestSelector;
 
-        public Component(int componentIdentifier, int horizontalSamplingFactor,
-                int veritcalSamplingFactor, int quantTabDestSelector) {
+        public Component(final int componentIdentifier, final int horizontalSamplingFactor,
+                final int veritcalSamplingFactor, final int quantTabDestSelector) {
             this.componentIdentifier = componentIdentifier;
             this.horizontalSamplingFactor = horizontalSamplingFactor;
             this.verticalSamplingFactor = veritcalSamplingFactor;
@@ -44,12 +44,12 @@ public class SofnSegment extends Segment
         }
     }
 
-    public SofnSegment(int marker, byte segmentData[])
+    public SofnSegment(final int marker, final byte segmentData[])
             throws ImageReadException, IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
 
-    public SofnSegment(int marker, int marker_length, InputStream is)
+    public SofnSegment(final int marker, final int marker_length, final InputStream is)
             throws ImageReadException, IOException {
         super(marker, marker_length);
 
@@ -64,14 +64,14 @@ public class SofnSegment extends Segment
                 "Not a Valid JPEG File");
         components = new Component[numberOfComponents];
         for (int i = 0; i < numberOfComponents; i++) {
-            int componentIdentifier = readByte("ComponentIdentifier", is,
+            final int componentIdentifier = readByte("ComponentIdentifier", is,
                     "Not a Valid JPEG File");
 
-            int hvSamplingFactors = readByte("SamplingFactors", is,
+            final int hvSamplingFactors = readByte("SamplingFactors", is,
                     "Not a Valid JPEG File");
-            int horizontalSamplingFactor = (hvSamplingFactors >> 4) & 0xf;
-            int verticalSamplingFactor = hvSamplingFactors & 0xf;
-            int quantTabDestSelector = readByte("QuantTabDestSel", is,
+            final int horizontalSamplingFactor = (hvSamplingFactors >> 4) & 0xf;
+            final int verticalSamplingFactor = hvSamplingFactors & 0xf;
+            final int quantTabDestSelector = readByte("QuantTabDestSel", is,
                     "Not a Valid JPEG File");
             components[i] = new Component(componentIdentifier,
                     horizontalSamplingFactor, verticalSamplingFactor,



Mime
View raw message