commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1417043 [16/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/ ...
Date Tue, 04 Dec 2012 17:24:32 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java Tue Dec  4 17:23:16 2012
@@ -41,11 +41,11 @@ public final class TiffOutputSet impleme
     }
 
     protected List<TiffOutputItem> getOutputItems(
-            TiffOutputSummary outputSummary) throws ImageWriteException {
-        List<TiffOutputItem> result = new ArrayList<TiffOutputItem>();
+            final TiffOutputSummary outputSummary) throws ImageWriteException {
+        final List<TiffOutputItem> result = new ArrayList<TiffOutputItem>();
 
         for (int i = 0; i < directories.size(); i++) {
-            TiffOutputDirectory directory = directories.get(i);
+            final TiffOutputDirectory directory = directories.get(i);
 
             result.addAll(directory.getOutputItems(outputSummary));
         }
@@ -53,7 +53,7 @@ public final class TiffOutputSet impleme
         return result;
     }
 
-    public void addDirectory(TiffOutputDirectory directory)
+    public void addDirectory(final TiffOutputDirectory directory)
             throws ImageWriteException {
         if (null != findDirectory(directory.type)) {
             throw new ImageWriteException(
@@ -76,7 +76,7 @@ public final class TiffOutputSet impleme
 
     public TiffOutputDirectory getOrCreateRootDirectory()
             throws ImageWriteException {
-        TiffOutputDirectory result = findDirectory(DIRECTORY_TYPE_ROOT);
+        final TiffOutputDirectory result = findDirectory(DIRECTORY_TYPE_ROOT);
         if (null != result) {
             return result;
         }
@@ -88,7 +88,7 @@ public final class TiffOutputSet impleme
         // EXIF directory requires root directory.
         getOrCreateRootDirectory();
 
-        TiffOutputDirectory result = findDirectory(DIRECTORY_TYPE_EXIF);
+        final TiffOutputDirectory result = findDirectory(DIRECTORY_TYPE_EXIF);
         if (null != result) {
             return result;
         }
@@ -100,7 +100,7 @@ public final class TiffOutputSet impleme
         // GPS directory requires EXIF directory
         getOrCreateExifDirectory();
 
-        TiffOutputDirectory result = findDirectory(DIRECTORY_TYPE_GPS);
+        final TiffOutputDirectory result = findDirectory(DIRECTORY_TYPE_GPS);
         if (null != result) {
             return result;
         }
@@ -115,9 +115,9 @@ public final class TiffOutputSet impleme
         return findDirectory(DIRECTORY_TYPE_INTEROPERABILITY);
     }
 
-    public TiffOutputDirectory findDirectory(int directoryType) {
+    public TiffOutputDirectory findDirectory(final int directoryType) {
         for (int i = 0; i < directories.size(); i++) {
-            TiffOutputDirectory directory = directories.get(i);
+            final TiffOutputDirectory directory = directories.get(i);
             if (directory.type == directoryType) {
                 return directory;
             }
@@ -136,11 +136,11 @@ public final class TiffOutputSet impleme
      */
     public void setGPSInDegrees(double longitude, double latitude)
             throws ImageWriteException {
-        TiffOutputDirectory gpsDirectory = getOrCreateGPSDirectory();
+        final TiffOutputDirectory gpsDirectory = getOrCreateGPSDirectory();
 
-        String longitudeRef = longitude < 0 ? "W" : "E";
+        final String longitudeRef = longitude < 0 ? "W" : "E";
         longitude = Math.abs(longitude);
-        String latitudeRef = latitude < 0 ? "S" : "N";
+        final String latitudeRef = latitude < 0 ? "S" : "N";
         latitude = Math.abs(latitude);
 
         gpsDirectory.removeField(GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF);
@@ -153,13 +153,13 @@ public final class TiffOutputSet impleme
 
         {
             double value = longitude;
-            double longitudeDegrees = (long) value;
+            final double longitudeDegrees = (long) value;
             value %= 1;
             value *= 60.0;
-            double longitudeMinutes = (long) value;
+            final double longitudeMinutes = (long) value;
             value %= 1;
             value *= 60.0;
-            double longitudeSeconds = value;
+            final double longitudeSeconds = value;
 
             gpsDirectory.removeField(GpsTagConstants.GPS_TAG_GPS_LONGITUDE);
             gpsDirectory
@@ -174,13 +174,13 @@ public final class TiffOutputSet impleme
 
         {
             double value = latitude;
-            double latitudeDegrees = (long) value;
+            final double latitudeDegrees = (long) value;
             value %= 1;
             value *= 60.0;
-            double latitudeMinutes = (long) value;
+            final double latitudeMinutes = (long) value;
             value %= 1;
             value *= 60.0;
-            double latitudeSeconds = value;
+            final double latitudeSeconds = value;
 
             gpsDirectory.removeField(GpsTagConstants.GPS_TAG_GPS_LATITUDE);
             gpsDirectory.add(GpsTagConstants.GPS_TAG_GPS_LATITUDE,
@@ -191,25 +191,25 @@ public final class TiffOutputSet impleme
 
     }
 
-    public void removeField(TagInfo tagInfo) {
+    public void removeField(final TagInfo tagInfo) {
         removeField(tagInfo.tag);
     }
 
-    public void removeField(int tag) {
+    public void removeField(final int tag) {
         for (int i = 0; i < directories.size(); i++) {
-            TiffOutputDirectory directory = directories.get(i);
+            final TiffOutputDirectory directory = directories.get(i);
             directory.removeField(tag);
         }
     }
 
-    public TiffOutputField findField(TagInfo tagInfo) {
+    public TiffOutputField findField(final TagInfo tagInfo) {
         return findField(tagInfo.tag);
     }
 
-    public TiffOutputField findField(int tag) {
+    public TiffOutputField findField(final int tag) {
         for (int i = 0; i < directories.size(); i++) {
-            TiffOutputDirectory directory = directories.get(i);
-            TiffOutputField field = directory.findField(tag);
+            final TiffOutputDirectory directory = directories.get(i);
+            final TiffOutputField field = directory.findField(tag);
             if (null != field) {
                 return field;
             }
@@ -218,21 +218,21 @@ public final class TiffOutputSet impleme
     }
 
     public TiffOutputDirectory addRootDirectory() throws ImageWriteException {
-        TiffOutputDirectory result = new TiffOutputDirectory(
+        final TiffOutputDirectory result = new TiffOutputDirectory(
                 DIRECTORY_TYPE_ROOT, byteOrder);
         addDirectory(result);
         return result;
     }
 
     public TiffOutputDirectory addExifDirectory() throws ImageWriteException {
-        TiffOutputDirectory result = new TiffOutputDirectory(
+        final TiffOutputDirectory result = new TiffOutputDirectory(
                 DIRECTORY_TYPE_EXIF, byteOrder);
         addDirectory(result);
         return result;
     }
 
     public TiffOutputDirectory addGPSDirectory() throws ImageWriteException {
-        TiffOutputDirectory result = new TiffOutputDirectory(
+        final TiffOutputDirectory result = new TiffOutputDirectory(
                 DIRECTORY_TYPE_GPS, byteOrder);
         addDirectory(result);
         return result;
@@ -242,7 +242,7 @@ public final class TiffOutputSet impleme
             throws ImageWriteException {
         getOrCreateExifDirectory();
 
-        TiffOutputDirectory result = new TiffOutputDirectory(
+        final TiffOutputDirectory result = new TiffOutputDirectory(
                 DIRECTORY_TYPE_INTEROPERABILITY, byteOrder);
         addDirectory(result);
         return result;
@@ -260,7 +260,7 @@ public final class TiffOutputSet impleme
             prefix = "";
         }
 
-        StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder();
 
         result.append(prefix);
         result.append("TiffOutputSet {");
@@ -271,15 +271,15 @@ public final class TiffOutputSet impleme
         result.append(newline);
 
         for (int i = 0; i < directories.size(); i++) {
-            TiffOutputDirectory directory = directories.get(i);
+            final TiffOutputDirectory directory = directories.get(i);
             result.append(prefix);
             result.append("\t" + "directory " + i + ": "
                     + directory.description() + " (" + directory.type + ")");
             result.append(newline);
 
-            List<TiffOutputField> fields = directory.getFields();
+            final List<TiffOutputField> fields = directory.getFields();
             for (int j = 0; j < fields.size(); j++) {
-                TiffOutputField field = fields.get(j);
+                final TiffOutputField field = fields.get(j);
                 result.append(prefix);
                 result.append("\t\t" + "field " + i + ": " + field.tagInfo);
                 result.append(newline);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java Tue Dec  4 17:23:16 2012
@@ -56,20 +56,20 @@ class TiffOutputSummary implements TiffC
         offsetItems.add(new OffsetItem(item, itemOffsetField));
     }
 
-    public void updateOffsets(ByteOrder byteOrder) throws ImageWriteException {
+    public void updateOffsets(final ByteOrder byteOrder) throws ImageWriteException {
         for (int i = 0; i < offsetItems.size(); i++) {
-            OffsetItem offset = offsetItems.get(i);
+            final OffsetItem offset = offsetItems.get(i);
 
-            byte value[] = FIELD_TYPE_LONG.writeData(
+            final byte value[] = FIELD_TYPE_LONG.writeData(
                     new int[] { offset.item.getOffset(), }, byteOrder);
             offset.itemOffsetField.setData(value);
         }
 
         for (int i = 0; i < imageDataItems.size(); i++) {
-            ImageDataOffsets imageDataInfo = imageDataItems.get(i);
+            final ImageDataOffsets imageDataInfo = imageDataItems.get(i);
 
             for (int j = 0; j < imageDataInfo.outputItems.length; j++) {
-                TiffOutputItem item = imageDataInfo.outputItems[j];
+                final TiffOutputItem item = imageDataInfo.outputItems[j];
                 imageDataInfo.imageDataOffsets[j] = item.getOffset();
             }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java Tue Dec  4 17:23:16 2012
@@ -68,20 +68,20 @@ public class WbmpImageParser extends Ima
     }
 
     @Override
-    public boolean embedICCProfile(File src, File dst, byte profile[]) {
+    public boolean embedICCProfile(final File src, final File dst, final byte profile[]) {
         return false;
     }
 
     @Override
-    public IImageMetadata getMetadata(ByteSource byteSource, Map<String,Object> params)
+    public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public ImageInfo getImageInfo(ByteSource byteSource, Map<String,Object> params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        WbmpHeader wbmpHeader = readWbmpHeader(byteSource);
+        final WbmpHeader wbmpHeader = readWbmpHeader(byteSource);
         return new ImageInfo("WBMP", 1, new ArrayList<String>(),
                 ImageFormat.IMAGE_FORMAT_WBMP,
                 "Wireless Application Protocol Bitmap", wbmpHeader.height,
@@ -91,14 +91,14 @@ public class WbmpImageParser extends Ima
     }
 
     @Override
-    public Dimension getImageSize(ByteSource byteSource, Map<String,Object> params)
+    public Dimension getImageSize(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        WbmpHeader wbmpHeader = readWbmpHeader(byteSource);
+        final WbmpHeader wbmpHeader = readWbmpHeader(byteSource);
         return new Dimension(wbmpHeader.width, wbmpHeader.height);
     }
 
     @Override
-    public byte[] getICCProfileBytes(ByteSource byteSource, Map<String,Object> params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
@@ -109,15 +109,15 @@ public class WbmpImageParser extends Ima
         int width;
         int height;
 
-        public WbmpHeader(int typeField, byte fixHeaderField, int width,
-                int height) {
+        public WbmpHeader(final int typeField, final byte fixHeaderField, final int width,
+                final int height) {
             this.typeField = typeField;
             this.fixHeaderField = fixHeaderField;
             this.width = width;
             this.height = height;
         }
 
-        public void dump(PrintWriter pw) {
+        public void dump(final PrintWriter pw) {
             pw.println("WbmpHeader");
             pw.println("TypeField: " + typeField);
             pw.println("FixHeaderField: 0x"
@@ -127,7 +127,7 @@ public class WbmpImageParser extends Ima
         }
     }
 
-    private int readMultiByteInteger(InputStream is) throws ImageReadException,
+    private int readMultiByteInteger(final InputStream is) throws ImageReadException,
             IOException {
         int value = 0;
         int nextByte;
@@ -145,11 +145,11 @@ public class WbmpImageParser extends Ima
         return value;
     }
 
-    private void writeMultiByteInteger(OutputStream os, int value)
+    private void writeMultiByteInteger(final OutputStream os, final int value)
             throws IOException {
         boolean wroteYet = false;
         for (int position = 4 * 7; position > 0; position -= 7) {
-            int next7Bits = 0x7f & (value >>> position);
+            final int next7Bits = 0x7f & (value >>> position);
             if (next7Bits != 0 || wroteYet) {
                 os.write(0x80 | next7Bits);
                 wroteYet = true;
@@ -158,7 +158,7 @@ public class WbmpImageParser extends Ima
         os.write(0x7f & value);
     }
 
-    private WbmpHeader readWbmpHeader(ByteSource byteSource)
+    private WbmpHeader readWbmpHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
         InputStream is = null;
         try {
@@ -169,20 +169,20 @@ public class WbmpImageParser extends Ima
                 if (is != null) {
                     is.close();
                 }
-            } catch (IOException ignored) {
+            } catch (final IOException ignored) {
             }
         }
     }
 
-    private WbmpHeader readWbmpHeader(InputStream is)
+    private WbmpHeader readWbmpHeader(final InputStream is)
             throws ImageReadException, IOException {
-        int typeField = readMultiByteInteger(is);
+        final int typeField = readMultiByteInteger(is);
         if (typeField != 0) {
             throw new ImageReadException("Invalid/unsupported WBMP type "
                     + typeField);
         }
 
-        byte fixHeaderField = readByte("FixHeaderField", is,
+        final byte fixHeaderField = readByte("FixHeaderField", is,
                 "Invalid WBMP File");
         if ((fixHeaderField & 0x9f) != 0) {
             throw new ImageReadException(
@@ -190,55 +190,55 @@ public class WbmpImageParser extends Ima
                             + Integer.toHexString(0xff & fixHeaderField));
         }
 
-        int width = readMultiByteInteger(is);
+        final int width = readMultiByteInteger(is);
 
-        int height = readMultiByteInteger(is);
+        final int height = readMultiByteInteger(is);
 
         return new WbmpHeader(typeField, fixHeaderField, width, height);
     }
 
     @Override
-    public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
+    public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
             throws ImageReadException, IOException {
         readWbmpHeader(byteSource).dump(pw);
         return true;
     }
 
-    private BufferedImage readImage(WbmpHeader wbmpHeader, InputStream is)
+    private BufferedImage readImage(final WbmpHeader wbmpHeader, final InputStream is)
             throws IOException {
-        int rowLength = (wbmpHeader.width + 7) / 8;
-        byte[] image = readByteArray("Pixels", rowLength * wbmpHeader.height,
+        final int rowLength = (wbmpHeader.width + 7) / 8;
+        final byte[] image = readByteArray("Pixels", rowLength * wbmpHeader.height,
                 is, "Error reading image pixels");
-        DataBufferByte dataBuffer = new DataBufferByte(image, image.length);
-        WritableRaster raster = WritableRaster.createPackedRaster(dataBuffer,
+        final DataBufferByte dataBuffer = new DataBufferByte(image, image.length);
+        final WritableRaster raster = WritableRaster.createPackedRaster(dataBuffer,
                 wbmpHeader.width, wbmpHeader.height, 1, null);
-        int[] palette = { 0x000000, 0xffffff };
-        IndexColorModel colorModel = new IndexColorModel(1, 2, palette, 0,
+        final int[] palette = { 0x000000, 0xffffff };
+        final IndexColorModel colorModel = new IndexColorModel(1, 2, palette, 0,
                 false, -1, DataBuffer.TYPE_BYTE);
         return new BufferedImage(colorModel, raster,
                 colorModel.isAlphaPremultiplied(), new Properties());
     }
 
     @Override
-    public final BufferedImage getBufferedImage(ByteSource byteSource,
-            Map<String,Object> params) throws ImageReadException, IOException {
+    public final BufferedImage getBufferedImage(final ByteSource byteSource,
+            final Map<String,Object> params) throws ImageReadException, IOException {
         InputStream is = null;
         try {
             is = byteSource.getInputStream();
-            WbmpHeader wbmpHeader = readWbmpHeader(is);
+            final WbmpHeader wbmpHeader = readWbmpHeader(is);
             return readImage(wbmpHeader, is);
         } finally {
             try {
                 if (is != null) {
                     is.close();
                 }
-            } catch (IOException ignored) {
+            } catch (final IOException ignored) {
             }
         }
     }
 
     @Override
-    public void writeImage(BufferedImage src, OutputStream os, Map<String,Object> params)
+    public void writeImage(final BufferedImage src, final OutputStream os, Map<String,Object> params)
             throws ImageWriteException, IOException {
         // make copy of params; we'll clear keys as we consume them.
         params = (params == null) ? new HashMap<String,Object>() : new HashMap<String,Object>(params);
@@ -249,7 +249,7 @@ public class WbmpImageParser extends Ima
         }
 
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }
 
@@ -262,11 +262,11 @@ public class WbmpImageParser extends Ima
             int pixel = 0;
             int nextBit = 0x80;
             for (int x = 0; x < src.getWidth(); x++) {
-                int argb = src.getRGB(x, y);
-                int red = 0xff & (argb >> 16);
-                int green = 0xff & (argb >> 8);
-                int blue = 0xff & (argb >> 0);
-                int sample = (red + green + blue) / 3;
+                final int argb = src.getRGB(x, y);
+                final int red = 0xff & (argb >> 16);
+                final int green = 0xff & (argb >> 8);
+                final int blue = 0xff & (argb >> 0);
+                final int sample = (red + green + blue) / 3;
                 if (sample > 127) {
                     pixel |= nextBit;
                 }
@@ -294,7 +294,7 @@ public class WbmpImageParser extends Ima
      * @return Xmp Xml as String, if present. Otherwise, returns null.
      */
     @Override
-    public String getXmpXml(ByteSource byteSource, Map<String,Object> params)
+    public String getXmpXml(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java Tue Dec  4 17:23:16 2012
@@ -74,20 +74,20 @@ public class XbmImageParser extends Imag
     }
 
     @Override
-    public boolean embedICCProfile(File src, File dst, byte profile[]) {
+    public boolean embedICCProfile(final File src, final File dst, final byte profile[]) {
         return false;
     }
 
     @Override
-    public IImageMetadata getMetadata(ByteSource byteSource, Map<String,Object> params)
+    public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public ImageInfo getImageInfo(ByteSource byteSource, Map<String,Object> params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        XbmHeader xbmHeader = readXbmHeader(byteSource);
+        final XbmHeader xbmHeader = readXbmHeader(byteSource);
         return new ImageInfo("XBM", 1, new ArrayList<String>(),
                 ImageFormat.IMAGE_FORMAT_XBM, "X BitMap", xbmHeader.height,
                 "image/x-xbitmap", 1, 0, 0, 0, 0, xbmHeader.width, false,
@@ -96,14 +96,14 @@ public class XbmImageParser extends Imag
     }
 
     @Override
-    public Dimension getImageSize(ByteSource byteSource, Map<String,Object> params)
+    public Dimension getImageSize(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        XbmHeader xbmHeader = readXbmHeader(byteSource);
+        final XbmHeader xbmHeader = readXbmHeader(byteSource);
         return new Dimension(xbmHeader.width, xbmHeader.height);
     }
 
     @Override
-    public byte[] getICCProfileBytes(ByteSource byteSource, Map<String,Object> params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
@@ -114,14 +114,14 @@ public class XbmImageParser extends Imag
         int xHot = -1;
         int yHot = -1;
 
-        public XbmHeader(int width, int height, int xHot, int yHot) {
+        public XbmHeader(final int width, final int height, final int xHot, final int yHot) {
             this.width = width;
             this.height = height;
             this.xHot = xHot;
             this.yHot = yHot;
         }
 
-        public void dump(PrintWriter pw) {
+        public void dump(final PrintWriter pw) {
             pw.println("XbmHeader");
             pw.println("Width: " + width);
             pw.println("Height: " + height);
@@ -137,26 +137,26 @@ public class XbmImageParser extends Imag
         BasicCParser cParser;
     }
 
-    private XbmHeader readXbmHeader(ByteSource byteSource)
+    private XbmHeader readXbmHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
-        XbmParseResult result = parseXbmHeader(byteSource);
+        final XbmParseResult result = parseXbmHeader(byteSource);
         return result.xbmHeader;
     }
 
-    private XbmParseResult parseXbmHeader(ByteSource byteSource)
+    private XbmParseResult parseXbmHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
         InputStream is = null;
         try {
             is = byteSource.getInputStream();
-            Map<String, String> defines = new HashMap<String, String>();
-            ByteArrayOutputStream preprocessedFile = BasicCParser.preprocess(
+            final Map<String, String> defines = new HashMap<String, String>();
+            final ByteArrayOutputStream preprocessedFile = BasicCParser.preprocess(
                     is, null, defines);
             int width = -1;
             int height = -1;
             int xHot = -1;
             int yHot = -1;
-            for (Entry<String, String> entry : defines.entrySet()) {
-            String name = entry.getKey();
+            for (final Entry<String, String> entry : defines.entrySet()) {
+            final String name = entry.getKey();
             if (name.endsWith("_width")) {
             width = Integer.parseInt(entry.getValue());
             } else if (name.endsWith("_height")) {
@@ -174,7 +174,7 @@ public class XbmImageParser extends Imag
                 throw new ImageReadException("height not found");
             }
 
-            XbmParseResult xbmParseResult = new XbmParseResult();
+            final XbmParseResult xbmParseResult = new XbmParseResult();
             xbmParseResult.cParser = new BasicCParser(new ByteArrayInputStream(
                     preprocessedFile.toByteArray()));
             xbmParseResult.xbmHeader = new XbmHeader(width, height, xHot, yHot);
@@ -184,12 +184,12 @@ public class XbmImageParser extends Imag
                 if (is != null) {
                     is.close();
                 }
-            } catch (IOException ignored) {
+            } catch (final IOException ignored) {
             }
         }
     }
 
-    private BufferedImage readXbmImage(XbmHeader xbmHeader, BasicCParser cParser)
+    private BufferedImage readXbmImage(final XbmHeader xbmHeader, final BasicCParser cParser)
             throws ImageReadException, IOException {
         String token;
         token = cParser.nextToken();
@@ -210,7 +210,7 @@ public class XbmImageParser extends Imag
             throw new ImageReadException(
                     "Parsing XBM file failed, no 'char' token");
         }
-        String name = cParser.nextToken();
+        final String name = cParser.nextToken();
         if (name == null) {
             throw new ImageReadException(
                     "Parsing XBM file failed, no variable name");
@@ -221,7 +221,7 @@ public class XbmImageParser extends Imag
                             + "doesn't start with letter or underscore");
         }
         for (int i = 0; i < name.length(); i++) {
-            char c = name.charAt(i);
+            final char c = name.charAt(i);
             if (!Character.isLetterOrDigit(c) && c != '_') {
                 throw new ImageReadException(
                         "Parsing XBM file failed, variable name "
@@ -249,8 +249,8 @@ public class XbmImageParser extends Imag
                     "Parsing XBM file failed, no '{' token");
         }
 
-        int rowLength = (xbmHeader.width + 7) / 8;
-        byte[] imageData = new byte[rowLength * xbmHeader.height];
+        final int rowLength = (xbmHeader.width + 7) / 8;
+        final byte[] imageData = new byte[rowLength * xbmHeader.height];
         for (int i = 0; i < imageData.length; i++) {
             token = cParser.nextToken();
             if (token == null || !token.startsWith("0x")) {
@@ -261,7 +261,7 @@ public class XbmImageParser extends Imag
                 throw new ImageReadException("Parsing XBM file failed, "
                         + "hex value too long");
             }
-            int value = Integer.parseInt(token.substring(2), 16);
+            final int value = Integer.parseInt(token.substring(2), 16);
             int flipped = 0;
             for (int j = 0; j < 8; j++) {
                 if ((value & (1 << j)) != 0) {
@@ -282,35 +282,35 @@ public class XbmImageParser extends Imag
             }
         }
 
-        int[] palette = { 0xffffff, 0x000000 };
-        ColorModel colorModel = new IndexColorModel(1, 2, palette, 0, false,
+        final int[] palette = { 0xffffff, 0x000000 };
+        final ColorModel colorModel = new IndexColorModel(1, 2, palette, 0, false,
                 -1, DataBuffer.TYPE_BYTE);
-        DataBufferByte dataBuffer = new DataBufferByte(imageData,
+        final DataBufferByte dataBuffer = new DataBufferByte(imageData,
                 imageData.length);
-        WritableRaster raster = WritableRaster.createPackedRaster(dataBuffer,
+        final WritableRaster raster = WritableRaster.createPackedRaster(dataBuffer,
                 xbmHeader.width, xbmHeader.height, 1, null);
-        BufferedImage image = new BufferedImage(colorModel, raster,
+        final BufferedImage image = new BufferedImage(colorModel, raster,
                 colorModel.isAlphaPremultiplied(), new Properties());
         return image;
     }
 
     @Override
-    public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
+    public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
             throws ImageReadException, IOException {
         readXbmHeader(byteSource).dump(pw);
         return true;
     }
 
     @Override
-    public final BufferedImage getBufferedImage(ByteSource byteSource,
-            Map<String,Object> params) throws ImageReadException, IOException {
-        XbmParseResult result = parseXbmHeader(byteSource);
+    public final BufferedImage getBufferedImage(final ByteSource byteSource,
+            final Map<String,Object> params) throws ImageReadException, IOException {
+        final XbmParseResult result = parseXbmHeader(byteSource);
         return readXbmImage(result.xbmHeader, result.cParser);
     }
 
     private String randomName() {
-        UUID uuid = UUID.randomUUID();
-        StringBuilder stringBuilder = new StringBuilder("a");
+        final UUID uuid = UUID.randomUUID();
+        final StringBuilder stringBuilder = new StringBuilder("a");
         long bits = uuid.getMostSignificantBits();
         // Long.toHexString() breaks for very big numbers
         for (int i = 64 - 8; i >= 0; i -= 8) {
@@ -325,8 +325,8 @@ public class XbmImageParser extends Imag
         return stringBuilder.toString();
     }
 
-    private String toPrettyHex(int value) {
-        String s = Integer.toHexString(0xff & value);
+    private String toPrettyHex(final int value) {
+        final String s = Integer.toHexString(0xff & value);
         if (s.length() == 2) {
             return "0x" + s;
         }
@@ -334,7 +334,7 @@ public class XbmImageParser extends Imag
     }
 
     @Override
-    public void writeImage(BufferedImage src, OutputStream os, Map<String,Object> params)
+    public void writeImage(final BufferedImage src, final OutputStream os, Map<String,Object> params)
             throws ImageWriteException, IOException {
         // make copy of params; we'll clear keys as we consume them.
         params = (params == null) ? new HashMap<String,Object>() : new HashMap<String,Object>(params);
@@ -345,11 +345,11 @@ public class XbmImageParser extends Imag
         }
 
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }
 
-        String name = randomName();
+        final String name = randomName();
 
         os.write(("#define " + name + "_width " + src.getWidth() + "\n")
                 .getBytes("US-ASCII"));
@@ -364,10 +364,10 @@ public class XbmImageParser extends Imag
         int written = 0;
         for (int y = 0; y < src.getHeight(); y++) {
             for (int x = 0; x < src.getWidth(); x++) {
-                int argb = src.getRGB(x, y);
-                int red = 0xff & (argb >> 16);
-                int green = 0xff & (argb >> 8);
-                int blue = 0xff & (argb >> 0);
+                final int argb = src.getRGB(x, y);
+                final int red = 0xff & (argb >> 16);
+                final int green = 0xff & (argb >> 8);
+                final int blue = 0xff & (argb >> 0);
                 int sample = (red + green + blue) / 3;
                 if (sample > 127) {
                     sample = 0;
@@ -417,7 +417,7 @@ public class XbmImageParser extends Imag
      * @return Xmp Xml as String, if present. Otherwise, returns null.
      */
     @Override
-    public String getXmpXml(ByteSource byteSource, Map<String,Object> params)
+    public String getXmpXml(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java Tue Dec  4 17:23:16 2012
@@ -64,32 +64,32 @@ public class XpmImageParser extends Imag
 
         BufferedReader reader = null;
         try {
-            InputStream rgbTxtStream = XpmImageParser.class
+            final InputStream rgbTxtStream = XpmImageParser.class
                     .getResourceAsStream("rgb.txt");
             if (rgbTxtStream == null) {
                 return false;
             }
             reader = new BufferedReader(new InputStreamReader(rgbTxtStream,
                     "US-ASCII"));
-            Map<String, Integer> colors = new HashMap<String, Integer>();
+            final Map<String, Integer> colors = new HashMap<String, Integer>();
             String line;
             while ((line = reader.readLine()) != null) {
                 if (line.startsWith("!")) {
                     continue;
                 }
                 try {
-                    int red = Integer.parseInt(line.substring(0, 3).trim());
-                    int green = Integer.parseInt(line.substring(4, 7).trim());
-                    int blue = Integer.parseInt(line.substring(8, 11).trim());
-                    String colorName = line.substring(11).trim();
+                    final int red = Integer.parseInt(line.substring(0, 3).trim());
+                    final int green = Integer.parseInt(line.substring(4, 7).trim());
+                    final int blue = Integer.parseInt(line.substring(8, 11).trim());
+                    final String colorName = line.substring(11).trim();
                     colors.put(colorName, 0xff000000 | (red << 16)
                             | (green << 8) | blue);
-                } catch (NumberFormatException nfe) {
+                } catch (final NumberFormatException nfe) {
                 }
             }
             colorNames = colors;
             return true;
-        } catch (IOException ioException) {
+        } catch (final IOException ioException) {
             Debug.debug(ioException);
             return false;
         } finally {
@@ -97,7 +97,7 @@ public class XpmImageParser extends Imag
                 if (reader != null) {
                     reader.close();
                 }
-            } catch (IOException ignored) {
+            } catch (final IOException ignored) {
             }
         }
     }
@@ -127,25 +127,25 @@ public class XpmImageParser extends Imag
     }
 
     @Override
-    public boolean embedICCProfile(File src, File dst, byte profile[]) {
+    public boolean embedICCProfile(final File src, final File dst, final byte profile[]) {
         return false;
     }
 
     @Override
-    public IImageMetadata getMetadata(ByteSource byteSource, Map<String,Object> params)
+    public IImageMetadata getMetadata(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public ImageInfo getImageInfo(ByteSource byteSource, Map<String,Object> params)
+    public ImageInfo getImageInfo(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        XpmHeader xpmHeader = readXpmHeader(byteSource);
+        final XpmHeader xpmHeader = readXpmHeader(byteSource);
         boolean isTransparent = false;
         int colorType = ImageInfo.COLOR_TYPE_BW;
-        for (Entry<Object, PaletteEntry> entry : xpmHeader.palette
+        for (final Entry<Object, PaletteEntry> entry : xpmHeader.palette
                 .entrySet()) {
-         PaletteEntry paletteEntry = entry.getValue();
+         final PaletteEntry paletteEntry = entry.getValue();
          if ((paletteEntry.getBestARGB() & 0xff000000) != 0xff000000) {
         isTransparent = true;
          }
@@ -164,14 +164,14 @@ public class XpmImageParser extends Imag
     }
 
     @Override
-    public Dimension getImageSize(ByteSource byteSource, Map<String,Object> params)
+    public Dimension getImageSize(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
-        XpmHeader xpmHeader = readXpmHeader(byteSource);
+        final XpmHeader xpmHeader = readXpmHeader(byteSource);
         return new Dimension(xpmHeader.width, xpmHeader.height);
     }
 
     @Override
-    public byte[] getICCProfileBytes(ByteSource byteSource, Map<String,Object> params)
+    public byte[] getICCProfileBytes(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }
@@ -187,8 +187,8 @@ public class XpmImageParser extends Imag
 
         Map<Object, PaletteEntry> palette = new HashMap<Object, PaletteEntry>();
 
-        public XpmHeader(int width, int height, int numColors,
-                int numCharsPerPixel, int xHotSpot, int yHotSpot, boolean xpmExt) {
+        public XpmHeader(final int width, final int height, final int numColors,
+                final int numCharsPerPixel, final int xHotSpot, final int yHotSpot, final boolean xpmExt) {
             this.width = width;
             this.height = height;
             this.numColors = numColors;
@@ -198,7 +198,7 @@ public class XpmImageParser extends Imag
             this.xpmExt = xpmExt;
         }
 
-        public void dump(PrintWriter pw) {
+        public void dump(final PrintWriter pw) {
             pw.println("XpmHeader");
             pw.println("Width: " + width);
             pw.println("Height: " + height);
@@ -243,26 +243,26 @@ public class XpmImageParser extends Imag
         BasicCParser cParser;
     }
 
-    private XpmHeader readXpmHeader(ByteSource byteSource)
+    private XpmHeader readXpmHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
-        XpmParseResult result = parseXpmHeader(byteSource);
+        final XpmParseResult result = parseXpmHeader(byteSource);
         return result.xpmHeader;
     }
 
-    private XpmParseResult parseXpmHeader(ByteSource byteSource)
+    private XpmParseResult parseXpmHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
         InputStream is = null;
         try {
             is = byteSource.getInputStream();
-            StringBuilder firstComment = new StringBuilder();
-            ByteArrayOutputStream preprocessedFile = BasicCParser.preprocess(
+            final StringBuilder firstComment = new StringBuilder();
+            final ByteArrayOutputStream preprocessedFile = BasicCParser.preprocess(
                     is, firstComment, null);
             if (!firstComment.toString().trim().equals("XPM")) {
                 throw new ImageReadException("Parsing XPM file failed, "
                         + "signature isn't '/* XPM */'");
             }
 
-            XpmParseResult xpmParseResult = new XpmParseResult();
+            final XpmParseResult xpmParseResult = new XpmParseResult();
             xpmParseResult.cParser = new BasicCParser(new ByteArrayInputStream(
                     preprocessedFile.toByteArray()));
             xpmParseResult.xpmHeader = parseXpmHeader(xpmParseResult.cParser);
@@ -272,13 +272,13 @@ public class XpmImageParser extends Imag
                 if (is != null) {
                     is.close();
                 }
-            } catch (IOException ignored) {
+            } catch (final IOException ignored) {
             }
         }
     }
 
-    private boolean parseNextString(BasicCParser cParser,
-            StringBuilder stringBuilder) throws IOException, ImageReadException {
+    private boolean parseNextString(final BasicCParser cParser,
+            final StringBuilder stringBuilder) throws IOException, ImageReadException {
         stringBuilder.setLength(0);
         String token = cParser.nextToken();
         if (token.charAt(0) != '"') {
@@ -300,18 +300,18 @@ public class XpmImageParser extends Imag
         }
     }
 
-    private XpmHeader parseXpmValuesSection(String row)
+    private XpmHeader parseXpmValuesSection(final String row)
             throws ImageReadException {
-        String[] tokens = BasicCParser.tokenizeRow(row);
+        final String[] tokens = BasicCParser.tokenizeRow(row);
         if (tokens.length < 4 && tokens.length > 7) {
             throw new ImageReadException("Parsing XPM file failed, "
                     + "<Values> section has incorrect tokens");
         }
         try {
-            int width = Integer.parseInt(tokens[0]);
-            int height = Integer.parseInt(tokens[1]);
-            int numColors = Integer.parseInt(tokens[2]);
-            int numCharsPerPixel = Integer.parseInt(tokens[3]);
+            final int width = Integer.parseInt(tokens[0]);
+            final int height = Integer.parseInt(tokens[1]);
+            final int numColors = Integer.parseInt(tokens[2]);
+            final int numCharsPerPixel = Integer.parseInt(tokens[3]);
             int xHotSpot = -1;
             int yHotSpot = -1;
             boolean xpmExt = false;
@@ -329,7 +329,7 @@ public class XpmImageParser extends Imag
             }
             return new XpmHeader(width, height, numColors, numCharsPerPixel,
                     xHotSpot, yHotSpot, xpmExt);
-        } catch (NumberFormatException nfe) {
+        } catch (final NumberFormatException nfe) {
             throw new ImageReadException("Parsing XPM file failed, "
                     + "error parsing <Values> section", nfe);
         }
@@ -339,21 +339,21 @@ public class XpmImageParser extends Imag
         if (color.charAt(0) == '#') {
             color = color.substring(1);
             if (color.length() == 3) {
-                int red = Integer.parseInt(color.substring(0, 1), 16);
-                int green = Integer.parseInt(color.substring(1, 2), 16);
-                int blue = Integer.parseInt(color.substring(2, 3), 16);
+                final int red = Integer.parseInt(color.substring(0, 1), 16);
+                final int green = Integer.parseInt(color.substring(1, 2), 16);
+                final int blue = Integer.parseInt(color.substring(2, 3), 16);
                 return 0xff000000 | (red << 20) | (green << 12) | (blue << 4);
             } else if (color.length() == 6) {
                 return 0xff000000 | Integer.parseInt(color, 16);
             } else if (color.length() == 9) {
-                int red = Integer.parseInt(color.substring(0, 1), 16);
-                int green = Integer.parseInt(color.substring(3, 4), 16);
-                int blue = Integer.parseInt(color.substring(6, 7), 16);
+                final int red = Integer.parseInt(color.substring(0, 1), 16);
+                final int green = Integer.parseInt(color.substring(3, 4), 16);
+                final int blue = Integer.parseInt(color.substring(6, 7), 16);
                 return 0xff000000 | (red << 16) | (green << 8) | blue;
             } else if (color.length() == 12) {
-                int red = Integer.parseInt(color.substring(0, 1), 16);
-                int green = Integer.parseInt(color.substring(4, 5), 16);
-                int blue = Integer.parseInt(color.substring(8, 9), 16);
+                final int red = Integer.parseInt(color.substring(0, 1), 16);
+                final int green = Integer.parseInt(color.substring(4, 5), 16);
+                final int blue = Integer.parseInt(color.substring(8, 9), 16);
                 return 0xff000000 | (red << 16) | (green << 8) | blue;
             } else {
                 return 0x00000000;
@@ -375,7 +375,7 @@ public class XpmImageParser extends Imag
         }
     }
     
-    private void populatePaletteEntry(PaletteEntry paletteEntry, String key, String color) throws ImageReadException {
+    private void populatePaletteEntry(final PaletteEntry paletteEntry, final String key, final String color) throws ImageReadException {
         if (key.equals("m")) {
             paletteEntry.monoArgb = parseColor(color);
             paletteEntry.haveMono = true;
@@ -394,25 +394,25 @@ public class XpmImageParser extends Imag
         }
     }
 
-    private void parsePaletteEntries(XpmHeader xpmHeader, BasicCParser cParser)
+    private void parsePaletteEntries(final XpmHeader xpmHeader, final BasicCParser cParser)
             throws IOException, ImageReadException {
-        StringBuilder row = new StringBuilder();
+        final StringBuilder row = new StringBuilder();
         for (int i = 0; i < xpmHeader.numColors; i++) {
             row.setLength(0);
-            boolean hasMore = parseNextString(cParser, row);
+            final boolean hasMore = parseNextString(cParser, row);
             if (!hasMore) {
                 throw new ImageReadException("Parsing XPM file failed, "
                         + "file ended while reading palette");
             }
-            String name = row.substring(0, xpmHeader.numCharsPerPixel);
-            String[] tokens = BasicCParser.tokenizeRow(
+            final String name = row.substring(0, xpmHeader.numCharsPerPixel);
+            final String[] tokens = BasicCParser.tokenizeRow(
                     row.substring(xpmHeader.numCharsPerPixel));
-            PaletteEntry paletteEntry = new PaletteEntry();
+            final PaletteEntry paletteEntry = new PaletteEntry();
             paletteEntry.index = i;
             int previousKeyIndex = Integer.MIN_VALUE;
-            StringBuilder colorBuffer = new StringBuilder();
+            final StringBuilder colorBuffer = new StringBuilder();
             for (int j = 0; j < tokens.length; j++) {
-                String token = tokens[j];
+                final String token = tokens[j];
                 boolean isKey = false;
                 if (previousKeyIndex < (j - 1) && 
                     token.equals("m") || token.equals("g4") ||
@@ -422,8 +422,8 @@ public class XpmImageParser extends Imag
                 }
                 if (isKey) {
                     if (previousKeyIndex >= 0) {
-                        String key = tokens[previousKeyIndex];
-                        String color = colorBuffer.toString();
+                        final String key = tokens[previousKeyIndex];
+                        final String color = colorBuffer.toString();
                         colorBuffer.setLength(0);
                         populatePaletteEntry(paletteEntry, key, color);
                     }
@@ -439,8 +439,8 @@ public class XpmImageParser extends Imag
                 }
             }
             if (previousKeyIndex >= 0 && colorBuffer.length() > 0) {
-                String key = tokens[previousKeyIndex];
-                String color = colorBuffer.toString();
+                final String key = tokens[previousKeyIndex];
+                final String color = colorBuffer.toString();
                 colorBuffer.setLength(0);
                 populatePaletteEntry(paletteEntry, key, color);
             }
@@ -448,7 +448,7 @@ public class XpmImageParser extends Imag
         }
     }
 
-    private XpmHeader parseXpmHeader(BasicCParser cParser)
+    private XpmHeader parseXpmHeader(final BasicCParser cParser)
             throws ImageReadException, IOException {
         String name;
         String token;
@@ -478,7 +478,7 @@ public class XpmImageParser extends Imag
                             + "doesn't start with letter or underscore");
         }
         for (int i = 0; i < name.length(); i++) {
-            char c = name.charAt(i);
+            final char c = name.charAt(i);
             if (!Character.isLetterOrDigit(c) && c != '_') {
                 throw new ImageReadException(
                         "Parsing XPM file failed, variable name "
@@ -506,27 +506,27 @@ public class XpmImageParser extends Imag
                     "Parsing XPM file failed, no '{' token");
         }
 
-        StringBuilder row = new StringBuilder();
-        boolean hasMore = parseNextString(cParser, row);
+        final StringBuilder row = new StringBuilder();
+        final boolean hasMore = parseNextString(cParser, row);
         if (!hasMore) {
             throw new ImageReadException("Parsing XPM file failed, "
                     + "file too short");
         }
-        XpmHeader xpmHeader = parseXpmValuesSection(row.toString());
+        final XpmHeader xpmHeader = parseXpmValuesSection(row.toString());
         parsePaletteEntries(xpmHeader, cParser);
         return xpmHeader;
     }
 
-    private BufferedImage readXpmImage(XpmHeader xpmHeader, BasicCParser cParser)
+    private BufferedImage readXpmImage(final XpmHeader xpmHeader, final BasicCParser cParser)
             throws ImageReadException, IOException {
         ColorModel colorModel;
         WritableRaster raster;
         int bpp;
         if (xpmHeader.palette.size() <= (1 << 8)) {
-            int[] palette = new int[xpmHeader.palette.size()];
-            for (Entry<Object, PaletteEntry> entry : xpmHeader.palette
+            final int[] palette = new int[xpmHeader.palette.size()];
+            for (final Entry<Object, PaletteEntry> entry : xpmHeader.palette
                     .entrySet()) {
-            PaletteEntry paletteEntry = entry.getValue();
+            final PaletteEntry paletteEntry = entry.getValue();
             palette[paletteEntry.index] = paletteEntry.getBestARGB();
          }
             colorModel = new IndexColorModel(8, xpmHeader.palette.size(),
@@ -536,10 +536,10 @@ public class XpmImageParser extends Imag
                     null);
             bpp = 8;
         } else if (xpmHeader.palette.size() <= (1 << 16)) {
-            int[] palette = new int[xpmHeader.palette.size()];
-            for (Entry<Object, PaletteEntry> entry : xpmHeader.palette
+            final int[] palette = new int[xpmHeader.palette.size()];
+            for (final Entry<Object, PaletteEntry> entry : xpmHeader.palette
                     .entrySet()) {
-            PaletteEntry paletteEntry = entry.getValue();
+            final PaletteEntry paletteEntry = entry.getValue();
             palette[paletteEntry.index] = paletteEntry.getBestARGB();
          }
             colorModel = new IndexColorModel(16, xpmHeader.palette.size(),
@@ -557,10 +557,10 @@ public class XpmImageParser extends Imag
             bpp = 32;
         }
 
-        BufferedImage image = new BufferedImage(colorModel, raster,
+        final BufferedImage image = new BufferedImage(colorModel, raster,
                 colorModel.isAlphaPremultiplied(), new Properties());
-        DataBuffer dataBuffer = raster.getDataBuffer();
-        StringBuilder row = new StringBuilder();
+        final DataBuffer dataBuffer = raster.getDataBuffer();
+        final StringBuilder row = new StringBuilder();
         boolean hasMore = true;
         for (int y = 0; y < xpmHeader.height; y++) {
             row.setLength(0);
@@ -569,11 +569,11 @@ public class XpmImageParser extends Imag
                 throw new ImageReadException("Parsing XPM file failed, "
                         + "insufficient image rows in file");
             }
-            int rowOffset = y * xpmHeader.width;
+            final int rowOffset = y * xpmHeader.width;
             for (int x = 0; x < xpmHeader.width; x++) {
-                String index = row.substring(x * xpmHeader.numCharsPerPixel,
+                final String index = row.substring(x * xpmHeader.numCharsPerPixel,
                         (x + 1) * xpmHeader.numCharsPerPixel);
-                PaletteEntry paletteEntry = xpmHeader.palette.get(index);
+                final PaletteEntry paletteEntry = xpmHeader.palette.get(index);
                 if (paletteEntry == null) {
                     throw new ImageReadException(
                             "No palette entry was defined " + "for " + index);
@@ -592,7 +592,7 @@ public class XpmImageParser extends Imag
             hasMore = parseNextString(cParser, row);
         }
 
-        String token = cParser.nextToken();
+        final String token = cParser.nextToken();
         if (!token.equals(";")) {
             throw new ImageReadException("Last token wasn't ';'");
         }
@@ -601,22 +601,22 @@ public class XpmImageParser extends Imag
     }
 
     @Override
-    public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
+    public boolean dumpImageFile(final PrintWriter pw, final ByteSource byteSource)
             throws ImageReadException, IOException {
         readXpmHeader(byteSource).dump(pw);
         return true;
     }
 
     @Override
-    public final BufferedImage getBufferedImage(ByteSource byteSource,
-            Map<String,Object> params) throws ImageReadException, IOException {
-        XpmParseResult result = parseXpmHeader(byteSource);
+    public final BufferedImage getBufferedImage(final ByteSource byteSource,
+            final Map<String,Object> params) throws ImageReadException, IOException {
+        final XpmParseResult result = parseXpmHeader(byteSource);
         return readXpmImage(result.xpmHeader, result.cParser);
     }
 
     private String randomName() {
-        UUID uuid = UUID.randomUUID();
-        StringBuilder stringBuilder = new StringBuilder("a");
+        final UUID uuid = UUID.randomUUID();
+        final StringBuilder stringBuilder = new StringBuilder("a");
         long bits = uuid.getMostSignificantBits();
         // Long.toHexString() breaks for very big numbers
         for (int i = 64 - 8; i >= 0; i -= 8) {
@@ -629,14 +629,14 @@ public class XpmImageParser extends Imag
         return stringBuilder.toString();
     }
 
-    private String pixelsForIndex(int index, int charsPerPixel) {
-        StringBuilder stringBuilder = new StringBuilder();
+    private String pixelsForIndex(int index, final int charsPerPixel) {
+        final StringBuilder stringBuilder = new StringBuilder();
         int highestPower = 1;
         for (int i = 1; i < charsPerPixel; i++) {
             highestPower *= writePalette.length;
         }
         for (int i = 0; i < charsPerPixel; i++) {
-            int multiple = index / highestPower;
+            final int multiple = index / highestPower;
             index -= (multiple * highestPower);
             highestPower /= writePalette.length;
             stringBuilder.append(writePalette[multiple]);
@@ -644,10 +644,10 @@ public class XpmImageParser extends Imag
         return stringBuilder.toString();
     }
 
-    private String toColor(int color) {
-        String hex = Integer.toHexString(color);
+    private String toColor(final int color) {
+        final String hex = Integer.toHexString(color);
         if (hex.length() < 6) {
-            char zeroes[] = new char[6 - hex.length()];
+            final char zeroes[] = new char[6 - hex.length()];
             Arrays.fill(zeroes, '0');
             return "#" + new String(zeroes) + hex;
         } else {
@@ -656,7 +656,7 @@ public class XpmImageParser extends Imag
     }
 
     @Override
-    public void writeImage(BufferedImage src, OutputStream os, Map<String,Object> params)
+    public void writeImage(final BufferedImage src, final OutputStream os, Map<String,Object> params)
             throws ImageWriteException, IOException {
         // make copy of params; we'll clear keys as we consume them.
         params = (params == null) ? new HashMap<String,Object>() : new HashMap<String,Object>(params);
@@ -667,11 +667,11 @@ public class XpmImageParser extends Imag
         }
 
         if (params.size() > 0) {
-            Object firstKey = params.keySet().iterator().next();
+            final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }
 
-        PaletteFactory paletteFactory = new PaletteFactory();
+        final PaletteFactory paletteFactory = new PaletteFactory();
         boolean hasTransparency = false;
         if (paletteFactory.hasTransparency(src, 1)) {
             hasTransparency = true;
@@ -719,7 +719,7 @@ public class XpmImageParser extends Imag
             line = "\"";
             os.write(line.getBytes("US-ASCII"));
             for (int x = 0; x < src.getWidth(); x++) {
-                int argb = src.getRGB(x, y);
+                final int argb = src.getRGB(x, y);
                 if ((argb & 0xff000000) == 0) {
                     line = pixelsForIndex(palette.length(), charsPerPixel);
                 } else {
@@ -757,7 +757,7 @@ public class XpmImageParser extends Imag
      * @return Xmp Xml as String, if present. Otherwise, returns null.
      */
     @Override
-    public String getXmpXml(ByteSource byteSource, Map<String,Object> params)
+    public String getXmpXml(final ByteSource byteSource, final Map<String,Object> params)
             throws ImageReadException, IOException {
         return null;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java Tue Dec  4 17:23:16 2012
@@ -41,13 +41,13 @@ public class IccProfileInfo implements I
     public final byte ProfileID[];
     public final IccTag tags[];
 
-    public IccProfileInfo(byte data[], int ProfileSize, int CMMTypeSignature,
-            int ProfileVersion, int ProfileDeviceClassSignature,
-            int ColorSpace, int ProfileConnectionSpace,
-            int ProfileFileSignature, int PrimaryPlatformSignature,
-            int VariousFlags, int DeviceManufacturer, int DeviceModel,
-            int RenderingIntent, int ProfileCreatorSignature, byte ProfileID[],
-            IccTag tags[]) {
+    public IccProfileInfo(final byte data[], final int ProfileSize, final int CMMTypeSignature,
+            final int ProfileVersion, final int ProfileDeviceClassSignature,
+            final int ColorSpace, final int ProfileConnectionSpace,
+            final int ProfileFileSignature, final int PrimaryPlatformSignature,
+            final int VariousFlags, final int DeviceManufacturer, final int DeviceModel,
+            final int RenderingIntent, final int ProfileCreatorSignature, final byte ProfileID[],
+            final IccTag tags[]) {
         this.data = data;
 
         this.ProfileSize = ProfileSize;
@@ -69,17 +69,17 @@ public class IccProfileInfo implements I
     }
 
     public boolean issRGB() {
-        boolean result = ((DeviceManufacturer == IEC) && (DeviceModel == sRGB));
+        final boolean result = ((DeviceManufacturer == IEC) && (DeviceModel == sRGB));
         return result;
     }
 
-    private void printCharQuad(PrintWriter pw, String msg, int i) {
+    private void printCharQuad(final PrintWriter pw, final String msg, final int i) {
         pw.println(msg + ": '" + (char) (0xff & (i >> 24))
                 + (char) (0xff & (i >> 16)) + (char) (0xff & (i >> 8))
                 + (char) (0xff & (i >> 0)) + "'");
     }
 
-    public void dump(String prefix) {
+    public void dump(final String prefix) {
         System.out.print(toString());
     }
 
@@ -87,15 +87,15 @@ public class IccProfileInfo implements I
     public String toString() {
         try {
             return toString("");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             return "IccProfileInfo: Error";
         }
     }
 
-    public String toString(String prefix) throws ImageReadException,
+    public String toString(final String prefix) throws ImageReadException,
             IOException {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
+        final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
 
         // StringBuffer result = new StringBuffer();
         pw.println(prefix + ": " + "data length: " + data.length);
@@ -131,7 +131,7 @@ public class IccProfileInfo implements I
                 ProfileCreatorSignature);
 
         for (int i = 0; i < tags.length; i++) {
-            IccTag tag = tags[i];
+            final IccTag tag = tags[i];
             tag.dump(pw, "\t" + i + ": ");
         }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java Tue Dec  4 17:23:16 2012
@@ -34,7 +34,7 @@ public class IccProfileParser extends Bi
         this.setByteOrder(ByteOrder.BIG_ENDIAN);
     }
 
-    public IccProfileInfo getICCProfileInfo(ICC_Profile icc_profile) {
+    public IccProfileInfo getICCProfileInfo(final ICC_Profile icc_profile) {
         if (icc_profile == null) {
             return null;
         }
@@ -42,7 +42,7 @@ public class IccProfileParser extends Bi
         return getICCProfileInfo(new ByteSourceArray(icc_profile.getData()));
     }
 
-    public IccProfileInfo getICCProfileInfo(byte bytes[]) {
+    public IccProfileInfo getICCProfileInfo(final byte bytes[]) {
         if (bytes == null) {
             return null;
         }
@@ -50,7 +50,7 @@ public class IccProfileParser extends Bi
         return getICCProfileInfo(new ByteSourceArray(bytes));
     }
 
-    public IccProfileInfo getICCProfileInfo(File file) {
+    public IccProfileInfo getICCProfileInfo(final File file) {
         if (file == null) {
             return null;
         }
@@ -58,7 +58,7 @@ public class IccProfileParser extends Bi
         return getICCProfileInfo(new ByteSourceFile(file));
     }
 
-    public IccProfileInfo getICCProfileInfo(ByteSource byteSource) {
+    public IccProfileInfo getICCProfileInfo(final ByteSource byteSource) {
 
         InputStream is = null;
 
@@ -76,8 +76,8 @@ public class IccProfileParser extends Bi
             is.close();
             is = null;
 
-            for (IccTag tag : result.tags) {
-                byte bytes[] = byteSource.getBlock(tag.offset, tag.length);
+            for (final IccTag tag : result.tags) {
+                final byte bytes[] = byteSource.getBlock(tag.offset, tag.length);
                 // Debug.debug("bytes: " + bytes.length);
                 tag.setData(bytes);
                 // tag.dump("\t" + i + ": ");
@@ -85,7 +85,7 @@ public class IccProfileParser extends Bi
             // result.fillInTagData(byteSource);
 
             return result;
-        } catch (Exception e) {
+        } catch (final Exception e) {
             // Debug.debug("Error: " + file.getAbsolutePath());
             Debug.debug(e);
         } finally {
@@ -93,7 +93,7 @@ public class IccProfileParser extends Bi
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 Debug.debug(e);
             }
 
@@ -107,7 +107,7 @@ public class IccProfileParser extends Bi
     }
 
     private IccProfileInfo readICCProfileInfo(InputStream is) {
-        CachingInputStream cis = new CachingInputStream(is);
+        final CachingInputStream cis = new CachingInputStream(is);
         is = cis;
 
         if (debug) {
@@ -120,7 +120,7 @@ public class IccProfileParser extends Bi
         // Debug.debug("length: " + length);
 
         try {
-            int ProfileSize = read4Bytes("ProfileSize", is,
+            final int ProfileSize = read4Bytes("ProfileSize", is,
                     "Not a Valid ICC Profile");
 
             // if (length != ProfileSize)
@@ -134,16 +134,16 @@ public class IccProfileParser extends Bi
             // return null;
             // }
 
-            int CMMTypeSignature = read4Bytes("Signature", is,
+            final int CMMTypeSignature = read4Bytes("Signature", is,
                     "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("CMMTypeSignature", CMMTypeSignature);
             }
 
-            int ProfileVersion = read4Bytes("ProfileVersion", is,
+            final int ProfileVersion = read4Bytes("ProfileVersion", is,
                     "Not a Valid ICC Profile");
 
-            int ProfileDeviceClassSignature = read4Bytes(
+            final int ProfileDeviceClassSignature = read4Bytes(
                     "ProfileDeviceClassSignature", is,
                     "Not a Valid ICC Profile");
             if (debug) {
@@ -151,13 +151,13 @@ public class IccProfileParser extends Bi
                         ProfileDeviceClassSignature);
             }
 
-            int ColorSpace = read4Bytes("ColorSpace", is,
+            final int ColorSpace = read4Bytes("ColorSpace", is,
                     "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("ColorSpace", ColorSpace);
             }
 
-            int ProfileConnectionSpace = read4Bytes("ProfileConnectionSpace",
+            final int ProfileConnectionSpace = read4Bytes("ProfileConnectionSpace",
                     is, "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("ProfileConnectionSpace", ProfileConnectionSpace);
@@ -165,32 +165,32 @@ public class IccProfileParser extends Bi
 
             skipBytes(is, 12, "Not a Valid ICC Profile");
 
-            int ProfileFileSignature = read4Bytes("ProfileFileSignature", is,
+            final int ProfileFileSignature = read4Bytes("ProfileFileSignature", is,
                     "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("ProfileFileSignature", ProfileFileSignature);
             }
 
-            int PrimaryPlatformSignature = read4Bytes(
+            final int PrimaryPlatformSignature = read4Bytes(
                     "PrimaryPlatformSignature", is, "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("PrimaryPlatformSignature",
                         PrimaryPlatformSignature);
             }
 
-            int VariousFlags = read4Bytes("ProfileFileSignature", is,
+            final int VariousFlags = read4Bytes("ProfileFileSignature", is,
                     "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("ProfileFileSignature", ProfileFileSignature);
             }
 
-            int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
+            final int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
                     "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("DeviceManufacturer", DeviceManufacturer);
             }
 
-            int DeviceModel = read4Bytes("DeviceModel", is,
+            final int DeviceModel = read4Bytes("DeviceModel", is,
                     "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("DeviceModel", DeviceModel);
@@ -198,7 +198,7 @@ public class IccProfileParser extends Bi
 
             skipBytes(is, 8, "Not a Valid ICC Profile");
 
-            int RenderingIntent = read4Bytes("RenderingIntent", is,
+            final int RenderingIntent = read4Bytes("RenderingIntent", is,
                     "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("RenderingIntent", RenderingIntent);
@@ -206,14 +206,14 @@ public class IccProfileParser extends Bi
 
             skipBytes(is, 12, "Not a Valid ICC Profile");
 
-            int ProfileCreatorSignature = read4Bytes("ProfileCreatorSignature",
+            final int ProfileCreatorSignature = read4Bytes("ProfileCreatorSignature",
                     is, "Not a Valid ICC Profile");
             if (debug) {
                 printCharQuad("ProfileCreatorSignature",
                         ProfileCreatorSignature);
             }
 
-            byte ProfileID[] = null;
+            final byte ProfileID[] = null;
             skipBytes(is, 16, "Not a Valid ICC Profile");
             // readByteArray("ProfileID", 16, is,
             // "Not a Valid ICC Profile");
@@ -225,24 +225,24 @@ public class IccProfileParser extends Bi
 
             // this.setDebug(true);
 
-            int TagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");
+            final int TagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");
 
             // List tags = new ArrayList();
-            IccTag tags[] = new IccTag[TagCount];
+            final IccTag tags[] = new IccTag[TagCount];
 
             for (int i = 0; i < TagCount; i++) {
-                int TagSignature = read4Bytes("TagSignature[" + i + "]", is,
+                final int TagSignature = read4Bytes("TagSignature[" + i + "]", is,
                         "Not a Valid ICC Profile");
                 // Debug.debug("TagSignature t "
                 // + Integer.toHexString(TagSignature));
 
                 // this.printCharQuad("TagSignature", TagSignature);
-                int OffsetToData = read4Bytes("OffsetToData[" + i + "]", is,
+                final int OffsetToData = read4Bytes("OffsetToData[" + i + "]", is,
                         "Not a Valid ICC Profile");
-                int ElementSize = read4Bytes("ElementSize[" + i + "]", is,
+                final int ElementSize = read4Bytes("ElementSize[" + i + "]", is,
                         "Not a Valid ICC Profile");
 
-                IccTagType fIccTagType = getIccTagType(TagSignature);
+                final IccTagType fIccTagType = getIccTagType(TagSignature);
                 // if (fIccTagType == null)
                 // throw new Error("oops.");
 
@@ -255,7 +255,7 @@ public class IccProfileParser extends Bi
                 // : fIccTagType.name));
                 // Debug.debug();
 
-                IccTag tag = new IccTag(TagSignature, OffsetToData,
+                final IccTag tag = new IccTag(TagSignature, OffsetToData,
                         ElementSize, fIccTagType);
                 // tag.dump("\t" + i + ": ");
                 tags[i] = tag;
@@ -268,13 +268,13 @@ public class IccProfileParser extends Bi
                 }
             }
 
-            byte data[] = cis.getCache();
+            final byte data[] = cis.getCache();
 
             if (data.length < ProfileSize) {
                 throw new IOException("Couldn't read ICC Profile.");
             }
 
-            IccProfileInfo result = new IccProfileInfo(data, ProfileSize,
+            final IccProfileInfo result = new IccProfileInfo(data, ProfileSize,
                     CMMTypeSignature, ProfileVersion,
                     ProfileDeviceClassSignature, ColorSpace,
                     ProfileConnectionSpace, ProfileFileSignature,
@@ -287,15 +287,15 @@ public class IccProfileParser extends Bi
             }
 
             return result;
-        } catch (Exception e) {
+        } catch (final Exception e) {
             Debug.debug(e);
         }
 
         return null;
     }
 
-    private IccTagType getIccTagType(int quad) {
-        for (IccTagType iccTagType : IccTagTypes.values()) {
+    private IccTagType getIccTagType(final int quad) {
+        for (final IccTagType iccTagType : IccTagTypes.values()) {
             if (iccTagType.getSignature() == quad) {
                 return iccTagType;
             }
@@ -304,7 +304,7 @@ public class IccProfileParser extends Bi
         return null;
     }
 
-    public Boolean issRGB(ICC_Profile icc_profile) {
+    public Boolean issRGB(final ICC_Profile icc_profile) {
         if (icc_profile == null) {
             return null;
         }
@@ -312,7 +312,7 @@ public class IccProfileParser extends Bi
         return issRGB(new ByteSourceArray(icc_profile.getData()));
     }
 
-    public Boolean issRGB(byte bytes[]) {
+    public Boolean issRGB(final byte bytes[]) {
         if (bytes == null) {
             return null;
         }
@@ -320,7 +320,7 @@ public class IccProfileParser extends Bi
         return issRGB(new ByteSourceArray(bytes));
     }
 
-    public Boolean issRGB(File file) {
+    public Boolean issRGB(final File file) {
         if (file == null) {
             return null;
         }
@@ -328,7 +328,7 @@ public class IccProfileParser extends Bi
         return issRGB(new ByteSourceFile(file));
     }
 
-    public Boolean issRGB(ByteSource byteSource) {
+    public Boolean issRGB(final ByteSource byteSource) {
         try {
             if (debug) {
                 Debug.debug();
@@ -356,30 +356,30 @@ public class IccProfileParser extends Bi
 
                 this.skipBytes(is, 4 * 3);
 
-                int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
+                final int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
                         "Not a Valid ICC Profile");
                 if (debug) {
                     printCharQuad("DeviceManufacturer", DeviceManufacturer);
                 }
 
-                int DeviceModel = read4Bytes("DeviceModel", is,
+                final int DeviceModel = read4Bytes("DeviceModel", is,
                         "Not a Valid ICC Profile");
                 if (debug) {
                     printCharQuad("DeviceModel", DeviceModel);
                 }
 
-                boolean result = ((DeviceManufacturer == IEC) && (DeviceModel == sRGB));
+                final boolean result = ((DeviceManufacturer == IEC) && (DeviceModel == sRGB));
 
                 return result;
             } finally {
                 if (is != null) {
                     try {
                         is.close();
-                    } catch (IOException ignore) {
+                    } catch (final IOException ignore) {
                     }
                 }
             }
-        } catch (Exception e) {
+        } catch (final Exception e) {
             Debug.debug(e);
         }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java Tue Dec  4 17:23:16 2012
@@ -34,7 +34,7 @@ public class IccTag implements IccConsta
 
     // public final byte data[];
 
-    public IccTag(int signature, int offset, int length, IccTagType fIccTagType) {
+    public IccTag(final int signature, final int offset, final int length, final IccTagType fIccTagType) {
         this.signature = signature;
         this.offset = offset;
         this.length = length;
@@ -45,7 +45,7 @@ public class IccTag implements IccConsta
     private IccTagDataType itdt = null;
     private int data_type_signature;
 
-    public void setData(byte bytes[]) throws IOException {
+    public void setData(final byte bytes[]) throws IOException {
         data = bytes;
 
         BinaryInputStream bis = null;
@@ -65,13 +65,13 @@ public class IccTag implements IccConsta
                 if (bis != null) {
                     bis.close();
                 }
-            } catch (IOException cannotHappen) {
+            } catch (final IOException cannotHappen) {
             }
         }
     }
 
-    private IccTagDataType getIccTagDataType(int quad) {
-        for (IccTagDataType iccTagDataType : IccTagDataTypes.values()) {
+    private IccTagDataType getIccTagDataType(final int quad) {
+        for (final IccTagDataType iccTagDataType : IccTagDataTypes.values()) {
             if (iccTagDataType.getSignature() == quad) {
                 return iccTagDataType;
             }
@@ -80,15 +80,15 @@ public class IccTag implements IccConsta
         return null;
     }
 
-    public void dump(String prefix) throws ImageReadException, IOException {
-        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
+    public void dump(final String prefix) throws ImageReadException, IOException {
+        final PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
 
         dump(pw, prefix);
 
         pw.flush();
     }
 
-    public void dump(PrintWriter pw, String prefix) throws ImageReadException,
+    public void dump(final PrintWriter pw, final String prefix) throws ImageReadException,
             IOException {
         pw.println(prefix
                 + "tag signature: "

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java Tue Dec  4 17:23:16 2012
@@ -26,21 +26,21 @@ import org.apache.commons.imaging.common
 public enum IccTagDataTypes implements IccTagDataType {
     DESC_TYPE(
             "descType", 0x64657363) {
-        public void dump(String prefix, byte bytes[])
+        public void dump(final String prefix, final byte bytes[])
                 throws ImageReadException, IOException
         {
-            BinaryInputStream bis = new BinaryInputStream(
+            final BinaryInputStream bis = new BinaryInputStream(
                     new ByteArrayInputStream(bytes),
                     ByteOrder.NETWORK);
             bis.read4Bytes("type_signature", "ICC: corrupt tag data");
 
             //            bis.setDebug(true);
             bis.read4Bytes("ignore", "ICC: corrupt tag data");
-            int string_length = bis.read4Bytes("string_length",
+            final int string_length = bis.read4Bytes("string_length",
                     "ICC: corrupt tag data");
 
             //            bis.readByteArray("ignore", bytes.length -12, "none");
-            String s = new String(bytes, 12, string_length - 1, "US-ASCII");
+            final String s = new String(bytes, 12, string_length - 1, "US-ASCII");
             System.out.println(prefix + "s: '" + s + "'");
         }
 
@@ -48,10 +48,10 @@ public enum IccTagDataTypes implements I
 
     DATA_TYPE(
             "dataType", 0x64617461) {
-        public void dump(String prefix, byte bytes[])
+        public void dump(final String prefix, final byte bytes[])
                 throws ImageReadException, IOException
         {
-            BinaryInputStream bis = new BinaryInputStream(
+            final BinaryInputStream bis = new BinaryInputStream(
                     new ByteArrayInputStream(bytes),
                     ByteOrder.NETWORK);
             bis.read4Bytes("type_signature", "ICC: corrupt tag data");
@@ -61,10 +61,10 @@ public enum IccTagDataTypes implements I
 
     MULTI_LOCALIZED_UNICODE_TYPE(
             "multiLocalizedUnicodeType", (0x6D6C7563)) {
-        public void dump(String prefix, byte bytes[])
+        public void dump(final String prefix, final byte bytes[])
                 throws ImageReadException, IOException
         {
-            BinaryInputStream bis = new BinaryInputStream(
+            final BinaryInputStream bis = new BinaryInputStream(
                     new ByteArrayInputStream(bytes),
                     ByteOrder.NETWORK);
             bis.read4Bytes("type_signature", "ICC: corrupt tag data");
@@ -74,15 +74,15 @@ public enum IccTagDataTypes implements I
 
     SIGNATURE_TYPE(
             "signatureType", ((0x73696720))) {
-        public void dump(String prefix, byte bytes[])
+        public void dump(final String prefix, final byte bytes[])
                 throws ImageReadException, IOException
         {
-            BinaryInputStream bis = new BinaryInputStream(
+            final BinaryInputStream bis = new BinaryInputStream(
                     new ByteArrayInputStream(bytes),
                     ByteOrder.NETWORK);
             bis.read4Bytes("type_signature", "ICC: corrupt tag data");
             bis.read4Bytes("ignore", "ICC: corrupt tag data");
-            int thesignature = bis.read4Bytes("thesignature ",
+            final int thesignature = bis.read4Bytes("thesignature ",
                     "ICC: corrupt tag data");
             System.out.println(prefix
                     + "thesignature: "
@@ -100,15 +100,15 @@ public enum IccTagDataTypes implements I
 
     TEXT_TYPE(
             "textType", 0x74657874) {
-        public void dump(String prefix, byte bytes[])
+        public void dump(final String prefix, final byte bytes[])
                 throws ImageReadException, IOException
         {
-            BinaryInputStream bis = new BinaryInputStream(
+            final BinaryInputStream bis = new BinaryInputStream(
                     new ByteArrayInputStream(bytes),
                     ByteOrder.NETWORK);
             bis.read4Bytes("type_signature", "ICC: corrupt tag data");
             bis.read4Bytes("ignore", "ICC: corrupt tag data");
-            String s = new String(bytes, 8, bytes.length - 8, "US-ASCII");
+            final String s = new String(bytes, 8, bytes.length - 8, "US-ASCII");
             System.out.println(prefix + "s: '" + s + "'");
         }
 
@@ -117,7 +117,7 @@ public enum IccTagDataTypes implements I
     public final String name;
     public final int signature;
 
-    IccTagDataTypes(String name, int signature) {
+    IccTagDataTypes(final String name, final int signature) {
         this.name = name;
         this.signature = signature;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java Tue Dec  4 17:23:16 2012
@@ -318,7 +318,7 @@ public enum IccTagTypes implements IccTa
     public final String type_description;
     public final int signature;
 
-    IccTagTypes(String name, String type_description, int signature) {
+    IccTagTypes(final String name, final String type_description, final int signature) {
         this.name = name;
         this.type_description = type_description;
         this.signature = signature;



Mime
View raw message