You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2017/05/24 18:40:49 UTC

[01/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Repository: commons-imaging
Updated Branches:
  refs/heads/master [created] f46d642f1


Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775870 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/7f3d659c
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/7f3d659c
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/7f3d659c

Branch: refs/heads/master
Commit: 7f3d659c11c158808fb38a1425c15b6fbc2270a9
Parents: 98b3558
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:14:25 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:14:25 2016 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/pnm/PnmImageParser.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/7f3d659c/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
index 101d47b..3ae6b0b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
@@ -207,8 +207,7 @@ public class PnmImageParser extends ImageParser {
     private FileInfo readHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
         try (InputStream is = byteSource.getInputStream()) {
-            final FileInfo ret = readHeader(is);
-            return ret;
+            return readHeader(is);
         }
     }
 


[11/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775881 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/1743e64b
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/1743e64b
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/1743e64b

Branch: refs/heads/master
Commit: 1743e64bd2f06425b12061850d012c7fc86ef7ad
Parents: 7fe8373
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:24:55 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:24:55 2016 +0000

----------------------------------------------------------------------
 .../apache/commons/imaging/common/bytesource/ByteSourceFile.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/1743e64b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
index 77ef5cd..87adbd8 100644
--- a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
+++ b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
@@ -71,8 +71,7 @@ public class ByteSourceFile extends ByteSource {
             while ((read = is.read(buffer)) > 0) {
                 baos.write(buffer, 0, read);
             }
-            final byte[] ret = baos.toByteArray();
-            return ret;
+            return baos.toByteArray();
         }
     }
 


[42/50] [abbrv] commons-imaging git commit: Add RAT exclude for test image

Posted by ch...@apache.org.
Add RAT exclude for test image

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795457 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/8a3843f4
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/8a3843f4
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/8a3843f4

Branch: refs/heads/master
Commit: 8a3843f44c22ba84ba85367c7de8a533bd06c7ca
Parents: f50e85c
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:13:49 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:13:49 2017 +0000

----------------------------------------------------------------------
 pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/8a3843f4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 677762f..820e77b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -326,6 +326,7 @@
             <exclude>src/test/data/images/pbm/2/5x5-bw.pam</exclude>
             <exclude>src/test/data/images/pbm/1/Oregon Scientific DS6639 - DSC_0307 - small.pgm</exclude>
             <exclude>src/test/data/images/xbm/1/Oregon Scientific DS6639 - DSC_0307 - small.xbm</exclude>
+            <exclude>src/test/data/images/xbm/1/Oregon Scientific DS6639 - DSC_0307 - small X10.xbm</exclude>
             <exclude>src/main/resources/org/apache/commons/imaging/formats/xpm/rgb.txt</exclude>
           </excludes>
         </configuration>


[03/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775872 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/ea94f208
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/ea94f208
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/ea94f208

Branch: refs/heads/master
Commit: ea94f2081dd418bbb9ce255d82b4631928aed4e5
Parents: ed36249
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:15:12 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:15:12 2016 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/ea94f208/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
index b9cd7e7..93b61d3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
@@ -83,14 +83,13 @@ public class RgbeImageParser extends ImageParser {
     public ImageInfo getImageInfo(final ByteSource byteSource, final Map<String, Object> params)
             throws ImageReadException, IOException {
         try (RgbeInfo info = new RgbeInfo(byteSource)) {
-            final ImageInfo ret = new ImageInfo(
+            return new ImageInfo(
                     getName(),
                     32, // todo may be 64 if double?
                     new ArrayList<String>(), ImageFormats.RGBE, getName(),
                     info.getHeight(), "image/vnd.radiance", 1, -1, -1, -1, -1,
                     info.getWidth(), false, false, false,
                     ImageInfo.ColorType.RGB, ImageInfo.CompressionAlgorithm.ADAPTIVE_RLE);
-            return ret;
         }
     }
 


[10/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775880 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/7fe8373e
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/7fe8373e
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/7fe8373e

Branch: refs/heads/master
Commit: 7fe8373eb988de6f6f9895f55dde05a147ace2fc
Parents: 23c17bf
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:22:40 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:22:40 2016 +0000

----------------------------------------------------------------------
 .../apache/commons/imaging/common/bytesource/ByteSourceFile.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/7fe8373e/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
index e67d933..77ef5cd 100644
--- a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
+++ b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
@@ -50,9 +50,8 @@ public class ByteSourceFile extends ByteSource {
                         + ", data length: " + raf.length() + ").");
             }
 
-            final byte[] ret = BinaryFunctions.getRAFBytes(raf, start, length,
+            return BinaryFunctions.getRAFBytes(raf, start, length,
                     "Could not read value from file");
-            return ret;
         }
     }
 


[50/50] [abbrv] commons-imaging git commit: Fix Checkstyle error: 'static' modifier out of order with the JLS suggestions.

Posted by ch...@apache.org.
Fix Checkstyle error: 'static' modifier out of order with the JLS suggestions.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795465 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/f46d642f
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/f46d642f
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/f46d642f

Branch: refs/heads/master
Commit: f46d642f1c4893bcbb90dbd7aec867ab3cf0d62e
Parents: 8a583a2
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:46:58 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:46:58 2017 +0000

----------------------------------------------------------------------
 .../imaging/formats/gif/GifImageParser.java     | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f46d642f/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
index ae23539..f3d4e67 100644
--- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
@@ -60,20 +60,20 @@ public class GifImageParser extends ImageParser {
     private static final String DEFAULT_EXTENSION = ".gif";
     private static final String[] ACCEPTED_EXTENSIONS = { DEFAULT_EXTENSION, };
     private static final byte[] GIF_HEADER_SIGNATURE = { 71, 73, 70 };
-    private final static int EXTENSION_CODE = 0x21;
-    private final static int IMAGE_SEPARATOR = 0x2C;
-    private final static int GRAPHIC_CONTROL_EXTENSION = (EXTENSION_CODE << 8) | 0xf9;
-    private final static int COMMENT_EXTENSION = 0xfe;
-    private final static int PLAIN_TEXT_EXTENSION = 0x01;
-    private final static int XMP_EXTENSION = 0xff;
-    private final static int TERMINATOR_BYTE = 0x3b;
-    private final static int APPLICATION_EXTENSION_LABEL = 0xff;
-    private final static int XMP_COMPLETE_CODE = (EXTENSION_CODE << 8)
+    private static final int EXTENSION_CODE = 0x21;
+    private static final int IMAGE_SEPARATOR = 0x2C;
+    private static final int GRAPHIC_CONTROL_EXTENSION = (EXTENSION_CODE << 8) | 0xf9;
+    private static final int COMMENT_EXTENSION = 0xfe;
+    private static final int PLAIN_TEXT_EXTENSION = 0x01;
+    private static final int XMP_EXTENSION = 0xff;
+    private static final int TERMINATOR_BYTE = 0x3b;
+    private static final int APPLICATION_EXTENSION_LABEL = 0xff;
+    private static final int XMP_COMPLETE_CODE = (EXTENSION_CODE << 8)
             | XMP_EXTENSION;
-    private static final int LOCAL_COLOR_TABLE_FLAG_MASK = 1 << 7;
-    private static final int INTERLACE_FLAG_MASK = 1 << 6;
-    private static final int SORT_FLAG_MASK = 1 << 5;
-    private static final byte[] XMP_APPLICATION_ID_AND_AUTH_CODE = {
+    private final static int LOCAL_COLOR_TABLE_FLAG_MASK = 1 << 7;
+    private final static int INTERLACE_FLAG_MASK = 1 << 6;
+    private final static int SORT_FLAG_MASK = 1 << 5;
+    private final static byte[] XMP_APPLICATION_ID_AND_AUTH_CODE = {
         0x58, // X
         0x4D, // M
         0x50, // P


[34/50] [abbrv] commons-imaging git commit: Fix a comment typo.

Posted by ch...@apache.org.
Fix a comment typo.



git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780759 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/81d85797
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/81d85797
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/81d85797

Branch: refs/heads/master
Commit: 81d857976d0baa9b10dee944f886c012eaaf7360
Parents: 104b409
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sun Jan 29 00:41:19 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sun Jan 29 00:41:19 2017 +0000

----------------------------------------------------------------------
 src/main/java/org/apache/commons/imaging/common/BasicCParser.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/81d85797/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/BasicCParser.java b/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
index 13ff79a..10eb9c6 100644
--- a/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
+++ b/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
@@ -29,7 +29,7 @@ import org.apache.commons.imaging.ImageReadException;
  * A rudimentary preprocessor and parser for the C programming
  * language.
  *
- * FIXME replace this by a paraser generated via ANTLR (if we really need it?!)
+ * FIXME replace this by a parser generated via ANTLR (if we really need it?!)
  */
 public class BasicCParser {
     private final PushbackInputStream is;


[19/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775890 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/c3c8838a
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/c3c8838a
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/c3c8838a

Branch: refs/heads/master
Commit: c3c8838abc7a5841d98ecf72bdc5e6753ab9e3fb
Parents: 38c8705
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 19:00:59 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 19:00:59 2016 +0000

----------------------------------------------------------------------
 .../imaging/formats/tiff/datareaders/DataReaderStrips.java        | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/c3c8838a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
index 0f00406..ee632e9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
@@ -166,8 +166,7 @@ public final class DataReaderStrips extends ImageDataReader {
         // this logic will handle all cases not conforming to the
         // special case handled above
 
-        final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        final BitInputStream bis = new BitInputStream(bais, byteOrder);
+        final BitInputStream bis = new BitInputStream(new ByteArrayInputStream(bytes), byteOrder);
 
         int[] samples = new int[bitsPerSampleLength];
         resetPredictor();


[35/50] [abbrv] commons-imaging git commit: Indentation fixes.

Posted by ch...@apache.org.
Indentation fixes.



git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780761 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/231f378d
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/231f378d
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/231f378d

Branch: refs/heads/master
Commit: 231f378daf13afad3a93f501059bd2a065e71363
Parents: 81d8579
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sun Jan 29 01:06:45 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sun Jan 29 01:06:45 2017 +0000

----------------------------------------------------------------------
 .../commons/imaging/formats/xpm/XpmImageParser.java     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/231f378d/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index 26bcff0..e03c0ca 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -512,9 +512,9 @@ public class XpmImageParser extends ImageParser {
         if (xpmHeader.palette.size() <= (1 << 8)) {
             final int[] palette = new int[xpmHeader.palette.size()];
             for (final Entry<Object, PaletteEntry> entry : xpmHeader.palette.entrySet()) {
-            final PaletteEntry paletteEntry = entry.getValue();
-            palette[paletteEntry.index] = paletteEntry.getBestARGB();
-         }
+                final PaletteEntry paletteEntry = entry.getValue();
+                palette[paletteEntry.index] = paletteEntry.getBestARGB();
+            }
             colorModel = new IndexColorModel(8, xpmHeader.palette.size(),
                     palette, 0, true, -1, DataBuffer.TYPE_BYTE);
             raster = Raster.createInterleavedRaster(
@@ -524,9 +524,9 @@ public class XpmImageParser extends ImageParser {
         } else if (xpmHeader.palette.size() <= (1 << 16)) {
             final int[] palette = new int[xpmHeader.palette.size()];
             for (final Entry<Object, PaletteEntry> entry : xpmHeader.palette.entrySet()) {
-            final PaletteEntry paletteEntry = entry.getValue();
-            palette[paletteEntry.index] = paletteEntry.getBestARGB();
-         }
+                final PaletteEntry paletteEntry = entry.getValue();
+                palette[paletteEntry.index] = paletteEntry.getBestARGB();
+            }
             colorModel = new IndexColorModel(16, xpmHeader.palette.size(),
                     palette, 0, true, -1, DataBuffer.TYPE_USHORT);
             raster = Raster.createInterleavedRaster(


[31/50] [abbrv] commons-imaging git commit: Order the bytes in a multi-byte XBM image correctly.

Posted by ch...@apache.org.
Order the bytes in a multi-byte XBM image correctly.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780710 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/7aa76295
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/7aa76295
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/7aa76295

Branch: refs/heads/master
Commit: 7aa76295c10a7b7da3b142f7c52b9dd3e2339e8c
Parents: b33463d
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sat Jan 28 15:49:02 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sat Jan 28 15:49:02 2017 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/xbm/XbmImageParser.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/7aa76295/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index c9c9b1c..757a314 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -259,10 +259,8 @@ public class XbmImageParser extends ImageParser {
                 final int value = Integer.parseInt(token.substring(2), 16);
                 final int flipped = Integer.reverse(value) >>> (32 - inputWidth);
                 if (inputWidth == 16) {
+                    imageData[i++] = (byte) (flipped >>> 8);
                     if ((x + 8) < xbmHeader.width) {
-                        imageData[i++] = (byte) (flipped >>> 8);
-                        imageData[i++] = (byte) flipped;
-                    } else {
                         imageData[i++] = (byte) flipped;
                     }
                 } else {


[21/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775927 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/3ec90672
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/3ec90672
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/3ec90672

Branch: refs/heads/master
Commit: 3ec906724ef94c0110be3e61db625e95ac203d17
Parents: df7e667
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:22:56 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:22:56 2016 +0000

----------------------------------------------------------------------
 .../commons/imaging/formats/tiff/datareaders/DataReaderTiled.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/3ec90672/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
index 575ccaa..9864e06 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
@@ -115,8 +115,7 @@ public final class DataReaderTiled extends ImageDataReader {
 
         // End of May 2012 changes
 
-        final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        final BitInputStream bis = new BitInputStream(bais, byteOrder);
+        final BitInputStream bis = new BitInputStream(new ByteArrayInputStream(bytes), byteOrder);
 
         final int pixelsPerTile = tileWidth * tileLength;
 


[32/50] [abbrv] commons-imaging git commit: Allow XPM images to have 192 bit color, just like Apache OpenOffice's XPM parser does.

Posted by ch...@apache.org.
Allow XPM images to have 192 bit color, just like Apache OpenOffice's XPM
parser does.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780730 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/316d61df
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/316d61df
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/316d61df

Branch: refs/heads/master
Commit: 316d61dfa5c70aa7bca3dffaf5486936f1b4192a
Parents: 7aa7629
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sat Jan 28 18:31:34 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sat Jan 28 18:31:34 2017 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/xpm/XpmImageParser.java  | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/316d61df/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index c8b0508..e3b19fd 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -338,6 +338,11 @@ public class XpmImageParser extends ImageParser {
                 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 if (color.length() == 24) {
+                final int red = Integer.parseInt(color.substring(0, 1), 16);
+                final int green = Integer.parseInt(color.substring(8, 9), 16);
+                final int blue = Integer.parseInt(color.substring(16, 17), 16);
+                return 0xff000000 | (red << 16) | (green << 8) | blue;
             } else {
                 return 0x00000000;
             }


[13/50] [abbrv] commons-imaging git commit: Refactor duplicate code.

Posted by ch...@apache.org.
Refactor duplicate code.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775883 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/e6799d87
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/e6799d87
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/e6799d87

Branch: refs/heads/master
Commit: e6799d87f014be14635e9db2e087614b16c87588
Parents: 0ac4d25
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:27:57 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:27:57 2016 +0000

----------------------------------------------------------------------
 .../apache/commons/imaging/common/bytesource/ByteSourceFile.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/e6799d87/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
index a48381a..30c745c 100644
--- a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
+++ b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
@@ -64,7 +64,7 @@ public class ByteSourceFile extends ByteSource {
     public byte[] getAll() throws IOException {
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
-        try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
+        try (InputStream is = getInputStream()) {
             final byte[] buffer = new byte[1024];
             int read;
             while ((read = is.read(buffer)) > 0) {


[04/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775874 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/04aaa4b3
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/04aaa4b3
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/04aaa4b3

Branch: refs/heads/master
Commit: 04aaa4b3f605ba05f4f3e6736f7f402c656ef202
Parents: ea94f20
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:16:21 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:16:21 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/commons/imaging/formats/tiff/TiffReader.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/04aaa4b3/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
index 612f1f4..a259b59 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
@@ -55,8 +55,7 @@ public class TiffReader extends BinaryFileParser {
 
     private TiffHeader readTiffHeader(final ByteSource byteSource) throws ImageReadException, IOException {
         try (InputStream is = byteSource.getInputStream()) {
-            final TiffHeader ret = readTiffHeader(is);
-            return ret;
+            return readTiffHeader(is);
         }
     }
     


[23/50] [abbrv] commons-imaging git commit: Format.

Posted by ch...@apache.org.
Format.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775929 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/0c076704
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/0c076704
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/0c076704

Branch: refs/heads/master
Commit: 0c07670439c4af6fc6e9aa7c099330d7b5395a65
Parents: 2051573
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:25:14 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:25:14 2016 +0000

----------------------------------------------------------------------
 .../formats/tiff/write/TiffImageWriterLossless.java       | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/0c076704/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
index 30b152b..8e80447 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
@@ -299,8 +299,7 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
         final byte[] output = new byte[(int) outputLength];
 
         // copy old data (including maker notes, etc.)
-        System.arraycopy(exifBytes, 0, output, 0,
-                Math.min(exifBytes.length, output.length));
+        System.arraycopy(exifBytes, 0, output, 0, Math.min(exifBytes.length, output.length));
 
         final BufferOutputStream headerStream = new BufferOutputStream(output, 0);
         final BinaryOutputStream headerBinaryStream = new BinaryOutputStream(headerStream, byteOrder);
@@ -309,14 +308,13 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
         // zero out the parsed pieces of old exif segment, in case we don't
         // overwrite them.
         for (final TiffElement element : analysis) {
-            Arrays.fill(output, (int)element.offset,
-                    (int)Math.min(element.offset + element.length, output.length), (byte)0);
+            Arrays.fill(output, (int) element.offset, (int) Math.min(element.offset + element.length, output.length),
+                    (byte) 0);
         }
 
         // write in the new items
         for (final TiffOutputItem outputItem : outputItems) {
-            final BufferOutputStream tos = new BufferOutputStream(output,
-                    (int) outputItem.getOffset());
+            final BufferOutputStream tos = new BufferOutputStream(output, (int) outputItem.getOffset());
             final BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
             outputItem.writeItem(bos);
         }


[29/50] [abbrv] commons-imaging git commit: Add support for XBM images using 16 bit hexadecimal input values, as seen in the Apache Openoffice source code.

Posted by ch...@apache.org.
Add support for XBM images using 16 bit hexadecimal input values, as seen
in the Apache Openoffice source code.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780699 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/960adeb4
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/960adeb4
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/960adeb4

Branch: refs/heads/master
Commit: 960adeb400ae90168687172fb8202cd872639ea6
Parents: 4ec828e
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sat Jan 28 14:25:13 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sat Jan 28 14:25:13 2017 +0000

----------------------------------------------------------------------
 .../imaging/formats/xbm/XbmImageParser.java     |  28 +-
 ...Scientific DS6639 - DSC_0307 - small X10.xbm | 478 +++++++++++++++++++
 2 files changed, 495 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/960adeb4/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index 4a3d8a4..1e1cae0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -191,9 +191,17 @@ public class XbmImageParser extends ImageParser {
         if ("unsigned".equals(token)) {
             token = cParser.nextToken();
         }
-        if (!"char".equals(token)) {
+        final int inputWidth;
+        final int hexWidth;
+        if ("char".equals(token)) {
+            inputWidth = 8;
+            hexWidth = 4; // 0xab
+        } else if ("short".equals(token)) {
+            inputWidth = 16;
+            hexWidth = 6; // 0xabcd
+        } else {
             throw new ImageReadException(
-                    "Parsing XBM file failed, no 'char' token");
+                    "Parsing XBM file failed, no 'char' or 'short' token");
         }
         final String name = cParser.nextToken();
         if (name == null) {
@@ -236,24 +244,22 @@ public class XbmImageParser extends ImageParser {
 
         final int rowLength = (xbmHeader.width + 7) / 8;
         final byte[] imageData = new byte[rowLength * xbmHeader.height];
-        for (int i = 0; i < imageData.length; i++) {
+        for (int i = 0; i < imageData.length; ) {
             token = cParser.nextToken();
             if (token == null || !token.startsWith("0x")) {
                 throw new ImageReadException("Parsing XBM file failed, "
                         + "hex value missing");
             }
-            if (token.length() > 4) {
+            if (token.length() > hexWidth) {
                 throw new ImageReadException("Parsing XBM file failed, "
                         + "hex value too long");
             }
             final int value = Integer.parseInt(token.substring(2), 16);
-            int flipped = 0;
-            for (int j = 0; j < 8; j++) {
-                if ((value & (1 << j)) != 0) {
-                    flipped |= (0x80 >>> j);
-                }
+            final int flipped = Integer.reverse(value) >>> (32 - inputWidth);
+            if (inputWidth == 16 && i < imageData.length) {
+                imageData[i++] = (byte) (flipped >>> 8);
             }
-            imageData[i] = (byte) flipped;
+            imageData[i++] = (byte) flipped;
 
             token = cParser.nextToken();
             if (token == null) {
@@ -261,7 +267,7 @@ public class XbmImageParser extends ImageParser {
                         + "premature end of file");
             }
             if (!",".equals(token)
-                    && (i < (imageData.length - 1) || !"}".equals(token))) {
+                    && ((i < imageData.length) || !"}".equals(token))) {
                 throw new ImageReadException("Parsing XBM file failed, "
                         + "punctuation error");
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/960adeb4/src/test/data/images/xbm/1/Oregon Scientific DS6639 - DSC_0307 - small X10.xbm
----------------------------------------------------------------------
diff --git a/src/test/data/images/xbm/1/Oregon Scientific DS6639 - DSC_0307 - small X10.xbm b/src/test/data/images/xbm/1/Oregon Scientific DS6639 - DSC_0307 - small X10.xbm
new file mode 100644
index 0000000..e2fb9ef
--- /dev/null
+++ b/src/test/data/images/xbm/1/Oregon Scientific DS6639 - DSC_0307 - small X10.xbm	
@@ -0,0 +1,478 @@
+#define x10_width 300
+#define x10_height 225
+static unsigned short x10_bits[] = {
+   0xfdff, 0xffff, 0x7fff, 0x3fef, 0xdffe, 0xffff, 0xffff, 0xdfff, 0xffff,
+   0xffff, 0xffff, 0xfbff, 0xffff, 0xffbf, 0xffff, 0xffff, 0xf7ff, 0xffff,
+   0x0fff, 0xfffd, 0xffff, 0xbfff, 0x4bd6, 0xfffd, 0xffff, 0xffbf, 0xffff,
+   0xffff, 0xffff, 0xffff, 0x7fff, 0xfffe, 0xffff, 0xffff, 0xffff, 0xfbff,
+   0xffff, 0x0fff, 0xffff, 0xffff, 0xffff, 0xc1fb, 0xfffa, 0xffff, 0xffff,
+   0xffff, 0xbfff, 0xff9f, 0x7fff, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xfaff, 0xffff, 0x0fff, 0xfdde, 0xffff, 0xffff, 0x800a, 0xffce, 0xffff,
+   0xffff, 0xffff, 0x7fff, 0xfffe, 0xffff, 0xfffc, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xfdff, 0xffff, 0x0fff, 0xffff, 0xffff, 0xafff, 0x200b, 0xffff,
+   0xffff, 0xfff7, 0x7fff, 0xffff, 0xfcfc, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xfeff, 0xffff, 0x0fff, 0xfdff, 0xffff, 0xdfbf, 0xe02e,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xd7ff, 0xfeff, 0xff5f, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xfaff, 0xffff, 0x0fff, 0xffff, 0xffff, 0xffff,
+   0xfaab, 0xfffb, 0xffff, 0xffff, 0xffff, 0xffdf, 0xe3f3, 0xffff, 0xfffd,
+   0xffff, 0xffff, 0xffff, 0xbfff, 0xd3fe, 0xffff, 0x0fff, 0xdffc, 0xffff,
+   0xfeff, 0xffdf, 0xfffc, 0xffff, 0xffff, 0xffff, 0xe7ff, 0xffcf, 0xfdff,
+   0xbff3, 0xffff, 0xffff, 0xffff, 0x3fff, 0xeeff, 0xffff, 0x0fff, 0xffff,
+   0xffff, 0xffff, 0xef5a, 0xffef, 0xffff, 0xffff, 0xffff, 0xd3ff, 0xffdf,
+   0xffff, 0xfffb, 0xffff, 0xffff, 0xffff, 0xffff, 0xaeff, 0xffff, 0x0fff,
+   0xffff, 0xffff, 0xffff, 0xafdf, 0xffe7, 0xfffe, 0xffff, 0xffff, 0xe7ff,
+   0xffbf, 0xffff, 0xffff, 0xfffe, 0xffff, 0xffff, 0xfffb, 0xbfff, 0xffff,
+   0x0fff, 0xafff, 0xffff, 0xbfff, 0xfdef, 0xffff, 0xf7ff, 0xffff, 0xffff,
+   0xb3fd, 0xfffe, 0xfffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffb, 0xffff,
+   0xffff, 0x0fff, 0xffff, 0xffff, 0x7fff, 0xff1b, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x33fb, 0xfffd, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffef,
+   0xdfff, 0xffff, 0x0fff, 0xefff, 0xffff, 0xffff, 0xb2fd, 0xffff, 0xffef,
+   0x7fff, 0xff7f, 0x8fff, 0xff7b, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xafff, 0xffff, 0x0fff, 0xfff7, 0xffff, 0xffff, 0xe5f7, 0xfffe,
+   0xffff, 0xff7f, 0xffff, 0x8bff, 0xff77, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xfff7, 0xffff, 0xfdff, 0xffff, 0x0fff, 0xddbf, 0xffff, 0xffff, 0xf413,
+   0xffff, 0xffff, 0xfff7, 0xdbff, 0xafff, 0xf7f7, 0xffff, 0xffff, 0xfffe,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff, 0xf7eb, 0xbfff, 0xffff,
+   0x3a71, 0xfffe, 0xf7ff, 0xf73f, 0xdfff, 0xfb8f, 0xf7fc, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffef, 0xffff, 0xffff, 0xffff, 0x0fff, 0xfef6, 0xdfff,
+   0xffff, 0xd57e, 0xfff4, 0xffff, 0xf84f, 0x9fff, 0xff97, 0xdfff, 0xffff,
+   0xbfff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfcff, 0xffff, 0x0fff, 0xffeb,
+   0xfeff, 0xffff, 0xd8ff, 0xffdd, 0xffff, 0xf02f, 0x0fff, 0xbf5f, 0xffff,
+   0xffff, 0xfdff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff,
+   0xf5aa, 0xffff, 0xeffb, 0x1bff, 0xffa7, 0xffff, 0xff0f, 0xffff, 0x0f3d,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xfdff, 0xffff, 0xffff, 0xfbff, 0xffff,
+   0x0fff, 0x6abd, 0xffff, 0xffff, 0xffff, 0xffdd, 0xffff, 0xdf3f, 0xff7f,
+   0x1d7f, 0xffff, 0xffff, 0xf1ff, 0xfffe, 0xf97f, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x0fff, 0xa9ee, 0xffef, 0xffd7, 0xffff, 0xffff, 0xffff, 0xbfdf,
+   0xffff, 0x5eff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfcff, 0xffff, 0xefff,
+   0xcfff, 0xfffe, 0x0fff, 0x5757, 0xeffe, 0xffbf, 0xffff, 0xffff, 0xffff,
+   0xddf7, 0xffff, 0xdfff, 0xffff, 0xffff, 0xfff7, 0xffff, 0xfdff, 0xffff,
+   0xffff, 0xfbff, 0xffff, 0x0fff, 0x55aa, 0xffff, 0xffbf, 0xffff, 0xffff,
+   0xffff, 0xdfbf, 0xffff, 0xffff, 0xfdff, 0xffff, 0xffff, 0xffff, 0xffef,
+   0xffff, 0xffff, 0xffff, 0xfff7, 0x0fff, 0xd55d, 0xfafa, 0xff7f, 0xffef,
+   0xffff, 0xffff, 0xfeff, 0xffff, 0xffff, 0xfbff, 0xffff, 0xfeff, 0xffff,
+   0xff9f, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff, 0xaaaa, 0xfb7d, 0xffdf,
+   0xfdff, 0xffff, 0xffff, 0xffff, 0xff7f, 0xffff, 0xe7ff, 0xf3ff, 0xffff,
+   0xffff, 0xff9f, 0xffff, 0xfffe, 0xffff, 0xffff, 0x0fff, 0x5555, 0xf8ed,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xff86, 0xffff, 0xffff, 0xff9f, 0xffff,
+   0xfcff, 0xffff, 0xdfff, 0xffff, 0xffff, 0xafff, 0xffff, 0x0fff, 0xeaaa,
+   0xffee, 0xffff, 0xffff, 0xffff, 0x6fff, 0xbf93, 0xffff, 0xbfff, 0xffcf,
+   0xffff, 0xffdf, 0xf7f7, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff,
+   0xf955, 0xfd7d, 0xffff, 0xffff, 0xffff, 0xeffe, 0xff9f, 0xfffc, 0xbfff,
+   0xffdf, 0xffff, 0xfff7, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffe,
+   0x0fff, 0x7d55, 0x7ffe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0x7fff, 0xfffb, 0xf01f, 0xffbf, 0xffff, 0xffff, 0xffff, 0xfffd, 0xffff,
+   0xffff, 0x0fff, 0xfaaa, 0xf7ff, 0xfffe, 0xffff, 0xffff, 0xffff, 0x2fff,
+   0xffff, 0x7fff, 0xfff3, 0x0007, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0x0fff, 0xfd55, 0xc3ff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0x18ff, 0xffff, 0xffff, 0xffec, 0x0001, 0xfff8, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0x0fff, 0xb2aa, 0xfffe, 0xffff, 0xffff, 0xffff,
+   0xf3fe, 0xbfff, 0xffff, 0xffff, 0x3fff, 0x0000, 0xffc0, 0xffff, 0xffff,
+   0xfffe, 0xffff, 0xffff, 0xffff, 0x0fff, 0x9885, 0xefff, 0xffff, 0xffff,
+   0xffff, 0xf8ff, 0xbfff, 0xfff7, 0xffff, 0x0fff, 0x0000, 0x8400, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff, 0x800a, 0xff5f, 0xffff,
+   0xffff, 0x3fff, 0xaccc, 0x8fff, 0xffff, 0xffff, 0x03ff, 0x0000, 0x0000,
+   0xfffc, 0xffff, 0xffff, 0xffff, 0xf9ff, 0xffff, 0x0fff, 0xc402, 0xfbbf,
+   0xffff, 0xffff, 0x8fff, 0x0454, 0x5ffe, 0xffff, 0xffff, 0x00ff, 0x0000,
+   0x0000, 0xffe0, 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff, 0x8012,
+   0xf57f, 0xffff, 0xffff, 0xcfff, 0xed70, 0xfffe, 0xffff, 0xffff, 0x003f,
+   0x0000, 0x0002, 0xff00, 0x7fff, 0xfffb, 0xffff, 0xe7ff, 0xffff, 0x0fff,
+   0x8082, 0xfeff, 0xffff, 0xffef, 0xd3ff, 0x39d8, 0xf7ff, 0xffff, 0xffff,
+   0x000d, 0x0000, 0x003c, 0xf800, 0xffff, 0xfff7, 0xffff, 0xffff, 0xffff,
+   0x0fff, 0x8015, 0xffff, 0xffff, 0xffff, 0x33ff, 0xff3f, 0xfff0, 0xffff,
+   0xffff, 0x0003, 0x0000, 0x01e0, 0xc000, 0x7fff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x0fff, 0x0000, 0xffff, 0xffff, 0xff7f, 0xf4ff, 0xd77a, 0xffe1,
+   0xffff, 0xfffb, 0x0000, 0x0000, 0x0f00, 0x0000, 0xfffe, 0xffff, 0xffff,
+   0x7fff, 0xfffd, 0x0fff, 0x0045, 0xfffc, 0xffff, 0xffff, 0xf4ff, 0x7fe6,
+   0xfff0, 0xffff, 0x3fed, 0x0000, 0x0000, 0x7800, 0x0200, 0xfff8, 0xffff,
+   0xffff, 0xffff, 0xfffe, 0x0fff, 0x8000, 0xffff, 0xffff, 0x4fff, 0x1ff7,
+   0xfff7, 0xfffc, 0xfff4, 0x1ff9, 0x0800, 0x0000, 0xe000, 0x1e03, 0xfdf0,
+   0xffff, 0xffff, 0xfbff, 0xffff, 0x0fff, 0x0002, 0xfffe, 0xffff, 0xffff,
+   0xfcf7, 0xfbff, 0xfffc, 0xfffd, 0x02d0, 0x0e00, 0x0000, 0xe001, 0x3c3f,
+   0xf9e0, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff, 0x4000, 0xfdff, 0xffff,
+   0xffbf, 0xe7ff, 0xbfff, 0xffff, 0xdffe, 0x00d0, 0x0f80, 0x0000, 0xc802,
+   0x21fc, 0xf980, 0xffbf, 0xffff, 0xffff, 0xffff, 0x0fff, 0x8000, 0xffff,
+   0xffff, 0xdfff, 0xc7ff, 0xfef5, 0xfdff, 0x4f5c, 0x0038, 0x0ff0, 0x0000,
+   0xe001, 0x1ffe, 0xf800, 0xffff, 0xffff, 0xefff, 0xffff, 0x0fff, 0xe002,
+   0xffff, 0xffff, 0xeeff, 0xe1ff, 0xfff8, 0xf6ff, 0x3f3e, 0x0009, 0x0ff0,
+   0x0000, 0xc001, 0x7ffd, 0xe000, 0xffff, 0xffff, 0xe7ff, 0xffff, 0x0fff,
+   0xe000, 0xffff, 0xffff, 0xffff, 0xdbff, 0xffff, 0xe7ff, 0x7f85, 0x0001,
+   0x07f8, 0x0000, 0xe001, 0xfffe, 0x0003, 0xffff, 0xffff, 0xfdff, 0xffff,
+   0x0fff, 0xc000, 0xffff, 0xffff, 0xffff, 0xffaf, 0xffff, 0xfdff, 0xffc7,
+   0x0000, 0x0ff8, 0x0000, 0xc001, 0x7ffd, 0x003f, 0xfffc, 0xffff, 0xffff,
+   0xffff, 0x0fff, 0xc002, 0xffff, 0xffff, 0xffff, 0xffff, 0x3eff, 0x5ffe,
+   0x7f3f, 0x0000, 0x07f8, 0x8000, 0xc005, 0x7ffe, 0x01ff, 0xfff8, 0xffff,
+   0xffff, 0xffff, 0x0fff, 0xc000, 0xffff, 0xffbf, 0xffff, 0xffff, 0xfbff,
+   0x7ffe, 0x1fff, 0x0000, 0x07f8, 0x8000, 0xc01f, 0x7ffe, 0x0fff, 0xfff0,
+   0xffff, 0xffff, 0xffff, 0x0fff, 0x8000, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x3fff, 0x03ff, 0x0000, 0x07fc, 0x8000, 0xc1ff, 0x7ffd, 0x7fff,
+   0xfff0, 0xffff, 0xffff, 0xffff, 0x0fff, 0xe200, 0xfeff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0x00fb, 0x0000, 0x07f8, 0x0000, 0xefff, 0x7ffe,
+   0xdfff, 0xffe3, 0xffff, 0xffff, 0xffff, 0x0fff, 0xf881, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0x0045, 0x0000, 0x07fc, 0x0008, 0xfffc,
+   0x7cff, 0x1fff, 0xff8e, 0xffff, 0x9fff, 0xffff, 0x0fff, 0xff40, 0xfff7,
+   0xfffa, 0xffff, 0xffff, 0xffff, 0xffff, 0x001d, 0x0000, 0x03fc, 0x0001,
+   0xffc2, 0xffff, 0x5fff, 0xff70, 0xffff, 0xffff, 0xffff, 0x0fff, 0xef20,
+   0xbfff, 0xfff6, 0xffff, 0xffff, 0xffff, 0xffff, 0x0007, 0x0000, 0xc07c,
+   0x0000, 0xfc40, 0x7fff, 0x1fff, 0xff80, 0xffff, 0xffff, 0xffff, 0x0fff,
+   0xffc4, 0xfbbe, 0xfffb, 0xfff7, 0xffff, 0xffff, 0xbfff, 0x0003, 0x0000,
+   0x1818, 0x0000, 0xe100, 0xffff, 0x5fff, 0xff44, 0xffff, 0xffff, 0xffff,
+   0x0fff, 0xff80, 0xf393, 0xffbf, 0xffdf, 0xffff, 0xffff, 0x7fff, 0x0000,
+   0x0000, 0x0700, 0x0000, 0x2000, 0x7ffe, 0x1f7f, 0xff01, 0xffff, 0xffff,
+   0xffff, 0x0fff, 0xf7e1, 0xffdd, 0xfffd, 0xffff, 0xffff, 0xffff, 0x3fff,
+   0x0000, 0x0000, 0x00c0, 0x0000, 0x0000, 0xfff1, 0x5fff, 0xff44, 0xffff,
+   0xffff, 0x7fff, 0x0fff, 0xd980, 0xfde7, 0xfffb, 0xfffc, 0xffff, 0xffff,
+   0x0ffd, 0x0000, 0x1000, 0x0030, 0x0000, 0x0000, 0xff08, 0x3fff, 0xfe00,
+   0xffff, 0xffff, 0xffff, 0x0fff, 0xe400, 0xed7c, 0xffe7, 0xffb7, 0xffff,
+   0xffff, 0x03ff, 0x0000, 0x0e00, 0x0004, 0x0000, 0x000e, 0xf280, 0x5fff,
+   0xfe80, 0xffff, 0xffff, 0xffff, 0x0fff, 0x0001, 0xcc7e, 0x7bff, 0xff3f,
+   0xdfff, 0xffff, 0x00ff, 0x0000, 0x0300, 0x0001, 0x0000, 0x00fe, 0x8000,
+   0x5fff, 0xfe00, 0xffff, 0xffff, 0xffff, 0x0fff, 0x0000, 0xe51e, 0xbfff,
+   0xffff, 0xffff, 0xffff, 0x007f, 0x0000, 0x60c0, 0x0000, 0x0000, 0x0fff,
+   0x4000, 0x7ffe, 0xfd00, 0xffff, 0xffff, 0xffff, 0x0ff7, 0x0000, 0xe272,
+   0xbfff, 0xfffb, 0xffff, 0xffff, 0x001f, 0x0000, 0x1800, 0x0000, 0x0000,
+   0xfffe, 0x0000, 0xffc8, 0xfd07, 0xffff, 0xffff, 0xffff, 0x0ffb, 0x0000,
+   0xbd3f, 0xffff, 0xffef, 0xffef, 0xffff, 0x0007, 0x0000, 0x0300, 0x0000,
+   0x0000, 0xfffe, 0x000f, 0xfea0, 0xf83f, 0xffff, 0xffff, 0xffff, 0x0fff,
+   0x0000, 0xfdaf, 0xbffd, 0xffff, 0xffff, 0xfffb, 0x0001, 0x0000, 0x00c0,
+   0x0000, 0x0000, 0xfffe, 0x007f, 0xe100, 0xf9ff, 0xbfff, 0xffff, 0xffff,
+   0x0fff, 0x8501, 0xfdf3, 0xffff, 0xffff, 0xffff, 0xffef, 0x0000, 0x0000,
+   0x0010, 0x0000, 0x0000, 0xfffe, 0x07ff, 0x1000, 0xf3ff, 0xffff, 0xffff,
+   0xffff, 0x0fff, 0x2800, 0xfff1, 0xffff, 0xffff, 0xefff, 0x3f1f, 0x0000,
+   0x0000, 0x0004, 0x0000, 0x0000, 0xfffe, 0x1fff, 0x0000, 0xf1f8, 0xffff,
+   0xffff, 0xffff, 0x0fff, 0xc280, 0xfffa, 0xfffe, 0xfdff, 0xffff, 0x0ff7,
+   0x0000, 0x8000, 0x0001, 0x0000, 0x0000, 0xfffe, 0x3fff, 0x0000, 0xe344,
+   0xffff, 0xffff, 0xffff, 0x0fff, 0x7520, 0xffff, 0xffff, 0xfddf, 0xffff,
+   0x03bf, 0x0000, 0x6000, 0x0000, 0x0000, 0x0000, 0xfffe, 0x7fff, 0x0038,
+   0xe000, 0xffff, 0xffff, 0xffff, 0x0fff, 0xd548, 0xfffb, 0xffff, 0xfdff,
+   0xffff, 0x015f, 0x0000, 0x1800, 0x0000, 0x0000, 0x0000, 0xfffc, 0x7fff,
+   0x03f8, 0xe000, 0xffff, 0xffff, 0xffff, 0x0fff, 0xbe90, 0xfffb, 0xffff,
+   0xebff, 0xffff, 0x0037, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0xfffc,
+   0xffff, 0x1ff8, 0xc000, 0xffff, 0xffff, 0xffff, 0x0fff, 0xfd78, 0xfffb,
+   0xffff, 0xfbff, 0xffff, 0x000d, 0x0000, 0x00c0, 0x0000, 0x0000, 0x0000,
+   0xfffc, 0xffff, 0xfff0, 0xc000, 0xffff, 0xfffe, 0xffff, 0x0fff, 0xeb68,
+   0xffff, 0xfbff, 0xffff, 0xffff, 0x0007, 0x0000, 0x0030, 0x0000, 0x0000,
+   0x0000, 0xfffc, 0xffff, 0xfff0, 0x800f, 0xffff, 0xfffe, 0xffff, 0x0fff,
+   0x2af2, 0xffff, 0xffff, 0xffff, 0x6ffe, 0x0001, 0x0000, 0x0004, 0x0000,
+   0x0000, 0x0000, 0xfffc, 0xffff, 0xfff1, 0x807f, 0xffff, 0xfffe, 0xffff,
+   0x0fff, 0xd168, 0xfffa, 0xffff, 0xffff, 0xffff, 0x0000, 0x8000, 0x0001,
+   0x0000, 0x0000, 0x0000, 0xfffc, 0xffff, 0xffe1, 0x03ff, 0xbfff, 0xfffe,
+   0xffff, 0x0fff, 0x4ed5, 0xffff, 0xffff, 0xffff, 0x3fbf, 0x0000, 0x2000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0xfffc, 0xffff, 0xffe1, 0x0fff, 0xfffe,
+   0xffff, 0xffff, 0x0fff, 0xeb54, 0xfffb, 0xffff, 0xfdff, 0x0e7f, 0x0000,
+   0x1800, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffc, 0xffff, 0xffe1, 0x0fff,
+   0xffff, 0xfff7, 0xffff, 0x0fff, 0xd55a, 0xdfff, 0xffff, 0xf6ff, 0x077f,
+   0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffc, 0xffff, 0xffc3,
+   0x1fff, 0xfffe, 0xffff, 0xffff, 0x0fff, 0xaaae, 0xffff, 0xffff, 0x5fff,
+   0x01bf, 0x0000, 0x0080, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffc, 0xffff,
+   0xffc3, 0x3fff, 0xfffc, 0xffef, 0xffff, 0x0fff, 0xd75b, 0xffff, 0xfffe,
+   0x4bef, 0x013a, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8,
+   0xffff, 0xffc3, 0x3fff, 0xfffc, 0xffff, 0xffff, 0x0fff, 0xed56, 0xffff,
+   0xffff, 0xf98f, 0x0093, 0x0000, 0x000c, 0x0000, 0x0000, 0x0000, 0x0000,
+   0xfffc, 0xffff, 0xffc7, 0x7fff, 0xfff8, 0xffff, 0xffff, 0x0fff, 0xeaad,
+   0x7fff, 0xffff, 0xfe57, 0x00d7, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000,
+   0x0000, 0xfff8, 0xffff, 0xff87, 0x7fff, 0xfff8, 0xffff, 0xffff, 0x0fff,
+   0xbf7a, 0xffff, 0xffff, 0x707f, 0x006f, 0x8000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0xfff8, 0xffff, 0xff87, 0xffff, 0xfff0, 0xffff, 0xffff,
+   0x0fff, 0xfeee, 0xdfff, 0xffff, 0xfbdc, 0x0267, 0x3000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0xfff8, 0xffff, 0xff87, 0xffff, 0xfff0, 0xffff,
+   0xffff, 0x0fff, 0x57dd, 0xffff, 0xffff, 0xfaa0, 0x033f, 0x0800, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xffff, 0xff87, 0xffff, 0xffe1,
+   0xffff, 0xffff, 0x0fff, 0xab6a, 0xfffa, 0x7fff, 0xff00, 0x03d2, 0x0100,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xffff, 0xff0f, 0xffff,
+   0xffe1, 0xffff, 0xffff, 0x0fff, 0xfa8b, 0xfff5, 0x7fff, 0xde66, 0x03fc,
+   0x0040, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xffff, 0xff0f,
+   0xffff, 0xffc1, 0xffff, 0xffff, 0x0fff, 0xffaa, 0xf7ea, 0x7fff, 0xbf80,
+   0x03de, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xffff,
+   0xff0f, 0xffff, 0xff83, 0xffff, 0xffff, 0x0fff, 0xffd4, 0xdff7, 0xffef,
+   0xad51, 0xe3cd, 0x000c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8,
+   0xffff, 0xff0f, 0xffff, 0xff03, 0xffff, 0xffff, 0x0fff, 0xa4aa, 0xffed,
+   0xee5f, 0x53c7, 0x91e4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0xfff0, 0xffff, 0xff1f, 0xffff, 0xff07, 0xffff, 0xffff, 0x0fff, 0x571b,
+   0xffe2, 0xdfef, 0x0b3b, 0xa1e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0xfff0, 0xffff, 0xfe0f, 0xffff, 0xff07, 0xffff, 0xffff, 0x0fff,
+   0xebe5, 0xeb6d, 0xe7ef, 0xa34f, 0x11e0, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0xffe0, 0xffff, 0xfe1f, 0xffff, 0xff0f, 0xffff, 0xffff,
+   0x0fff, 0x5bfc, 0xf6f7, 0x919f, 0x2885, 0x04e0, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0028, 0xffc0, 0xffff, 0xfe1f, 0xffff, 0xfe0f, 0xffff,
+   0xffbf, 0x0fff, 0xb9fe, 0xfffa, 0x024f, 0x0a00, 0x0220, 0x0000, 0x0000,
+   0x0000, 0x0000, 0xe000, 0xf85f, 0xfc01, 0xffff, 0xfe1f, 0xffff, 0xfe0f,
+   0xe7ff, 0xffbf, 0x0fff, 0xef7f, 0xef6f, 0x5415, 0x0532, 0x00c0, 0x0000,
+   0x0000, 0x0000, 0x0000, 0xf800, 0xe87f, 0x407f, 0xffff, 0xfe1f, 0xffff,
+   0xfe0f, 0xffff, 0xff9f, 0x0fff, 0xff7d, 0xbf9f, 0x557f, 0x0089, 0x0000,
+   0x0700, 0x0000, 0x0000, 0x0000, 0xff80, 0xf45f, 0x0fff, 0xfff0, 0xfe3f,
+   0xffff, 0xfc1f, 0xdfff, 0xfd9f, 0x0fff, 0xfef7, 0xfb7f, 0xdafb, 0x04a2,
+   0x0014, 0x0580, 0x0000, 0x0000, 0x0000, 0xffe0, 0xe87f, 0xfeff, 0xfe01,
+   0xfe1f, 0xffff, 0xfc1f, 0xffff, 0xff9f, 0x0fff, 0xda9e, 0xddde, 0x7f1f,
+   0x059c, 0x0002, 0x02b0, 0x0000, 0x0000, 0x0000, 0xfffe, 0xfc5f, 0xf2ff,
+   0xe01f, 0xfc1f, 0xffff, 0xfc1f, 0xffff, 0xfdff, 0x0fff, 0xbdf5, 0xbefa,
+   0x9c5e, 0x83fa, 0x0000, 0x0058, 0x0000, 0x0000, 0x4000, 0xffff, 0xe87f,
+   0x00fb, 0x07fd, 0xfc08, 0xffff, 0xfc1f, 0xffff, 0xffff, 0x0fff, 0x65aa,
+   0xc3f5, 0x5e2b, 0x4175, 0x8000, 0x01ca, 0x0000, 0x0000, 0x1400, 0xfffe,
+   0xfc7f, 0x04ff, 0xbfa1, 0xf800, 0xffff, 0xf83f, 0xffff, 0xffff, 0x0fff,
+   0x2ae9, 0xd7fa, 0x2c6b, 0x1175, 0xa000, 0x015d, 0x0000, 0x0000, 0x1900,
+   0xffff, 0xf45f, 0x00ff, 0xfd09, 0xf00f, 0xffff, 0xf83f, 0xffff, 0xffff,
+   0x0fff, 0xd92a, 0x57dd, 0xcfe9, 0x09a5, 0xb000, 0x01f5, 0x0000, 0x0000,
+   0xc0a0, 0xffff, 0xfc7f, 0x00ff, 0xe100, 0x00fe, 0xffff, 0xf03f, 0xffff,
+   0xffff, 0x0fff, 0x3555, 0xadff, 0xd9aa, 0x02c9, 0x1800, 0x002f, 0x0000,
+   0x0000, 0x4ab4, 0xffff, 0xf4bf, 0x04ff, 0xc4a9, 0x1fe8, 0xffc0, 0xf03f,
+   0xffff, 0xffff, 0x0fff, 0xd512, 0xfd7d, 0x069a, 0x18c9, 0x0c00, 0x01a5,
+   0x0000, 0x0000, 0x0e26, 0xffff, 0xff7f, 0x007f, 0xc181, 0xff00, 0xfe03,
+   0xf03f, 0xffff, 0xffff, 0x0fff, 0xa96b, 0xffdb, 0xc0b1, 0x1c7c, 0x8400,
+   0x0037, 0x0000, 0x6800, 0x88a4, 0xffff, 0x543f, 0x03ff, 0xc120, 0xf420,
+   0x807f, 0xf03f, 0xffff, 0xffff, 0x0fff, 0x67f5, 0xf3fd, 0x4251, 0x0f15,
+   0x8600, 0x001c, 0x0000, 0x2100, 0xe0a4, 0xffff, 0x7eff, 0x3fff, 0xc000,
+   0x0108, 0x07fe, 0xe018, 0xffff, 0xffff, 0x0fff, 0x5fff, 0xe2f7, 0xb81d,
+   0x079f, 0x8600, 0x0005, 0x0000, 0xa240, 0xe985, 0x9fff, 0x7fff, 0xffa0,
+   0xc02f, 0x9020, 0xff26, 0xe000, 0xffff, 0xffff, 0x0fff, 0xbfff, 0xd03f,
+   0xe01b, 0x07ed, 0xc700, 0x0000, 0x0000, 0x8a28, 0x0381, 0x00ff, 0x7eff,
+   0xf000, 0xc3ff, 0x1428, 0xf486, 0xe01f, 0xffff, 0xffff, 0x0fdf, 0xffff,
+   0xf1ff, 0xd6b3, 0x06ea, 0x3d00, 0x0000, 0x0000, 0x8a82, 0x0805, 0x802f,
+   0x7f7f, 0x0000, 0xfffc, 0x9020, 0x40a6, 0xe1ff, 0xffff, 0xffff, 0x0fff,
+   0xffff, 0xbffd, 0x1077, 0x03f6, 0x0d00, 0x0000, 0x2000, 0x81b2, 0xe891,
+   0x8001, 0x7cff, 0x0000, 0xff40, 0x000f, 0x0406, 0xefe8, 0xffff, 0xffff,
+   0x0fff, 0x77ff, 0xcffb, 0x65ec, 0x02f7, 0x0180, 0x0000, 0x3800, 0x9118,
+   0x3e90, 0x8000, 0x7fff, 0x0000, 0xe000, 0x05ff, 0x05a6, 0xffe0, 0xffff,
+   0xffff, 0x0fff, 0x5faf, 0x5dff, 0xd9ef, 0x02b9, 0x1000, 0x0000, 0xbf80,
+   0x1820, 0x05f2, 0x8000, 0x7f7f, 0x0000, 0x0000, 0x7ffc, 0x108c, 0xffe8,
+   0xffff, 0xffff, 0x0fff, 0xff3e, 0x75ff, 0x7598, 0x015d, 0x0000, 0x0000,
+   0xbfb0, 0x38f0, 0x007e, 0x8000, 0x7fff, 0x0000, 0x0000, 0xff00, 0x100f,
+   0xffc2, 0xffff, 0xffff, 0x0fff, 0x6ffb, 0xe7fb, 0x69df, 0x015d, 0x0000,
+   0x0000, 0x3fa6, 0xfc59, 0x0003, 0x8000, 0x7fff, 0x0000, 0x0000, 0xe000,
+   0x15ff, 0xffe0, 0xffff, 0xffff, 0x0fff, 0xffdf, 0xffef, 0x677f, 0x00ae,
+   0x0000, 0x8000, 0x3fb4, 0xbd1a, 0x0000, 0x8000, 0x7f7f, 0x0000, 0x0000,
+   0x0000, 0xbff8, 0xffe0, 0xffff, 0xffff, 0x0fff, 0xefff, 0xfff7, 0xbf6f,
+   0x00ef, 0x0000, 0x7000, 0x5fa4, 0x0710, 0x0000, 0x8000, 0x7fff, 0x0000,
+   0x0000, 0x0000, 0xff40, 0xffc7, 0xffff, 0xffff, 0x0fdf, 0x17ff, 0xffe5,
+   0x7e87, 0x0057, 0x0000, 0x5200, 0x9fb7, 0x00f0, 0x0000, 0x8000, 0x7fff,
+   0xc000, 0x0000, 0xc000, 0xf000, 0xffff, 0xffff, 0xffff, 0x0fff, 0x4fff,
+   0xfb2b, 0xb7e1, 0x006b, 0x0000, 0x0040, 0xdf93, 0x000f, 0x0000, 0x8000,
+   0x7d7f, 0xe000, 0x0001, 0xe000, 0x001f, 0xfffc, 0xffff, 0xffff, 0x0fff,
+   0xffbd, 0xd43d, 0xffcb, 0x0057, 0x0000, 0x8930, 0xffd3, 0x0001, 0x0000,
+   0x8000, 0x7cff, 0x6000, 0x0191, 0xe000, 0x07ff, 0xff40, 0xffff, 0xffff,
+   0x0fff, 0xff5f, 0xa27c, 0xdbf2, 0x007d, 0x0000, 0x8347, 0x1f13, 0x0000,
+   0x0000, 0x8000, 0x7fff, 0x6000, 0x3990, 0xe000, 0x7fff, 0xf000, 0xffff,
+   0xffff, 0x0fff, 0xf7e6, 0x42ff, 0xebf9, 0x007f, 0xc000, 0x8c17, 0x03a8,
+   0x0000, 0x0000, 0x8000, 0x7fff, 0x6000, 0x49d0, 0xe000, 0xffff, 0xf003,
+   0xbfff, 0xffff, 0x0fff, 0x57bb, 0x5edf, 0xefff, 0x003f, 0xa800, 0x0507,
+   0x003c, 0x0000, 0x0000, 0x8000, 0x7fff, 0xf000, 0x4950, 0xe000, 0xffff,
+   0xf003, 0xffff, 0xffff, 0x0fff, 0x7e7f, 0x58cf, 0xf9fe, 0x003f, 0x8a00,
+   0x4587, 0x0007, 0x0000, 0x0000, 0x8000, 0x3437, 0x3000, 0x3961, 0xe000,
+   0xffff, 0xf003, 0x7fff, 0xffff, 0x0fff, 0xcd7f, 0x2e3c, 0xf7fe, 0x003f,
+   0xca60, 0x7907, 0x0000, 0x0000, 0x0000, 0x0800, 0x6849, 0x0000, 0x2869,
+   0xe000, 0xff40, 0xe003, 0xffff, 0xfffe, 0x0fff, 0x3aff, 0x4f3b, 0xfbfe,
+   0x003f, 0x8848, 0x1e07, 0x0000, 0x0000, 0x0000, 0x8aa0, 0x0021, 0x0000,
+   0x4900, 0xe000, 0xf800, 0xf003, 0x77ff, 0xfffe, 0x0fff, 0x6bff, 0xf3f7,
+   0xf9ff, 0x001f, 0xcb81, 0x01e3, 0x0000, 0x0000, 0x0000, 0x0250, 0x2001,
+   0x0000, 0x4000, 0xc000, 0xe001, 0xe003, 0xffff, 0xfffc, 0x0fff, 0xfbff,
+   0xf5fe, 0xfdff, 0xa09b, 0xc994, 0x003f, 0x0000, 0x0000, 0x0000, 0x8a90,
+   0x0000, 0x0000, 0x0000, 0xe000, 0xc000, 0xf003, 0xffff, 0xfffd, 0x0fff,
+   0xf7ef, 0xfcef, 0xfdff, 0x3c1f, 0xd1a6, 0x000b, 0x0000, 0x0000, 0x0000,
+   0x1228, 0x0005, 0x0000, 0x0000, 0xc000, 0xc000, 0xe003, 0xffff, 0xfff8,
+   0x0fff, 0x1ff7, 0xffcd, 0xfcff, 0xae8f, 0xfa20, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0d40, 0x0001, 0x0000, 0x0000, 0xe000, 0xc000, 0xe003, 0xffff,
+   0xffff, 0x0fff, 0xdfc7, 0xffc0, 0xfdff, 0x2f03, 0x0f16, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x1158, 0x0000, 0x0180, 0x0000, 0xc000, 0xc001, 0xe003,
+   0xffff, 0xffff, 0x0fff, 0xdf8f, 0xe7df, 0x7fff, 0x2ff8, 0x01d6, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x1d00, 0x0000, 0x5340, 0x0000, 0x6000, 0xc001,
+   0xe003, 0xffff, 0xffff, 0x0fff, 0xfd1f, 0xfbdd, 0x3fff, 0x2fff, 0x0038,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x02f0, 0x0000, 0x9180, 0x0001, 0xe000,
+   0x8017, 0xe003, 0xffff, 0xfff7, 0x0fff, 0xffff, 0xfdeb, 0xcfd7, 0x87ff,
+   0x0007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0xff00, 0x0000,
+   0xc000, 0xc7ff, 0xe003, 0xffff, 0xffe7, 0x0fff, 0xffff, 0xf7ff, 0xf35d,
+   0xdfff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000,
+   0x0000, 0x0000, 0xbfff, 0xe003, 0xffff, 0xffe7, 0x0fff, 0xffff, 0xf7ff,
+   0xff89, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0xff80, 0xe003, 0xffff, 0xffe1, 0x0fff, 0xfbff,
+   0xf7ff, 0xffe5, 0x05ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0xe000, 0xa003, 0xffff, 0xffc1, 0x0fff,
+   0xffff, 0xff9f, 0xfff3, 0x007f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
+   0x0fff, 0xfd9f, 0xffef, 0xfffd, 0x001f, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0xffff,
+   0xffff, 0x0fff, 0xffff, 0xbff7, 0xffff, 0x000b, 0x0000, 0x0000, 0x1fc0,
+   0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0000, 0x0008, 0x2078,
+   0xffff, 0xffff, 0x0fff, 0xfffb, 0xdfff, 0x7fff, 0x0000, 0x0000, 0x0000,
+   0x7ff8, 0x0000, 0x0000, 0x0000, 0x03c5, 0x0000, 0x0000, 0x0000, 0x0000,
+   0xc0f8, 0xffff, 0xffff, 0x0fff, 0xefef, 0xffff, 0x1fff, 0x0000, 0x0000,
+   0x0000, 0xfffe, 0x0000, 0x0000, 0x0000, 0x01ca, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x80e0, 0xfffe, 0xffff, 0x0fff, 0xffef, 0xf3ff, 0x03ff, 0x0000,
+   0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0045, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0fff, 0xfbff, 0xf7ff, 0x00ff,
+   0x0000, 0x0000, 0x8000, 0xffff, 0x0001, 0x0000, 0x8000, 0x01ea, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0fff, 0xffff, 0xffff,
+   0x001f, 0x0000, 0x0000, 0xc000, 0xffff, 0x0003, 0x0000, 0x0000, 0x07ff,
+   0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0fff, 0xffff,
+   0xffff, 0x0007, 0x0000, 0x0000, 0xc000, 0xffff, 0x0003, 0x0000, 0x0000,
+   0x57ff, 0x1403, 0x0000, 0x0000, 0x0000, 0x8000, 0xffff, 0xffff, 0x0fff,
+   0xffff, 0xffff, 0x8003, 0x0000, 0x0000, 0xc000, 0xffff, 0x0003, 0x0000,
+   0x0000, 0x0000, 0x07f4, 0x0000, 0x0000, 0x0000, 0x0000, 0xff9f, 0xffff,
+   0x0fff, 0xffff, 0x7fff, 0x3001, 0x0000, 0x0000, 0xe000, 0xffff, 0x0003,
+   0x0000, 0x0000, 0x0000, 0xfc00, 0x0005, 0x0000, 0x0000, 0x8000, 0xff8f,
+   0xffff, 0x0fff, 0xffff, 0x1fff, 0x4401, 0x0000, 0x0000, 0xe000, 0xffff,
+   0x0007, 0x0000, 0x0000, 0x0005, 0x02dc, 0x0fd0, 0x0000, 0x0000, 0x8000,
+   0xff0f, 0xffff, 0x0fff, 0xffff, 0x8fff, 0x1600, 0x0000, 0x0000, 0xe000,
+   0xffff, 0x0007, 0x0000, 0xb000, 0x000a, 0xaa00, 0xe005, 0x0017, 0x0000,
+   0x0000, 0xff9f, 0xffff, 0x0fff, 0xffff, 0x47ff, 0xe600, 0x0000, 0x0000,
+   0xe000, 0xffff, 0x000f, 0x0000, 0xfff8, 0x0001, 0xa550, 0x092a, 0x3f40,
+   0x0000, 0x0000, 0xffc0, 0xffff, 0x0fff, 0xffff, 0xcfff, 0x1700, 0x0000,
+   0x0000, 0xf000, 0xffff, 0x000f, 0xe000, 0xffff, 0x0096, 0xd14a, 0x755f,
+   0x402f, 0x005f, 0x0018, 0xffd8, 0xffff, 0x0fff, 0xffff, 0x67ff, 0x7700,
+   0x0000, 0x0000, 0xe000, 0xffff, 0x000f, 0xffd0, 0xffff, 0x017f, 0x6a90,
+   0xbb57, 0x15da, 0x2f40, 0x0008, 0xffcc, 0xffff, 0x0fff, 0xffff, 0x07ff,
+   0x8b00, 0x0000, 0x0000, 0xf000, 0xffff, 0xe00f, 0xffff, 0xffff, 0x0005,
+   0x8000, 0xf51e, 0x457f, 0x002d, 0x01fd, 0xffdc, 0xffff, 0x0fff, 0xffff,
+   0x67ff, 0x5400, 0x0000, 0x0000, 0xf000, 0xffff, 0xffff, 0xffff, 0xffff,
+   0x002a, 0x0000, 0xda40, 0xbd5f, 0x5fff, 0xfa04, 0xffaf, 0xffff, 0x0fff,
+   0xffff, 0xffff, 0xa201, 0x0000, 0x0000, 0xf000, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x0157, 0x0000, 0x4000, 0x6ab5, 0xffbf, 0x417f, 0xff83, 0xffff,
+   0x0fff, 0xffff, 0xf7ff, 0x5e03, 0x0000, 0x0000, 0xf000, 0xffff, 0xffff,
+   0xffff, 0xffff, 0x005b, 0x0000, 0x0082, 0xb500, 0xffea, 0xaad7, 0xffeb,
+   0xffff, 0x0fff, 0xffff, 0xfbff, 0xa203, 0x0000, 0x0000, 0xf500, 0xffff,
+   0xffff, 0xffff, 0xffff, 0x02af, 0x0000, 0x2a00, 0x8004, 0xffd4, 0xcaaf,
+   0xfff6, 0xffff, 0x0fff, 0xffff, 0xffff, 0x0d07, 0x0000, 0x0000, 0xfff8,
+   0xfdff, 0xffff, 0xffff, 0xffff, 0x095f, 0x0000, 0x4080, 0x1292, 0x5000,
+   0x105d, 0xfef5, 0xffff, 0x0fff, 0xffff, 0xffff, 0x0007, 0x0000, 0xd000,
+   0xffff, 0xf2bf, 0xffff, 0xffff, 0xffff, 0x12ff, 0x0000, 0xaa2a, 0x4944,
+   0x1555, 0xd5a1, 0xfde4, 0xffff, 0x0fff, 0xffff, 0xfbff, 0x0007, 0x0000,
+   0xf500, 0xffff, 0xed5f, 0xffff, 0xffff, 0xffff, 0xafff, 0x0004, 0x1140,
+   0xaa15, 0xaaaa, 0x240a, 0xffff, 0xffff, 0x0fff, 0xffff, 0xffff, 0x0007,
+   0x0000, 0xe2fa, 0xffff, 0xfdbf, 0xffff, 0xffff, 0xffff, 0xffff, 0x95ff,
+   0xaaaa, 0x5552, 0x5595, 0x8955, 0xffd0, 0xffff, 0x0fff, 0xffff, 0xffff,
+   0x0007, 0xf800, 0xe555, 0xffff, 0xdcaf, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x4102, 0xaaad, 0xb56a, 0x255a, 0xfdca, 0xffff, 0x0fff, 0xffff,
+   0xffff, 0x000f, 0xbff4, 0xe56e, 0xefff, 0xd8cf, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xafff, 0x0382, 0x5440, 0xeab5, 0x52aa, 0xfff9, 0xffff, 0x0fff,
+   0xffff, 0xffff, 0xe00f, 0x55ff, 0xe6f5, 0xffff, 0xd087, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xfdff, 0x0381, 0xabf0, 0xaf6a, 0x2ab6, 0xfff5, 0xffff,
+   0x0fff, 0xffff, 0xffff, 0xff8f, 0xfbff, 0xcdbb, 0xdfff, 0xc007, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xaaff, 0x0302, 0xfff0, 0x5007, 0x8555, 0xfffa,
+   0xffff, 0x0fff, 0xffff, 0xffff, 0xffff, 0xbfff, 0xc5f6, 0xffff, 0xa003,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x03fb, 0xfff0, 0xe007, 0x7aab,
+   0xfffd, 0xffff, 0x0fff, 0xffff, 0xffff, 0xffff, 0xfbff, 0x8aed, 0xffff,
+   0xc013, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfffb, 0xe007,
+   0x03ff, 0xffed, 0xffff, 0x0fff, 0xffff, 0xffff, 0xffff, 0x7fff, 0x85f7,
+   0xffff, 0x8003, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xe00f, 0x07ff, 0xfff8, 0xffff, 0x0fff, 0xffff, 0xffff, 0xfffe, 0xfbff,
+   0x8dda, 0xffff, 0x8013, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xf7ff, 0x03ff, 0xfff8, 0xffff, 0x0fff, 0xffff, 0xc7ff, 0xfffc,
+   0x7fff, 0x8af7, 0xffff, 0x8001, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffeb, 0x2fff, 0xfff8, 0xffff, 0x0fff, 0xffff, 0x4bff,
+   0xfffc, 0xf7ff, 0x0ffa, 0xffff, 0x8021, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffdf, 0xffff, 0xffff, 0xffff, 0x0fff, 0xffff,
+   0x0bff, 0xfff8, 0xffff, 0x0d57, 0xffff, 0x8001, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffff, 0xffff, 0xffff, 0x0fff,
+   0xffff, 0x19ff, 0xfff0, 0x57ff, 0x1bfd, 0xffff, 0x8021, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xfecf, 0xffff, 0xffff,
+   0x0fff, 0xffff, 0x0dff, 0xfff8, 0xffff, 0x0fab, 0xffff, 0xa021, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdd, 0xff8f, 0xffff,
+   0xffff, 0x0fff, 0xffff, 0x09ff, 0xfff0, 0xffff, 0x1dff, 0xfffe, 0xcd21,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0xfc80, 0xffcf,
+   0xffff, 0xdfff, 0x0fff, 0xffff, 0x11ff, 0xfff0, 0xffff, 0xbfff, 0xfffe,
+   0xe1d9, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x3fff, 0xfc00,
+   0xffff, 0xffff, 0xefff, 0x0fff, 0xffff, 0x28ff, 0xffe0, 0xffff, 0xffff,
+   0xffff, 0xc4e1, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0fff,
+   0xfc00, 0xffff, 0xffff, 0xb7ff, 0x0fff, 0xffff, 0x10ff, 0xffe0, 0xffff,
+   0xffff, 0xffff, 0xc2b3, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0x03ff, 0xfc00, 0xffff, 0xffff, 0xd7ff, 0x0fff, 0xffff, 0xd8ff, 0xffe1,
+   0xffff, 0xffff, 0xffff, 0xe173, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xc3ff, 0xfc02, 0xffff, 0xffff, 0x7fff, 0x0fff, 0xffff, 0xf8ff,
+   0xfff5, 0xffff, 0xffff, 0xffff, 0xe563, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xfc01, 0xffff, 0xffff, 0xffff, 0x0fff, 0xffff,
+   0xf9ff, 0xfffc, 0xffff, 0xffff, 0xffff, 0xe6e7, 0xffff, 0xffff, 0xffff,
+   0xfeff, 0xffff, 0xffff, 0xffff, 0xfc07, 0xffff, 0x7fff, 0x7fff, 0x0fff,
+   0xfffe, 0x71ff, 0xfffd, 0xffff, 0xffff, 0xffff, 0xf727, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xbc02, 0xffff, 0xffff, 0x5fff,
+   0x0fff, 0xffff, 0xc3ff, 0xfffc, 0xffff, 0xffff, 0xffff, 0xfa0f, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xfc26, 0xffff, 0xffff,
+   0xbfff, 0x0fff, 0xffff, 0xe3ff, 0xfffc, 0xffff, 0xffff, 0xffff, 0xfc0f,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x5ffe, 0xfca3, 0xffff,
+   0xffff, 0xffff, 0x0fff, 0xffff, 0x07ff, 0xfffe, 0xffff, 0xffff, 0xffff,
+   0xfe1f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x1dfe, 0xfeb7,
+   0xffff, 0xffff, 0xffff, 0x0fff, 0xfffe, 0xbfff, 0xffff, 0xffff, 0xffdf,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0x7bfe,
+   0xfeda, 0xfeff, 0xffff, 0xffff, 0x0fff, 0xfffe, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xfbff, 0xffff, 0xffff, 0xffff, 0x7fff,
+   0x52fe, 0xfc15, 0xfe7f, 0xffdf, 0xffff, 0x0fff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xefff, 0xffff, 0xffff, 0xffff,
+   0xbfff, 0xa9fe, 0xfd6a, 0xffbf, 0xfffb, 0xffff, 0x0fff, 0xffef, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xefff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0x05fe, 0xfc05, 0x7f3f, 0xbfe4, 0xffff, 0x0fff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffdf, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0x7fff, 0x52af, 0xa150, 0x292a, 0xaa15, 0xa952, 0x0aaa,
+   0xffff, 0xffff, 0xffff, 0xffef, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xaabf, 0x56ad, 0xd6d5, 0x55ea, 0xef7d,
+   0x0ff6, 0xebd5, 0xfffe, 0xffff, 0xfff3, 0xffff, 0xfef7, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7ddf, 0xb5db, 0xbb7d, 0xfeaf,
+   0xffaf, 0x0f5f, 0x0850, 0x8000, 0xaaaa, 0xfff5, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xfffe, 0xffff, 0xafaf, 0x6ffd, 0xedab,
+   0xdff5, 0xf7ff, 0x0dff, 0x814a, 0x0000, 0x0000, 0x0000, 0xd500, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0x57ff, 0xfffd, 0xffff, 0xff75, 0xd556,
+   0xb6dd, 0xed5f, 0xffff, 0x0f5f, 0x2a25, 0x008a, 0x0000, 0x0000, 0x0000,
+   0x0000, 0xa920, 0xffee, 0xffff, 0xffff, 0x57ff, 0xfffa, 0xffff, 0x57af,
+   0x7555, 0xdb6a, 0xbb6a, 0xffba, 0x0eff, 0x8152, 0x8000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x2000, 0xff55, 0xafff, 0xfeaa, 0xffff,
+   0x54ff, 0xd557, 0x76d4, 0xfd6f, 0xffef, 0x0fff, 0x142d, 0x0080, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x4248, 0xeb2b, 0xff7a, 0xffff, 0x0fff, 0xa111, 0x0002,
+   0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa400, 0x0ffb, 0x0254,
+   0x4108, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0821, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2002,
+   0x0aa0, 0x4288, 0x000a, 0x4000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x8810, 0x0000, 0x8844, 0x0102, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x2000, 0x0955, 0x252a, 0x9028, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0400, 0x1095, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0a50, 0x0a12, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0884, 0x110a, 0x8000, 0x0008,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x8011, 0x0018, 0x4a15, 0x122a,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0x5548, 0x0541, 0x124a,
+   0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0800, 0x0aaa,
+   0x4829, 0x50a1, 0x0000, 0x8400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010,
+   0x0504, 0x048a, 0x0105, 0x0200, 0x2000, 0x0000, 0x0200, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080,
+   0x9000, 0x0080, 0x8141, 0x0010, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x4000, 0x0400, 0x6a8a, 0x0521, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0004, 0x0095, 0x2042, 0x000a, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x4000, 0x1000, 0x0000, 0x0000, 0x0080, 0x8505, 0x9144, 0x0100, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0250, 0x0128, 0x5054, 0x0820, 0x4010,
+   0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa000, 0x0484, 0x0a85, 0x0142,
+   0x0200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0200, 0x2212,
+   0x5285, 0x0800, 0x0040, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x00a0, 0x0000, 0x00a8,
+   0xa892, 0x0520, 0x0000, 0x0896, 0x0000, 0x0080, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000,
+   0x0802, 0x0169, 0x4085, 0x080b, 0x1008, 0x0500, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000,
+   0x0014, 0x0048, 0x0aab, 0x0151, 0x0200, 0x0000, 0x8000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0040, 0x0955, 0xa555, 0xc000, 0x0404, 0x0000, 0x0000, 0x0080,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x4400, 0x5001, 0x0400, 0x0221, 0x94aa, 0x2122, 0x0201, 0x0050, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x8000, 0x0000, 0x1140, 0x0a80, 0x4951, 0x0554, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0100, 0xa000, 0x0084, 0x128a, 0x0000, 0x1400,
+   0x0000, 0x0400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x4400, 0x0200, 0x00a1, 0x1512, 0x6909,
+   0x8207, 0x0401, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x8400, 0x0514, 0x2aaa,
+   0x94a5, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0100, 0x0000, 0x0201, 0x0802 };


[05/50] [abbrv] commons-imaging git commit: Don't need to nest.

Posted by ch...@apache.org.
Don't need to nest.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775875 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/c0679967
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/c0679967
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/c0679967

Branch: refs/heads/master
Commit: c067996713d072e73ff2b61e22a29a2a9e9a28e0
Parents: 04aaa4b
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:17:18 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:17:18 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/commons/imaging/formats/tiff/TiffReader.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/c0679967/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
index a259b59..0625f33 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
@@ -144,9 +144,8 @@ public class TiffReader extends BinaryFileParser {
             } catch (final IOException e) {
                 if (strict) {
                     throw e;
-                } else {
-                    return true;
                 }
+                return true;
             }
 
             for (int i = 0; i < entryCount; i++) {


[15/50] [abbrv] commons-imaging git commit: Add final modifier to private fields.

Posted by ch...@apache.org.
Add final modifier to private fields.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775887 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/b2325327
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/b2325327
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/b2325327

Branch: refs/heads/master
Commit: b23253278ce0c42f83d7ea652a907f0e2cb8ff15
Parents: eb8be12
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:50:54 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:50:54 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/commons/imaging/formats/pnm/PbmWriter.java     | 2 +-
 .../java/org/apache/commons/imaging/formats/pnm/PgmWriter.java     | 2 +-
 .../java/org/apache/commons/imaging/formats/pnm/PpmWriter.java     | 2 +-
 .../imaging/formats/psd/datareaders/CompressedDataReader.java      | 2 +-
 .../imaging/formats/psd/datareaders/UncompressedDataReader.java    | 2 +-
 .../java/org/apache/commons/imaging/common/RationalNumberTest.java | 2 +-
 .../commons/imaging/common/bytesource/ByteSourceDataTest.java      | 2 +-
 .../commons/imaging/common/bytesource/ByteSourceImageTest.java     | 2 +-
 .../java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java   | 2 +-
 .../java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java   | 2 +-
 .../java/org/apache/commons/imaging/formats/gif/GifReadTest.java   | 2 +-
 .../java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java | 2 +-
 .../java/org/apache/commons/imaging/formats/ico/IcoReadTest.java   | 2 +-
 .../java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java | 2 +-
 .../org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java | 2 +-
 .../java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java | 2 +-
 .../commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java     | 2 +-
 .../imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java    | 2 +-
 .../org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java  | 2 +-
 .../org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java | 2 +-
 .../apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java   | 2 +-
 .../apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java   | 2 +-
 .../commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java       | 2 +-
 23 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java
index ae32866..088a038 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java
@@ -25,7 +25,7 @@ import org.apache.commons.imaging.ImageWriteException;
 
 class PbmWriter implements PnmWriter {
 
-    private boolean rawbits;
+    private final boolean rawbits;
 
     PbmWriter(final boolean rawbits) {
         this.rawbits = rawbits;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
index 9457c61..e46f672 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
@@ -25,7 +25,7 @@ import org.apache.commons.imaging.ImageWriteException;
 
 class PgmWriter implements PnmWriter {
 
-    private boolean rawbits;
+    private final boolean rawbits;
 
     public PgmWriter(boolean rawbits) {
         this.rawbits = rawbits;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
index 3cf0a4d..ef54269 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
@@ -25,7 +25,7 @@ import org.apache.commons.imaging.ImageWriteException;
 
 class PpmWriter implements PnmWriter {
 
-    private boolean rawbits;
+    private final boolean rawbits;
 
     public PpmWriter(boolean rawbits) {
         this.rawbits = rawbits;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
index 6f9d46c..95d3054 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
@@ -34,7 +34,7 @@ import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
 
 public class CompressedDataReader implements DataReader {
 
-    private DataParser dataParser;
+    private final DataParser dataParser;
 
     public CompressedDataReader(final DataParser dataParser) {
         this.dataParser = dataParser;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
index 048e926..6261656 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
@@ -31,7 +31,7 @@ import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
 
 public class UncompressedDataReader implements DataReader {
 
-    private DataParser dataParser;
+    private final DataParser dataParser;
 
     public UncompressedDataReader(final DataParser dataParser) {
         this.dataParser = dataParser;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java b/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
index e8555a0..c3d4d21 100644
--- a/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
@@ -30,7 +30,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class RationalNumberTest extends ImagingTest {
 
-    private double testValue;
+    private final double testValue;
 
     @Parameterized.Parameters
     public static Collection<Double> data() {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
index 1070b65..f4fdddb 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
@@ -36,7 +36,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class ByteSourceDataTest extends ByteSourceTest {
 
-    private byte[] testByteArray;
+    private final byte[] testByteArray;
 
     @Parameterized.Parameters
     public static Collection<byte[]> data() {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
index 74ed42c..d296eca 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
@@ -47,7 +47,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class ByteSourceImageTest extends ByteSourceTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
index d17e3af..43c6348 100644
--- a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
@@ -37,7 +37,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class BmpReadTest extends BmpBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
index bcddec6..8201880 100644
--- a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
@@ -33,7 +33,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class DcxReadTest extends DcxBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java b/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
index 7bbd0a0..ae30b9e 100644
--- a/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
@@ -33,7 +33,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class GifReadTest extends GifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
index c67568f..adcd6d1 100644
--- a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
@@ -35,7 +35,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class IcnsReadTest extends IcnsBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
index f9470f3..3230894 100644
--- a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
@@ -33,7 +33,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class IcoReadTest extends IcoBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
index 878aaeb..35754e7 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
@@ -39,7 +39,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class JpegReadTest extends JpegBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception{

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
index 4f0e0e2..7fa78f9 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
@@ -38,7 +38,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class ExifDumpTest extends ExifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
index f6d2af1..b2c34c7 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
@@ -34,7 +34,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class GpsTest extends ExifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
index a40e389..728f81c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
@@ -39,7 +39,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public abstract class SpecificExifTagTest extends ExifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
index e01cd13..09f4664 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
@@ -29,7 +29,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class WriteExifMetadataExampleTest extends ExifBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
index 5af2d49..b467fc7 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
@@ -42,7 +42,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class IptcAddTest extends IptcBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
index dbd16ef..4e17f40 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
@@ -37,7 +37,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class IptcDumpTest extends IptcBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
index 0f3d70f..4f17c8d 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
@@ -44,7 +44,7 @@ import org.junit.runners.Parameterized;
 
 @RunWith(Parameterized.class)
 public class IptcUpdateTest extends IptcBaseTest {
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
index 74102a7..96e9c08 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
@@ -34,7 +34,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class JpegXmpDumpTest extends JpegXmpBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b2325327/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
index 8ba41a7..74e0b42 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
@@ -39,7 +39,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class JpegXmpRewriteTest extends JpegXmpBaseTest {
 
-    private File imageFile;
+    private final File imageFile;
 
     @Parameterized.Parameters
     public static Collection<File> data() throws Exception {


[41/50] [abbrv] commons-imaging git commit: Use constants defined in StandardCharsets instead of loading Charset by name

Posted by ch...@apache.org.
Use constants defined in StandardCharsets instead of loading Charset by name

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795456 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/f50e85c1
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/f50e85c1
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/f50e85c1

Branch: refs/heads/master
Commit: f50e85c11120b664ceea185e9932ec557b61c0c3
Parents: 6d048e6
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:05:42 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:05:42 2017 +0000

----------------------------------------------------------------------
 .../apache/commons/imaging/formats/pnm/PnmImageParserTest.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f50e85c1/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java b/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
index 31a61ce..693be92 100644
--- a/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.imaging.formats.pnm;
 
 import java.io.IOException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Map;
 
@@ -29,7 +30,7 @@ import static org.junit.Assert.assertEquals;
 
 public class PnmImageParserTest {
 
-    private static final Charset US_ASCII = Charset.forName("US-ASCII");
+    private static final Charset US_ASCII = StandardCharsets.US_ASCII;
 
     @Test
     public void testGetImageInfo_happyCase() throws ImageReadException, IOException {


[20/50] [abbrv] commons-imaging git commit: Use try with resources.

Posted by ch...@apache.org.
Use try with resources.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775900 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/df7e6672
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/df7e6672
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/df7e6672

Branch: refs/heads/master
Commit: df7e6672f089706eabb7fcd2e7e27bb8e4d253a1
Parents: c3c8838
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 21:26:48 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 21:26:48 2016 +0000

----------------------------------------------------------------------
 .../tiff/datareaders/DataReaderStrips.java      | 36 ++++++++++----------
 1 file changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/df7e6672/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
index ee632e9..3878b26 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
@@ -166,28 +166,28 @@ public final class DataReaderStrips extends ImageDataReader {
         // this logic will handle all cases not conforming to the
         // special case handled above
 
-        final BitInputStream bis = new BitInputStream(new ByteArrayInputStream(bytes), byteOrder);
+        try (final BitInputStream bis = new BitInputStream(new ByteArrayInputStream(bytes), byteOrder)) {
 
-        int[] samples = new int[bitsPerSampleLength];
-        resetPredictor();
-        for (int i = 0; i < pixelsPerStrip; i++) {
-            getSamplesAsBytes(bis, samples);
+            int[] samples = new int[bitsPerSampleLength];
+            resetPredictor();
+            for (int i = 0; i < pixelsPerStrip; i++) {
+                getSamplesAsBytes(bis, samples);
 
-            if (x < width) {
-                samples = applyPredictor(samples);
+                if (x < width) {
+                    samples = applyPredictor(samples);
 
-                photometricInterpreter.interpretPixel(
-                        imageBuilder, samples, x,  y);
-            }
+                    photometricInterpreter.interpretPixel(imageBuilder, samples, x, y);
+                }
 
-            x++;
-            if (x >= width) {
-                x = 0;
-                resetPredictor();
-                y++;
-                bis.flushCache();
-                if (y >= yLimit) {
-                    break;
+                x++;
+                if (x >= width) {
+                    x = 0;
+                    resetPredictor();
+                    y++;
+                    bis.flushCache();
+                    if (y >= yLimit) {
+                        break;
+                    }
                 }
             }
         }


[43/50] [abbrv] commons-imaging git commit: Update to latest commons-parent pom

Posted by ch...@apache.org.
Update to latest commons-parent pom

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795458 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/18049288
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/18049288
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/18049288

Branch: refs/heads/master
Commit: 180492888462dbecf45d58a0200da7595cc4630e
Parents: 8a3843f
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:18:14 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:18:14 2017 +0000

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/18049288/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 820e77b..03326f2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-parent</artifactId>
-    <version>40</version>
+    <version>42</version>
   </parent>
 
   <groupId>org.apache.commons</groupId>


[45/50] [abbrv] commons-imaging git commit: Inline local variable

Posted by ch...@apache.org.
Inline local variable

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795460 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/2e8379b5
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/2e8379b5
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/2e8379b5

Branch: refs/heads/master
Commit: 2e8379b55611ce891b968c2daa3ada4f8952188b
Parents: 5d89c42
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:27:55 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:27:55 2017 +0000

----------------------------------------------------------------------
 src/main/java/org/apache/commons/imaging/Imaging.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/2e8379b5/src/main/java/org/apache/commons/imaging/Imaging.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java
index ec8a74d..3fbb2c9 100644
--- a/src/main/java/org/apache/commons/imaging/Imaging.java
+++ b/src/main/java/org/apache/commons/imaging/Imaging.java
@@ -169,8 +169,7 @@ public final class Imaging {
 
         String normalizedFilename = filename.toLowerCase(Locale.ENGLISH);
 
-        final ImageParser[] imageParsers = ImageParser.getAllImageParsers();
-        for (final ImageParser imageParser : imageParsers) {
+        for (final ImageParser imageParser : ImageParser.getAllImageParsers()) {
             final String[] exts = imageParser.getAcceptedExtensions();
 
             for (final String ext : exts) {


[44/50] [abbrv] commons-imaging git commit: Don't reassign method parameters

Posted by ch...@apache.org.
Don't reassign method parameters

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795459 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/5d89c428
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/5d89c428
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/5d89c428

Branch: refs/heads/master
Commit: 5d89c428925ab9e72032843c879bb30c0260bdba
Parents: 1804928
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:27:03 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:27:03 2017 +0000

----------------------------------------------------------------------
 src/main/java/org/apache/commons/imaging/Imaging.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/5d89c428/src/main/java/org/apache/commons/imaging/Imaging.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java
index fc3a5d1..ec8a74d 100644
--- a/src/main/java/org/apache/commons/imaging/Imaging.java
+++ b/src/main/java/org/apache/commons/imaging/Imaging.java
@@ -162,19 +162,19 @@ public final class Imaging {
      * which may contain an image.
      * @return true if the filename has an image format file extension.
      */
-    public static boolean hasImageFileExtension(String filename) {
+    public static boolean hasImageFileExtension(final String filename) {
         if (filename == null) {
             return false;
         }
-        
-        filename = filename.toLowerCase(Locale.ENGLISH);
+
+        String normalizedFilename = filename.toLowerCase(Locale.ENGLISH);
 
         final ImageParser[] imageParsers = ImageParser.getAllImageParsers();
         for (final ImageParser imageParser : imageParsers) {
             final String[] exts = imageParser.getAcceptedExtensions();
 
             for (final String ext : exts) {
-                if (filename.endsWith(ext.toLowerCase(Locale.ENGLISH))) {
+                if (normalizedFilename.endsWith(ext.toLowerCase(Locale.ENGLISH))) {
                     return true;
                 }
             }


[18/50] [abbrv] commons-imaging git commit: Add final modifier to local variables.

Posted by ch...@apache.org.
Add final modifier to local variables.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775889 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/38c8705a
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/38c8705a
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/38c8705a

Branch: refs/heads/master
Commit: 38c8705afebec5b0ceb5e32c6f395fa5774bc2b2
Parents: 56e0133
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:59:18 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:59:18 2016 +0000

----------------------------------------------------------------------
 .../commons/imaging/color/ColorCieLab.java      |  2 +-
 .../commons/imaging/color/ColorCieLch.java      |  2 +-
 .../commons/imaging/color/ColorCieLuv.java      |  2 +-
 .../apache/commons/imaging/color/ColorCmy.java  |  2 +-
 .../apache/commons/imaging/color/ColorCmyk.java |  2 +-
 .../apache/commons/imaging/color/ColorHsl.java  |  2 +-
 .../apache/commons/imaging/color/ColorHsv.java  |  2 +-
 .../commons/imaging/color/ColorHunterLab.java   |  2 +-
 .../apache/commons/imaging/color/ColorXyz.java  |  2 +-
 .../common/itu_t4/T4AndT6Compression.java       |  4 +--
 .../imaging/formats/gif/GifImageParser.java     |  6 ++--
 .../imaging/formats/jpeg/JpegImageMetadata.java |  6 ++--
 .../imaging/formats/jpeg/JpegImageParser.java   | 12 +++----
 .../formats/jpeg/JpegPhotoshopMetadata.java     |  2 +-
 .../imaging/formats/jpeg/iptc/IptcParser.java   |  6 ++--
 .../formats/jpeg/iptc/JpegIptcRewriter.java     |  4 +--
 .../formats/jpeg/iptc/PhotoshopApp13Data.java   |  2 +-
 .../imaging/formats/jpeg/xmp/JpegRewriter.java  |  4 +--
 .../commons/imaging/formats/png/ChunkType.java  |  4 +--
 .../imaging/formats/png/PngColorType.java       |  2 +-
 .../imaging/formats/png/PngImageParser.java     | 18 +++++-----
 .../commons/imaging/formats/png/PngWriter.java  |  4 +--
 .../imaging/formats/png/ScanExpediter.java      |  2 +-
 .../formats/png/chunks/PngChunkIhdr.java        |  4 +--
 .../formats/png/chunks/PngChunkScal.java        |  2 +-
 .../scanlinefilters/ScanlineFilterPaeth.java    |  2 +-
 .../TransparencyFilterGrayscale.java            |  2 +-
 .../TransparencyFilterTrueColor.java            |  8 ++---
 .../imaging/formats/pnm/PnmImageParser.java     |  4 +--
 .../imaging/formats/psd/ImageResourceType.java  |  2 +-
 .../imaging/formats/tiff/TiffContents.java      |  8 ++---
 .../imaging/formats/tiff/TiffDirectory.java     | 10 +++---
 .../imaging/formats/tiff/TiffImageMetadata.java | 16 ++++-----
 .../imaging/formats/tiff/TiffImageParser.java   | 18 +++++-----
 .../commons/imaging/formats/tiff/TiffTags.java  | 10 +++---
 .../formats/tiff/write/TiffImageWriterBase.java |  4 +--
 .../tiff/write/TiffImageWriterLossless.java     |  6 ++--
 .../tiff/write/TiffImageWriterLossy.java        |  4 +--
 .../formats/tiff/write/TiffOutputDirectory.java | 12 +++----
 .../formats/tiff/write/TiffOutputSet.java       | 10 +++---
 .../formats/tiff/write/TiffOutputSummary.java   |  4 +--
 .../imaging/formats/xbm/XbmImageParser.java     |  8 ++---
 .../commons/imaging/icc/IccProfileParser.java   |  4 +--
 .../commons/imaging/palette/ColorGroup.java     |  4 +--
 .../imaging/palette/LongestAxisMedianCut.java   |  4 +--
 .../palette/MostPopulatedBoxesMedianCut.java    |  2 +-
 .../commons/imaging/palette/PaletteFactory.java |  8 ++---
 .../org/apache/commons/imaging/util/Debug.java  |  2 +-
 .../commons/imaging/ImagingGuessFormatTest.java |  2 +-
 .../common/bytesource/ByteSourceImageTest.java  |  2 +-
 .../formats/jpeg/exif/AsciiFieldTest.java       |  2 +-
 .../formats/jpeg/exif/MicrosoftTagTest.java     | 10 +++---
 .../imaging/formats/jpeg/iptc/IptcAddTest.java  |  2 +-
 .../formats/jpeg/iptc/IptcFullDiscardTest.java  | 26 +++++++-------
 .../imaging/formats/png/PngTextTest.java        |  2 +-
 .../imaging/formats/pnm/PnmImageParserTest.java | 26 +++++++-------
 .../imaging/formats/tiff/TiffLzwTest.java       | 10 +++---
 .../formats/tiff/TiffReadWriteTagsTest.java     | 38 ++++++++++----------
 .../imaging/formats/tiff/TiffRoundtripTest.java |  2 +-
 .../imaging/formats/tiff/TiffSubImageTest.java  |  8 ++---
 .../formats/tiff/TiffTagIntegrityTest.java      |  4 +--
 .../tiff/write/TiffOutputDirectoryTest.java     |  4 +--
 .../formats/tiff/write/TiffOutputSetTest.java   |  2 +-
 .../palette/PaletteQuantizationTest.java        | 16 ++++-----
 .../roundtrip/GrayscaleRountripTest.java        |  2 +-
 .../roundtrip/NullParametersRoundtripTest.java  |  2 +-
 66 files changed, 206 insertions(+), 206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java b/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
index e9167f2..5e1ad64 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
@@ -92,7 +92,7 @@ public final class ColorCieLab {
             return false;
         }
 
-        ColorCieLab that = (ColorCieLab) o;
+        final ColorCieLab that = (ColorCieLab) o;
         if (Double.compare(that.L, L) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java b/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
index 8c9314a..77be4dd 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
@@ -92,7 +92,7 @@ public final class ColorCieLch {
             return false;
         }
 
-        ColorCieLch that = (ColorCieLch) o;
+        final ColorCieLch that = (ColorCieLch) o;
         if (Double.compare(that.C, C) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java b/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
index 456aa36..da96e88 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
@@ -92,7 +92,7 @@ public final class ColorCieLuv {
             return false;
         }
 
-        ColorCieLuv that = (ColorCieLuv) o;
+        final ColorCieLuv that = (ColorCieLuv) o;
         if (Double.compare(that.L, L) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCmy.java b/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
index 15a1483..f2e8281 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
@@ -122,7 +122,7 @@ public final class ColorCmy {
             return false;
         }
 
-        ColorCmy colorCmy = (ColorCmy) o;
+        final ColorCmy colorCmy = (ColorCmy) o;
         if (Double.compare(colorCmy.C, C) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java b/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
index 15e1858..6c2b29c 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
@@ -132,7 +132,7 @@ public final class ColorCmyk {
             return false;
         }
 
-        ColorCmyk colorCmyk = (ColorCmyk) o;
+        final ColorCmyk colorCmyk = (ColorCmyk) o;
         if (Double.compare(colorCmyk.C, C) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorHsl.java b/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
index c08b3d8..00f645d 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
@@ -92,7 +92,7 @@ public final class ColorHsl {
             return false;
         }
 
-        ColorHsl colorHsl = (ColorHsl) o;
+        final ColorHsl colorHsl = (ColorHsl) o;
         if (Double.compare(colorHsl.H, H) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorHsv.java b/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
index 4e2b63a..6dd1fa1 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
@@ -92,7 +92,7 @@ public final class ColorHsv {
             return false;
         }
 
-        ColorHsv colorHsv = (ColorHsv) o;
+        final ColorHsv colorHsv = (ColorHsv) o;
         if (Double.compare(colorHsv.H, H) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java b/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
index ee719d8..4a0e482 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
@@ -92,7 +92,7 @@ public final class ColorHunterLab {
             return false;
         }
 
-        ColorHunterLab that = (ColorHunterLab) o;
+        final ColorHunterLab that = (ColorHunterLab) o;
         if (Double.compare(that.L, L) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorXyz.java b/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
index 68491e2..629edfe 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
@@ -92,7 +92,7 @@ public final class ColorXyz {
             return false;
         }
 
-        ColorXyz colorXyz = (ColorXyz) o;
+        final ColorXyz colorXyz = (ColorXyz) o;
         if (Double.compare(colorXyz.X, X) != 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java b/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
index 79f67fd..96169d8 100644
--- a/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
+++ b/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
@@ -212,7 +212,7 @@ public final class T4AndT6Compression {
             for (int y = 0; y < height; y++) {
                 int rowLength;
                 try {
-                    T4_T6_Tables.Entry entry = CONTROL_CODES.decode(inputStream);
+                    final T4_T6_Tables.Entry entry = CONTROL_CODES.decode(inputStream);
                     if (!isEOL(entry, hasFill)) {
                         throw new ImageReadException("Expected EOL not found");
                     }
@@ -560,7 +560,7 @@ public final class T4AndT6Compression {
                 for (int a0 = 0; a0 < width;) {
                     int a1;
                     int a2;
-                    T4_T6_Tables.Entry  entry = CONTROL_CODES.decode(inputStream);
+                    final T4_T6_Tables.Entry  entry = CONTROL_CODES.decode(inputStream);
                     if (entry == T4_T6_Tables.P) {
                         fillRange(outputStream, referenceLine, a0, b2, codingA0Color);
                         a0 = b2;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
index 993fa08..ae23539 100644
--- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
@@ -427,7 +427,7 @@ public class GifImageParser extends ImageParser {
     }
 
     private GifBlock findBlock(final List<GifBlock> blocks, final int code) {
-        for (GifBlock gifBlock : blocks) {
+        for (final GifBlock gifBlock : blocks) {
             if (gifBlock.blockCode == code) {
                 return gifBlock;
             }
@@ -505,7 +505,7 @@ public class GifImageParser extends ImageParser {
         final List<String> result = new ArrayList<>();
         final int code = 0x21fe;
 
-        for (GifBlock block : blocks) {
+        for (final GifBlock block : blocks) {
             if (block.blockCode == code) {
                 final byte[] bytes = ((GenericGifBlock) block).appendSubBlocks();
                 result.add(new String(bytes, "US-ASCII"));
@@ -1014,7 +1014,7 @@ public class GifImageParser extends ImageParser {
             final List<GifBlock> blocks = readBlocks(ghi, is, true, formatCompliance);
 
             final List<String> result = new ArrayList<>();
-            for (GifBlock block : blocks) {
+            for (final GifBlock block : blocks) {
                 if (block.blockCode != XMP_COMPLETE_CODE) {
                     continue;
                 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
index 4dc2a62..f0816a6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
@@ -100,7 +100,7 @@ public class JpegImageMetadata implements ImageMetadata {
             return null;
         }
         final List<? extends ImageMetadataItem> dirs = exif.getDirectories();
-        for (ImageMetadataItem d : dirs) {
+        for (final ImageMetadataItem d : dirs) {
             final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) d;
 
             byte[] data = null;
@@ -132,7 +132,7 @@ public class JpegImageMetadata implements ImageMetadata {
         }
 
         final List<? extends ImageMetadataItem> dirs = exif.getDirectories();
-        for (ImageMetadataItem d : dirs) {
+        for (final ImageMetadataItem d : dirs) {
             final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) d;
             // Debug.debug("dir", dir);
             BufferedImage image = dir.getThumbnail();
@@ -172,7 +172,7 @@ public class JpegImageMetadata implements ImageMetadata {
             return null;
         }
         final List<? extends ImageMetadataItem> dirs = exif.getDirectories();
-        for (ImageMetadataItem d : dirs) {
+        for (final ImageMetadataItem d : dirs) {
             final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) d;
             // Debug.debug("dir", dir);
             final TiffImageData rawImageData = dir.getTiffImageData();

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
index 6b11c3a..bcd54f2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
@@ -202,7 +202,7 @@ public class JpegImageParser extends ImageParser {
     private byte[] assembleSegments(final List<App2Segment> segments) throws ImageReadException {
         try {
             return assembleSegments(segments, false);
-        } catch (ImageReadException e) {
+        } catch (final ImageReadException e) {
             return assembleSegments(segments, true);
         }
     }
@@ -250,7 +250,7 @@ public class JpegImageParser extends ImageParser {
         final byte[] result = new byte[total];
         int progress = 0;
 
-        for (App2Segment segment : segments) {
+        for (final App2Segment segment : segments) {
             System.arraycopy(segment.getIccBytes(), 0, result, progress, segment.getIccBytes().length);
             progress += segment.getIccBytes().length;
         }
@@ -284,7 +284,7 @@ public class JpegImageParser extends ImageParser {
         final List<App2Segment> filtered = new ArrayList<>();
         if (segments != null) {
             // throw away non-icc profile app2 segments.
-            for (Segment s : segments) {
+            for (final Segment s : segments) {
                 final App2Segment segment = (App2Segment) s;
                 if (segment.getIccBytes() != null) {
                     filtered.add(segment);
@@ -331,7 +331,7 @@ public class JpegImageParser extends ImageParser {
     private List<Segment> filterAPP1Segments(final List<Segment> segments) {
         final List<Segment> result = new ArrayList<>();
 
-        for (Segment s : segments) {
+        for (final Segment s : segments) {
             final GenericSegment segment = (GenericSegment) s;
             if (isExifAPP1Segment(segment)) {
                 result.add(segment);
@@ -593,7 +593,7 @@ public class JpegImageParser extends ImageParser {
 
         PhotoshopApp13Data photoshopApp13Data = null;
 
-        for (Segment s : segments) {
+        for (final Segment s : segments) {
             final App13Segment segment = (App13Segment) s;
 
             final PhotoshopApp13Data data = segment.parsePhotoshopSegment(params);
@@ -793,7 +793,7 @@ public class JpegImageParser extends ImageParser {
         final List<String> comments = new ArrayList<>();
         final List<Segment> commentSegments = readSegments(byteSource,
                 new int[] { JpegConstants.COM_MARKER}, false);
-        for (Segment commentSegment : commentSegments) {
+        for (final Segment commentSegment : commentSegments) {
             final ComSegment comSegment = (ComSegment) commentSegment;
             String comment = "";
             try {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java
index cb8c710..802d164 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegPhotoshopMetadata.java
@@ -34,7 +34,7 @@ public class JpegPhotoshopMetadata extends GenericImageMetadata {
 
         final List<IptcRecord> records = photoshopApp13Data.getRecords();
         Collections.sort(records, IptcRecord.COMPARATOR);
-        for (IptcRecord element : records) {
+        for (final IptcRecord element : records) {
             if (element.iptcType != IptcTypes.RECORD_VERSION) {
                 add(element.getIptcTypeName(), element.getValue());
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
index 4825da4..7e5d687 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
@@ -114,7 +114,7 @@ public class IptcParser extends BinaryFileParser {
 
         final List<IptcBlock> blocks = parseAllBlocks(bytes, verbose, strict);
 
-        for (IptcBlock block : blocks) {
+        for (final IptcBlock block : blocks) {
             // Ignore everything but IPTC data.
             if (!block.isIPTCBlock()) {
                 continue;
@@ -357,7 +357,7 @@ public class IptcParser extends BinaryFileParser {
         JpegConstants.PHOTOSHOP_IDENTIFICATION_STRING.writeTo(bos);
 
         final List<IptcBlock> blocks = data.getRawBlocks();
-        for (IptcBlock block : blocks) {
+        for (final IptcBlock block : blocks) {
             bos.write4Bytes(JpegConstants.CONST_8BIM);
 
             if (block.blockType < 0 || block.blockType > 0xffff) {
@@ -419,7 +419,7 @@ public class IptcParser extends BinaryFileParser {
             // TODO: make sure order right
     
             // write the list.
-            for (IptcRecord element : elements) {
+            for (final IptcRecord element : elements) {
                 if (element.iptcType == IptcTypes.RECORD_VERSION) {
                     continue; // ignore
                 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
index dbc1c18..bd52215 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
@@ -300,8 +300,8 @@ public class JpegIptcRewriter extends JpegRewriter {
 
             newData = new PhotoshopApp13Data(newData.getRecords(), newBlocks);
 
-            byte[] segmentBytes = new IptcParser().writePhotoshopApp13Segment(newData);
-            JFIFPieceSegment newSegment = new JFIFPieceSegment(JpegConstants.JPEG_APP13_MARKER, segmentBytes);
+            final byte[] segmentBytes = new IptcParser().writePhotoshopApp13Segment(newData);
+            final JFIFPieceSegment newSegment = new JFIFPieceSegment(JpegConstants.JPEG_APP13_MARKER, segmentBytes);
 
             newPieces = insertAfterLastAppSegments(newPieces, Arrays.asList(newSegment));
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java
index f709a32..6d83564 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/PhotoshopApp13Data.java
@@ -40,7 +40,7 @@ public class PhotoshopApp13Data {
 
     public List<IptcBlock> getNonIptcBlocks() {
         final List<IptcBlock> result = new ArrayList<>();
-        for (IptcBlock block : rawBlocks) {
+        for (final IptcBlock block : rawBlocks) {
             if (!block.isIPTCBlock()) {
                 result.add(block);
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
index 99a2e70..1e1d2cc 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
@@ -251,7 +251,7 @@ public class JpegRewriter extends BinaryFileParser {
             final SegmentFilter filter, final boolean reverse) {
         final List<T> result = new ArrayList<>();
 
-        for (T piece : segments) {
+        for (final T piece : segments) {
             if (piece instanceof JFIFPieceSegment) {
                 if (filter.filter((JFIFPieceSegment) piece) ^ !reverse) {
                     result.add(piece);
@@ -322,7 +322,7 @@ public class JpegRewriter extends BinaryFileParser {
         try (DataOutputStream os = new DataOutputStream(outputStream)) {
             JpegConstants.SOI.writeTo(os);
 
-            for (JFIFPiece piece : segments) {
+            for (final JFIFPiece piece : segments) {
                 piece.write(os);
             }
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java b/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
index 0035bb7..cd48648 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
@@ -88,10 +88,10 @@ public enum ChunkType {
     final int value;
 
     private ChunkType() {
-        char[] chars = name().toCharArray();
+        final char[] chars = name().toCharArray();
         try {
             array = name().getBytes("UTF-8");
-        } catch (UnsupportedEncodingException e) {
+        } catch (final UnsupportedEncodingException e) {
             // will not happen since UTF-8 is one of the StandardCharsets of the Java platform
             throw new RuntimeException(e);
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
index 4be7660..a7b7b77 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
@@ -64,7 +64,7 @@ public enum PngColorType {
     }
 
     public static PngColorType getColorType(final int value) {
-        for (PngColorType type : values()) {
+        for (final PngColorType type : values()) {
             if (type.value == value) {
                 return type;
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
index 0dfa167..a9ab830 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
@@ -112,7 +112,7 @@ public class PngImageParser extends ImageParser {
             throws ImageReadException, IOException {
         final List<PngChunk> chunks = readChunks(is, null, false);
         final List<String> chunkTypes = new ArrayList<>();
-        for (PngChunk chunk : chunks) {
+        for (final PngChunk chunk : chunks) {
             chunkTypes.add(getChunkTypeName(chunk.chunkType));
         }
         return chunkTypes;
@@ -281,7 +281,7 @@ public class PngImageParser extends ImageParser {
 
         final GenericImageMetadata result = new GenericImageMetadata();
 
-        for (PngChunk chunk : chunks) {
+        for (final PngChunk chunk : chunks) {
             final PngTextChunk textChunk = (PngTextChunk) chunk;
 
             result.add(textChunk.getKeyword(), textChunk.getText());
@@ -293,7 +293,7 @@ public class PngImageParser extends ImageParser {
     private List<PngChunk> filterChunks(final List<PngChunk> chunks, final ChunkType type) {
         final List<PngChunk> result = new ArrayList<>();
 
-        for (PngChunk chunk : chunks) {
+        for (final PngChunk chunk : chunks) {
             if (chunk.chunkType == type.value) {
                 result.add(chunk);
             }
@@ -378,7 +378,7 @@ public class PngImageParser extends ImageParser {
             throw new ImageReadException("PNG contains more than one sCAL:"
                     + sCALs.size());
         } else if (sCALs.size() == 1) {
-            PngChunkScal pngChunkScal = (PngChunkScal) sCALs.get(0);
+            final PngChunkScal pngChunkScal = (PngChunkScal) sCALs.get(0);
             if (pngChunkScal.unitSpecifier == 1) {
                 physicalScale = PhysicalScale.createFromMeters(pngChunkScal.unitsPerPixelXAxis,
                       pngChunkScal.unitsPerPixelYAxis);
@@ -395,17 +395,17 @@ public class PngImageParser extends ImageParser {
         final List<String> comments = new ArrayList<>();
         final List<PngText> textChunks = new ArrayList<>();
 
-        for (PngChunk tEXt : tEXts) {
+        for (final PngChunk tEXt : tEXts) {
             final PngChunkText pngChunktEXt = (PngChunkText) tEXt;
             comments.add(pngChunktEXt.keyword + ": " + pngChunktEXt.text);
             textChunks.add(pngChunktEXt.getContents());
         }
-        for (PngChunk zTXt : zTXts) {
+        for (final PngChunk zTXt : zTXts) {
             final PngChunkZtxt pngChunkzTXt = (PngChunkZtxt) zTXt;
             comments.add(pngChunkzTXt.keyword + ": " + pngChunkzTXt.text);
             textChunks.add(pngChunkzTXt.getContents());
         }
-        for (PngChunk iTXt : iTXts) {
+        for (final PngChunk iTXt : iTXts) {
             final PngChunkItxt pngChunkiTXt = (PngChunkItxt) iTXt;
             comments.add(pngChunkiTXt.keyword + ": " + pngChunkiTXt.text);
             textChunks.add(pngChunkiTXt.getContents());
@@ -530,7 +530,7 @@ public class PngImageParser extends ImageParser {
         }
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        for (PngChunk IDAT : IDATs) {
+        for (final PngChunk IDAT : IDATs) {
             final PngChunkIdat pngChunkIDAT = (PngChunkIdat) IDAT;
             final byte[] bytes = pngChunkIDAT.getBytes();
             // System.out.println(i + ": bytes: " + bytes.length);
@@ -717,7 +717,7 @@ public class PngImageParser extends ImageParser {
         }
 
         final List<PngChunkItxt> xmpChunks = new ArrayList<>();
-        for (PngChunk chunk : chunks) {
+        for (final PngChunk chunk : chunks) {
             final PngChunkItxt itxtChunk = (PngChunkItxt) chunk;
             if (!itxtChunk.getKeyword().equals(PngConstants.XMP_KEYWORD)) {
                 continue;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
index 2589a14..f08f882 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
@@ -312,7 +312,7 @@ class PngWriter {
     private byte getBitDepth(final PngColorType pngColorType, final Map<String, Object> params) {
         byte depth = 8;
 
-        Object o = params.get(PngConstants.PARAM_KEY_PNG_BIT_DEPTH);
+        final Object o = params.get(PngConstants.PARAM_KEY_PNG_BIT_DEPTH);
         if (o instanceof Number) {
             depth = ((Number) o).byteValue();
         }
@@ -543,7 +543,7 @@ class PngWriter {
 
         if (params.containsKey(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS)) {
             final List<?> outputTexts = (List<?>) params.get(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS);
-            for (Object outputText : outputTexts) {
+            for (final Object outputText : outputTexts) {
                 final PngText text = (PngText) outputText;
                 if (text instanceof PngText.Text) {
                     writeChunktEXt(os, (PngText.Text) text);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
index 4d58f79..df119d1 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
@@ -207,7 +207,7 @@ abstract class ScanExpediter {
             throw new ImageReadException("PNG: unknown filterType: " + filterType);
         }
 
-        byte[] scanline = readBytes("scanline", is, length, "PNG: missing image data");
+        final byte[] scanline = readBytes("scanline", is, length, "PNG: missing image data");
 
         return unfilterScanline(FilterType.values()[filterType], scanline, prev, bytesPerPixel);
     }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
index cb5ffab..a864202 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
@@ -41,14 +41,14 @@ public class PngChunkIhdr extends PngChunk {
         width = read4Bytes("Width", is, "Not a Valid Png File: IHDR Corrupt", getByteOrder());
         height = read4Bytes("Height", is, "Not a Valid Png File: IHDR Corrupt", getByteOrder());
         bitDepth = readByte("BitDepth", is, "Not a Valid Png File: IHDR Corrupt");
-        int type = readByte("ColorType", is, "Not a Valid Png File: IHDR Corrupt");
+        final int type = readByte("ColorType", is, "Not a Valid Png File: IHDR Corrupt");
         pngColorType = PngColorType.getColorType(type);
         if (pngColorType == null) {
             throw new ImageReadException("PNG: unknown color type: " + type);
         }
         compressionMethod = readByte("CompressionMethod", is, "Not a Valid Png File: IHDR Corrupt");
         filterMethod = readByte("FilterMethod", is, "Not a Valid Png File: IHDR Corrupt");
-        int method = readByte("InterlaceMethod", is, "Not a Valid Png File: IHDR Corrupt");
+        final int method = readByte("InterlaceMethod", is, "Not a Valid Png File: IHDR Corrupt");
         if (method < 0 && method >= InterlaceMethod.values().length) {
             throw new ImageReadException("PNG: unknown interlace method: " + method);
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
index 6de9c99..f4c8823 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
@@ -57,7 +57,7 @@ public class PngChunkScal extends PngChunk {
    private double toDouble(final String str) throws ImageReadException {
       try {
          return Double.valueOf(str);
-      } catch (NumberFormatException e) {
+      } catch (final NumberFormatException e) {
          throw new ImageReadException("PNG sCAL error reading axis value - " + str);
       }
    }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java
index 065303c..df66c5d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java
@@ -66,7 +66,7 @@ public class ScanlineFilterPaeth implements ScanlineFilter {
             }
             // upperleft = 255;
 
-            int paethPredictor = paethPredictor(0xff & left, 0xff & above, 0xff & upperleft);
+            final int paethPredictor = paethPredictor(0xff & left, 0xff & above, 0xff & upperleft);
 
             dst[i] = (byte) ((src[i] + paethPredictor) % 256);
             // dst[i] = (byte) ((src[i] + paethPredictor) );

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
index fb121c6..b5bb710 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
@@ -29,7 +29,7 @@ public class TransparencyFilterGrayscale extends TransparencyFilter {
     public TransparencyFilterGrayscale(final byte[] bytes) throws IOException {
         super(bytes);
 
-        ByteArrayInputStream is = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
         transparentColor = read2Bytes("transparentColor", is, "tRNS: Missing transparentColor", getByteOrder());
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
index ecc42d9..9ad774e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
@@ -29,10 +29,10 @@ public class TransparencyFilterTrueColor extends TransparencyFilter {
     public TransparencyFilterTrueColor(final byte[] bytes) throws IOException {
         super(bytes);
 
-        ByteArrayInputStream is = new ByteArrayInputStream(bytes);
-        int transparentRed = read2Bytes("transparentRed", is, "tRNS: Missing transparentColor", getByteOrder());
-        int transparentGreen = read2Bytes("transparentGreen", is, "tRNS: Missing transparentColor", getByteOrder());
-        int transparentBlue = read2Bytes("transparentBlue", is, "tRNS: Missing transparentColor", getByteOrder());
+        final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
+        final int transparentRed = read2Bytes("transparentRed", is, "tRNS: Missing transparentColor", getByteOrder());
+        final int transparentGreen = read2Bytes("transparentGreen", is, "tRNS: Missing transparentColor", getByteOrder());
+        final int transparentBlue = read2Bytes("transparentBlue", is, "tRNS: Missing transparentColor", getByteOrder());
 
         transparentColor = ((0xff & transparentRed) << 16)
                 | ((0xff & transparentGreen) << 8)

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
index 4acd09d..c55e797 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
@@ -103,13 +103,13 @@ public class PnmImageParser extends ImageParser {
             final int width;
             try {
               width = Integer.parseInt(wsr.readtoWhiteSpace());
-            } catch (NumberFormatException e) {
+            } catch (final NumberFormatException e) {
               throw new ImageReadException("Invalid width specified." , e);
             }
             final int height;
             try {
               height = Integer.parseInt(wsr.readtoWhiteSpace());
-            } catch (NumberFormatException e) {
+            } catch (final NumberFormatException e) {
               throw new ImageReadException("Invalid height specified." , e);
             }
     

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java b/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
index 5b330b5..602a1b3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
@@ -114,7 +114,7 @@ class ImageResourceType {
     };
 
     public static String getDescription(final int id) {
-        for (ImageResourceType type : TYPES) {
+        for (final ImageResourceType type : TYPES) {
             if (type.from <= id && id <= type.to) {
                 return type.description;
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
index 81709b2..cb9f255 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
@@ -38,11 +38,11 @@ public class TiffContents {
 
         result.add(header);
 
-        for (TiffDirectory directory : directories) {
+        for (final TiffDirectory directory : directories) {
             result.add(directory);
 
             final List<TiffField> fields = directory.entries;
-            for (TiffField field : fields) {
+            for (final TiffField field : fields) {
                 final TiffElement oversizeValue = field.getOversizeValueElement();
                 if (null != oversizeValue) {
                     result.add(oversizeValue);
@@ -61,7 +61,7 @@ public class TiffContents {
     }
 
     public TiffField findField(final TagInfo tag) throws ImageReadException {
-        for (TiffDirectory directory : directories) {
+        for (final TiffDirectory directory : directories) {
             final TiffField field = directory.findField(tag);
             if (null != field) {
                 return field;
@@ -77,7 +77,7 @@ public class TiffContents {
         Collections.sort(elements, TiffElement.COMPARATOR);
 
         long lastEnd = 0;
-        for (TiffElement element : elements) {
+        for (final TiffElement element : elements) {
             if (element.offset > lastEnd) {
                 Debug.debug("\t" + "gap: " + (element.offset - lastEnd));
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
index 84cd1c8..f321c28 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
@@ -87,7 +87,7 @@ public class TiffDirectory extends TiffElement {
         long entryOffset = offset + TiffConstants.TIFF_DIRECTORY_HEADER_LENGTH;
 
         final StringBuilder result = new StringBuilder();
-        for (TiffField entry : entries) {
+        for (final TiffField entry : entries) {
             result.append(String.format("\t[%d]: %s (%d, 0x%x), %s, %d: %s%n",
                     entryOffset, entry.getTagInfo().name,
                     entry.getTag(), entry.getTag(),
@@ -126,7 +126,7 @@ public class TiffDirectory extends TiffElement {
     }
 
     public void dump() {
-        for (TiffField entry : entries) {
+        for (final TiffField entry : entries) {
             entry.dump();
         }
 
@@ -178,7 +178,7 @@ public class TiffDirectory extends TiffElement {
             return null;
         }
 
-        for (TiffField field : entries) {
+        for (final TiffField field : entries) {
             if (field.getTag() == tag.tag) {
                 return field;
             }
@@ -766,8 +766,8 @@ public class TiffDirectory extends TiffElement {
     }
 
     public ImageDataElement getJpegRawImageDataElement() throws ImageReadException {
-        TiffField jpegInterchangeFormat = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
-        TiffField jpegInterchangeFormatLength = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH);
+        final TiffField jpegInterchangeFormat = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
+        final TiffField jpegInterchangeFormatLength = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH);
 
         if (jpegInterchangeFormat != null && jpegInterchangeFormatLength != null) {
             final int offSet = jpegInterchangeFormat.getIntArrayValue()[0];

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
index 3dfc3cb..e6fec64 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
@@ -111,7 +111,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
                         byteOrder);
 
                 final List<? extends ImageMetadataItem> entries = getItems();
-                for (ImageMetadataItem entry : entries) {
+                for (final ImageMetadataItem entry : entries) {
                     final TiffMetadataItem item = (TiffMetadataItem) entry;
                     final TiffField srcField = item.getTiffField();
 
@@ -169,7 +169,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
         final List<ImageMetadataItem> result = new ArrayList<>();
 
         final List<? extends ImageMetadataItem> items = super.getItems();
-        for (ImageMetadataItem item : items) {
+        for (final ImageMetadataItem item : items) {
             final Directory dir = (Directory) item;
             result.addAll(dir.getItems());
         }
@@ -197,7 +197,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
         final TiffOutputSet result = new TiffOutputSet(byteOrder);
 
         final List<? extends ImageMetadataItem> srcDirs = getDirectories();
-        for (ImageMetadataItem srcDir1 : srcDirs) {
+        for (final ImageMetadataItem srcDir1 : srcDirs) {
             final Directory srcDir = (Directory) srcDir1;
 
             if (null != result.findDirectory(srcDir.type)) {
@@ -227,7 +227,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
         final List<? extends ImageMetadataItem> directories = getDirectories();
         if (exactDirectoryMatch
                 || tagInfo.directoryType != TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN) {
-            for (ImageMetadataItem directory1 : directories) {
+            for (final ImageMetadataItem directory1 : directories) {
                 final Directory directory = (Directory) directory1;
                 if (directory.type == tagInfo.directoryType.directoryType) {
                     final TiffField field = directory.findField(tagInfo);
@@ -239,7 +239,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
             if (exactDirectoryMatch || tagsMatching > 1) {
                 return null;
             }
-            for (ImageMetadataItem directory1 : directories) {
+            for (final ImageMetadataItem directory1 : directories) {
                 final Directory directory = (Directory) directory1;
                 if (tagInfo.directoryType.isImageDirectory()
                         && directory.type >= 0) {
@@ -257,7 +257,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
             }
         }
 
-        for (ImageMetadataItem directory1 : directories) {
+        for (final ImageMetadataItem directory1 : directories) {
             final Directory directory = (Directory) directory1;
             final TiffField field = directory.findField(tagInfo);
             if (field != null) {
@@ -426,7 +426,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
 
     public TiffDirectory findDirectory(final int directoryType) {
         final List<? extends ImageMetadataItem> directories = getDirectories();
-        for (ImageMetadataItem directory1 : directories) {
+        for (final ImageMetadataItem directory1 : directories) {
             final Directory directory = (Directory) directory1;
             if (directory.type == directoryType) {
                 return directory.directory;
@@ -438,7 +438,7 @@ public class TiffImageMetadata extends GenericImageMetadata {
     public List<TiffField> getAllFields() {
         final List<TiffField> result = new ArrayList<>();
         final List<? extends ImageMetadataItem> directories = getDirectories();
-        for (ImageMetadataItem directory1 : directories) {
+        for (final ImageMetadataItem directory1 : directories) {
             final Directory directory = (Directory) directory1;
             result.addAll(directory.getAllFields());
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
index 1750abd..5aa653f 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
@@ -127,13 +127,13 @@ public class TiffImageParser extends ImageParser {
 
         final TiffImageMetadata result = new TiffImageMetadata(contents);
 
-        for (TiffDirectory dir : directories) {
+        for (final TiffDirectory dir : directories) {
             final TiffImageMetadata.Directory metadataDirectory = new TiffImageMetadata.Directory(
                     tiffReader.getByteOrder(), dir);
 
             final List<TiffField> entries = dir.getDirectoryEntries();
 
-            for (TiffField entry : entries) {
+            for (final TiffField entry : entries) {
                 metadataDirectory.add(entry);
             }
 
@@ -229,7 +229,7 @@ public class TiffImageParser extends ImageParser {
 
         final List<String> comments = new ArrayList<>();
         final List<TiffField> entries = directory.entries;
-        for (TiffField field : entries) {
+        for (final TiffField field : entries) {
             final String comment = field.toString();
             comments.add(comment);
         }
@@ -365,7 +365,7 @@ public class TiffImageParser extends ImageParser {
 
                     // Debug.debug("directory offset", directory.offset);
 
-                    for (TiffField field : entries) {
+                    for (final TiffField field : entries) {
                         field.dump(pw, Integer.toString(d));
                     }
                 }
@@ -405,7 +405,7 @@ public class TiffImageParser extends ImageParser {
         for (int i = 0; i < contents.directories.size(); i++) {
             final TiffDirectory directory = contents.directories.get(i);
             final List<ImageDataElement> dataElements = directory.getTiffRawImageDataElements();
-            for (ImageDataElement element : dataElements) {
+            for (final ImageDataElement element : dataElements) {
                 final byte[] bytes = byteSource.getBlock(element.offset,
                         element.length);
                 result.add(bytes);
@@ -507,10 +507,10 @@ public class TiffImageParser extends ImageParser {
             final Map<String, Object> params)
             throws ImageReadException
     {
-        Integer ix0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_X, params);
-        Integer iy0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_Y, params);
-        Integer iwidth = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, params);
-        Integer iheight = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, params);
+        final Integer ix0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_X, params);
+        final Integer iy0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_Y, params);
+        final Integer iwidth = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, params);
+        final Integer iheight = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, params);
         
         if (ix0 == null && iy0 == null && iwidth == null && iheight == null) {
             return null;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
index 339726c..fbf95b0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
@@ -83,7 +83,7 @@ final class TiffTags {
         // make sure to use the thread-safe version; this is shared state.
         final Map<Integer, List<TagInfo>> map = new HashMap<>();
 
-        for (TagInfo tag : tags) {
+        for (final TagInfo tag : tags) {
             List<TagInfo> tagList = map.get(tag.tag);
             if (tagList == null) {
                 tagList = new ArrayList<>();
@@ -98,7 +98,7 @@ final class TiffTags {
     private static Map<Integer, Integer> countTags(final List<TagInfo> tags) {
         final Map<Integer, Integer> map = new HashMap<>();
 
-        for (TagInfo tag : tags) {
+        for (final TagInfo tag : tags) {
             final Integer count = map.get(tag.tag);
             if (count == null) {
                 map.put(tag.tag, 1);
@@ -132,7 +132,7 @@ final class TiffTags {
         }
 
         // first search for exact match.
-        for (TagInfo tagInfo : possibleMatches) {
+        for (final TagInfo tagInfo : possibleMatches) {
             if (tagInfo.directoryType == TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN) {
                 // pass
                 continue;
@@ -142,7 +142,7 @@ final class TiffTags {
         }
 
         // accept an inexact match.
-        for (TagInfo tagInfo : possibleMatches) {
+        for (final TagInfo tagInfo : possibleMatches) {
             if (tagInfo.directoryType == TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN) {
                 // pass
                 continue;
@@ -156,7 +156,7 @@ final class TiffTags {
         }
 
         // accept a wildcard match.
-        for (TagInfo tagInfo : possibleMatches) {
+        for (final TagInfo tagInfo : possibleMatches) {
             if (tagInfo.directoryType == TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN) {
                 return tagInfo;
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
index eb78d98..aeffa81 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
@@ -79,7 +79,7 @@ public abstract class TiffImageWriterBase {
 
         final List<Integer> directoryIndices = new ArrayList<>();
         final Map<Integer, TiffOutputDirectory> directoryTypeMap = new HashMap<>();
-        for (TiffOutputDirectory directory : directories) {
+        for (final TiffOutputDirectory directory : directories) {
             final int dirType = directory.type;
             directoryTypeMap.put(dirType, directory);
             // Debug.debug("validating dirType", dirType + " ("
@@ -126,7 +126,7 @@ public abstract class TiffImageWriterBase {
 
             final HashSet<Integer> fieldTags = new HashSet<>();
             final List<TiffOutputField> fields = directory.getFields();
-            for (TiffOutputField field : fields) {
+            for (final TiffOutputField field : fields) {
                 if (fieldTags.contains(field.tag)) {
                     throw new ImageWriteException("Tag ("
                             + field.tagInfo.getDescription()

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
index 97290fb..30b152b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
@@ -84,7 +84,7 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
             for (final TiffDirectory directory : directories) {
                 elements.add(directory);
 
-                for (TiffField field : directory.getDirectoryEntries()) {
+                for (final TiffField field : directory.getDirectoryEntries()) {
                     final TiffElement oversizeValue = field.getOversizeValueElement();
                     if (oversizeValue != null) {
                         final TiffOutputField frozenField = frozenFields.get(field.getTag());
@@ -232,7 +232,7 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
             // search for the smallest possible element large enough to hold the
             // item.
             TiffElement bestFit = null;
-            for (TiffElement element : unusedElements) {
+            for (final TiffElement element : unusedElements) {
                 if (element.length >= outputItemLength) {
                     bestFit = element;
                 } else {
@@ -314,7 +314,7 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
         }
 
         // write in the new items
-        for (TiffOutputItem outputItem : outputItems) {
+        for (final TiffOutputItem outputItem : outputItems) {
             final BufferOutputStream tos = new BufferOutputStream(output,
                     (int) outputItem.getOffset());
             final BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
index 6e215ed..c83d990 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
@@ -55,7 +55,7 @@ public class TiffImageWriterLossy extends TiffImageWriterBase {
     private void updateOffsetsStep(final List<TiffOutputItem> outputItems) {
         int offset = TIFF_HEADER_SIZE;
 
-        for (TiffOutputItem outputItem : outputItems) {
+        for (final TiffOutputItem outputItem : outputItems) {
             outputItem.setOffset(offset);
             final int itemLength = outputItem.getItemLength();
             offset += itemLength;
@@ -70,7 +70,7 @@ public class TiffImageWriterLossy extends TiffImageWriterBase {
             ImageWriteException {
         writeImageFileHeader(bos);
 
-        for (TiffOutputItem outputItem : outputItems) {
+        for (final TiffOutputItem outputItem : outputItems) {
             outputItem.writeItem(bos);
 
             final int length = outputItem.getItemLength();

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
index a1e8a09..02ceeac 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
@@ -553,7 +553,7 @@ public final class TiffOutputDirectory extends TiffOutputItem {
 
     public void removeField(final int tag) {
         final List<TiffOutputField> matches = new ArrayList<>();
-        for (TiffOutputField field : fields) {
+        for (final TiffOutputField field : fields) {
             if (field.tag == tag) {
                 matches.add(field);
             }
@@ -588,7 +588,7 @@ public final class TiffOutputDirectory extends TiffOutputItem {
      * @see #findField(TagInfo)
      */
     public TiffOutputField findField(final int tag) {
-        for (TiffOutputField field : fields) {
+        for (final TiffOutputField field : fields) {
             if (field.tag == tag) {
                 return field;
             }
@@ -620,7 +620,7 @@ public final class TiffOutputDirectory extends TiffOutputItem {
         bos.write2Bytes(fields.size()); // DirectoryFieldCount
 
         // Write Fields
-        for (TiffOutputField field : fields) {
+        for (final TiffOutputField field : fields) {
             field.writeField(bos);
 
             // Debug.debug("\t" + "writing field (" + field.tag + ", 0x" +
@@ -730,8 +730,8 @@ public final class TiffOutputDirectory extends TiffOutputItem {
 
             // TiffOutputField imageDataOffsetsField = null;
 
-            int[] imageDataOffsets = new int[imageData.length];
-            int[] imageDataByteCounts = new int[imageData.length];
+            final int[] imageDataOffsets = new int[imageData.length];
+            final int[] imageDataByteCounts = new int[imageData.length];
             for (int i = 0; i < imageData.length; i++) {
                 imageDataByteCounts[i] = imageData[i].length;
             }
@@ -764,7 +764,7 @@ public final class TiffOutputDirectory extends TiffOutputItem {
         result.add(this);
         sortFields();
 
-        for (TiffOutputField field : fields) {
+        for (final TiffOutputField field : fields) {
             if (field.isLocalValue()) {
                 continue;
             }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
index 9e08380..9d3cd82 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
@@ -47,7 +47,7 @@ public final class TiffOutputSet {
             final TiffOutputSummary outputSummary) throws ImageWriteException {
         final List<TiffOutputItem> result = new ArrayList<>();
 
-        for (TiffOutputDirectory directory : directories) {
+        for (final TiffOutputDirectory directory : directories) {
             result.addAll(directory.getOutputItems(outputSummary));
         }
 
@@ -117,7 +117,7 @@ public final class TiffOutputSet {
     }
 
     public TiffOutputDirectory findDirectory(final int directoryType) {
-        for (TiffOutputDirectory directory : directories) {
+        for (final TiffOutputDirectory directory : directories) {
             if (directory.type == directoryType) {
                 return directory;
             }
@@ -195,7 +195,7 @@ public final class TiffOutputSet {
     }
 
     public void removeField(final int tag) {
-        for (TiffOutputDirectory directory : directories) {
+        for (final TiffOutputDirectory directory : directories) {
             directory.removeField(tag);
         }
     }
@@ -205,7 +205,7 @@ public final class TiffOutputSet {
     }
 
     public TiffOutputField findField(final int tag) {
-        for (TiffOutputDirectory directory : directories) {
+        for (final TiffOutputDirectory directory : directories) {
             final TiffOutputField field = directory.findField(tag);
             if (null != field) {
                 return field;
@@ -272,7 +272,7 @@ public final class TiffOutputSet {
                     prefix, i, directory.description(), directory.type));
 
             final List<TiffOutputField> fields = directory.getFields();
-            for (TiffOutputField field : fields) {
+            for (final TiffOutputField field : fields) {
                 result.append(prefix);
                 result.append("\t\tfield " + i + ": " + field.tagInfo);
                 result.append(NEWLINE);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java
index 732b8fd..c26045c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java
@@ -57,13 +57,13 @@ class TiffOutputSummary {
     }
 
     public void updateOffsets(final ByteOrder byteOrder) throws ImageWriteException {
-        for (OffsetItem offset : offsetItems) {
+        for (final OffsetItem offset : offsetItems) {
             final byte[] value = FieldType.LONG.writeData(
                     (int) offset.item.getOffset(), byteOrder);
             offset.itemOffsetField.setData(value);
         }
 
-        for (ImageDataOffsets imageDataInfo : imageDataItems) {
+        for (final ImageDataOffsets imageDataInfo : imageDataItems) {
             for (int j = 0; j < imageDataInfo.outputItems.length; j++) {
                 final TiffOutputItem item = imageDataInfo.outputItems[j];
                 imageDataInfo.imageDataOffsets[j] = (int) item.getOffset();

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index a57fd78..4a3d8a4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -267,10 +267,10 @@ public class XbmImageParser extends ImageParser {
             }
         }
 
-        int[] palette = { 0xffffff, 0x000000 };
-        ColorModel colorModel = new IndexColorModel(1, 2, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
-        DataBufferByte dataBuffer = new DataBufferByte(imageData, imageData.length);
-        WritableRaster raster = Raster.createPackedRaster(dataBuffer, xbmHeader.width, xbmHeader.height, 1, null);
+        final int[] palette = { 0xffffff, 0x000000 };
+        final ColorModel colorModel = new IndexColorModel(1, 2, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
+        final DataBufferByte dataBuffer = new DataBufferByte(imageData, imageData.length);
+        final WritableRaster raster = Raster.createPackedRaster(dataBuffer, xbmHeader.width, xbmHeader.height, 1, null);
         
         return new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), new Properties());
     }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java b/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
index 0e05f94..f11ce6f 100644
--- a/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
+++ b/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
@@ -68,7 +68,7 @@ public class IccProfileParser extends BinaryFileParser {
         try {
 
             is = byteSource.getInputStream();
-            IccProfileInfo result = readICCProfileInfo(is);
+            final IccProfileInfo result = readICCProfileInfo(is);
 
             if (result == null) {
                 return null;
@@ -332,7 +332,7 @@ public class IccProfileParser extends BinaryFileParser {
                 printCharQuad("DeviceModel", deviceModel);
             }
 
-            boolean result = deviceManufacturer == IccConstants.IEC && deviceModel == IccConstants.sRGB;
+            final boolean result = deviceManufacturer == IccConstants.IEC && deviceModel == IccConstants.sRGB;
             return result;
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java b/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java
index 297f1ac..9d87686 100644
--- a/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java
+++ b/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java
@@ -55,7 +55,7 @@ class ColorGroup {
         }
 
         int total = 0;
-        for (ColorCount color : colorCounts) {
+        for (final ColorCount color : colorCounts) {
             total += color.count;
 
             minAlpha = Math.min(minAlpha, color.alpha);
@@ -107,7 +107,7 @@ class ColorGroup {
         long greenTotal = 0;
         long blueTotal = 0;
 
-        for (ColorCount color : colorCounts) {
+        for (final ColorCount color : colorCounts) {
             countTotal += color.count;
             alphaTotal += color.count * color.alpha;
             redTotal += color.count * color.red;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java b/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
index f3149d7..8b3b4c6 100644
--- a/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
+++ b/src/main/java/org/apache/commons/imaging/palette/LongestAxisMedianCut.java
@@ -114,9 +114,9 @@ public class LongestAxisMedianCut implements MedianCut {
                 colorGroup.colorCounts.subList(medianIndex + 1,
                         colorGroup.colorCounts.size()));
 
-        ColorGroup less = new ColorGroup(new ArrayList<>(colorCounts1), ignoreAlpha);
+        final ColorGroup less = new ColorGroup(new ArrayList<>(colorCounts1), ignoreAlpha);
         colorGroups.add(less);
-        ColorGroup more = new ColorGroup(new ArrayList<>(colorCounts2), ignoreAlpha);
+        final ColorGroup more = new ColorGroup(new ArrayList<>(colorCounts2), ignoreAlpha);
         colorGroups.add(more);
 
         final ColorCount medianValue = colorGroup.colorCounts.get(medianIndex);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java b/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java
index af31092..aa9eab0 100644
--- a/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java
+++ b/src/main/java/org/apache/commons/imaging/palette/MostPopulatedBoxesMedianCut.java
@@ -31,7 +31,7 @@ public class MostPopulatedBoxesMedianCut implements MedianCut {
             final boolean ignoreAlpha) throws ImageWriteException {
         int maxPoints = 0;
         ColorGroup colorGroup = null;
-        for (ColorGroup group : colorGroups) {
+        for (final ColorGroup group : colorGroups) {
             if (group.maxDiff > 0) {
                 if (group.totalPoints > maxPoints) {
                     colorGroup = group;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java b/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
index b8e6da5..8ebe4fe 100644
--- a/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
+++ b/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
@@ -202,8 +202,8 @@ public class PaletteFactory {
             }
         }
 
-        int sum2 = sum1 - last;
-        int slice2 = slice1 - 1;
+        final int sum2 = sum1 - last;
+        final int slice2 = slice1 - 1;
 
         final DivisionCandidate dc1 = finishDivision(subset, component, precision, sum1, slice1);
         final DivisionCandidate dc2 = finishDivision(subset, component, precision, sum2, slice2);
@@ -231,7 +231,7 @@ public class PaletteFactory {
         DivisionCandidate bestV = null;
         double bestScore = Double.MAX_VALUE;
 
-        for (DivisionCandidate dc : dcs) {
+        for (final DivisionCandidate dc : dcs) {
             final ColorSpaceSubset first = dc.dst_a;
             final ColorSpaceSubset second = dc.dst_b;
             final int area1 = first.total;
@@ -273,7 +273,7 @@ public class PaletteFactory {
             int maxArea = -1;
             ColorSpaceSubset maxSubset = null;
 
-            for (ColorSpaceSubset subset : v) {
+            for (final ColorSpaceSubset subset : v) {
                 if (ignore.contains(subset)) {
                     continue;
                 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/main/java/org/apache/commons/imaging/util/Debug.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/util/Debug.java b/src/main/java/org/apache/commons/imaging/util/Debug.java
index 8b33014..e3b4f09 100644
--- a/src/main/java/org/apache/commons/imaging/util/Debug.java
+++ b/src/main/java/org/apache/commons/imaging/util/Debug.java
@@ -229,7 +229,7 @@ public final class Debug {
         final String suffix = " [" + counter++ + "]";
 
         debug(message + " (" + v.size() + ")" + suffix);
-        for (Object aV : v) {
+        for (final Object aV : v) {
             debug("\t" + aV.toString() + suffix);
         }
         debug();

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java b/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
index a15a317..ac0118a 100644
--- a/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
+++ b/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
@@ -79,7 +79,7 @@ public class ImagingGuessFormatTest extends ImagingTest {
 
     @Test
     public void testGuessFormat() throws Exception {
-        String imagePath = FilenameUtils.separatorsToSystem(pathToFile);
+        final String imagePath = FilenameUtils.separatorsToSystem(pathToFile);
         final File imageFile = new File(TEST_IMAGE_FOLDER, imagePath);
 
         final ImageFormat guessedFormat = Imaging.guessFormat(imageFile);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
index 0593640..614a47e 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
@@ -105,7 +105,7 @@ public class ByteSourceImageTest extends ByteSourceTest {
     }
 
     public void checkGetBufferedImage(final File file, final byte[] bytes) throws Exception {
-        BufferedImage bufferedImage = Imaging.getBufferedImage(file);
+        final BufferedImage bufferedImage = Imaging.getBufferedImage(file);
         assertNotNull(bufferedImage);
         assertTrue(bufferedImage.getWidth() > 0);
         assertTrue(bufferedImage.getHeight() > 0);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
index 098c211..719ea1d 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
@@ -67,7 +67,7 @@ public class AsciiFieldTest extends ExifBaseTest {
                 TiffTagConstants.TIFF_TAG_DATE_TIME.tag,
                 "2007:12:25 13:34:39");
 
-        for (Map.Entry<Integer, Object> tag : expectedFieldValues.entrySet()) {
+        for (final Map.Entry<Integer, Object> tag : expectedFieldValues.entrySet()) {
             assertTrue(fieldMap.containsKey(tag.getKey()));
             final TiffField field = fieldMap.get(tag.getKey());
             assertNotNull(field);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
index 9333c96..ea6b7dc 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
@@ -119,11 +119,11 @@ public class MicrosoftTagTest extends ExifBaseTest {
         final TiffImageMetadata metadata = toTiffMetadata(Imaging.getMetadata(file));
         
         // field values may be duplicated between directories, we have to check all
-        List<Object> authorValues = new ArrayList<>();
-        List<Object> commentValues = new ArrayList<>();
-        List<Object> subjectValues = new ArrayList<>();
-        List<Object> titleValues = new ArrayList<>();
-        for (TiffDirectory d : metadata.contents.directories) {
+        final List<Object> authorValues = new ArrayList<>();
+        final List<Object> commentValues = new ArrayList<>();
+        final List<Object> subjectValues = new ArrayList<>();
+        final List<Object> titleValues = new ArrayList<>();
+        for (final TiffDirectory d : metadata.contents.directories) {
             titleValues.add(d.getFieldValue(MicrosoftTagConstants.EXIF_TAG_XPTITLE, false));
             authorValues.add(d.getFieldValue(MicrosoftTagConstants.EXIF_TAG_XPAUTHOR, false));
             commentValues.add(d.getFieldValue(MicrosoftTagConstants.EXIF_TAG_XPCOMMENT, false));

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
index 5c7128c..ebe6cdd 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
@@ -75,7 +75,7 @@ public class IptcAddTest extends IptcBaseTest {
         newBlocks.addAll(metadata.photoshopApp13Data.getNonIptcBlocks());
         final List<IptcRecord> oldRecords = metadata.photoshopApp13Data.getRecords();
 
-        List<IptcRecord> newRecords = new ArrayList<>();
+        final List<IptcRecord> newRecords = new ArrayList<>();
         for (final IptcRecord record : oldRecords) {
             if (record.iptcType != IptcTypes.CITY
                     && record.iptcType != IptcTypes.CREDIT) {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
index faafec3..ef62946 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
@@ -30,41 +30,41 @@ import org.junit.Test;
 public class IptcFullDiscardTest {
     
     private byte[] addMetaData(final byte[] bytes) throws Exception {
-        IptcRecord record = new IptcRecord(IptcTypes.KEYWORDS, "meta; data");
-        PhotoshopApp13Data data = new PhotoshopApp13Data(Collections.singletonList(record), Collections.<IptcBlock> emptyList());
-        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        final IptcRecord record = new IptcRecord(IptcTypes.KEYWORDS, "meta; data");
+        final PhotoshopApp13Data data = new PhotoshopApp13Data(Collections.singletonList(record), Collections.<IptcBlock> emptyList());
+        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         new JpegIptcRewriter().writeIPTC(bytes, byteArrayOutputStream, data);
         return byteArrayOutputStream.toByteArray();
     }
     
     private byte[] generateImage() throws Exception {
-        BufferedImage image = new BufferedImage(100, 50, BufferedImage.TYPE_3BYTE_BGR); // was TYPE_INT_ARGB but that fails on Continuum
-        Graphics2D graphics2D = image.createGraphics();
+        final BufferedImage image = new BufferedImage(100, 50, BufferedImage.TYPE_3BYTE_BGR); // was TYPE_INT_ARGB but that fails on Continuum
+        final Graphics2D graphics2D = image.createGraphics();
         graphics2D.drawString("Hello World!", 10, 10);
-        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         ImageIO.write(image, "jpg", byteArrayOutputStream);
         return byteArrayOutputStream.toByteArray();
     }
     
     private byte[] removeMetaData(final byte[] bytes, final boolean removeApp13Segment) throws Exception {
-        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         new JpegIptcRewriter().removeIPTC(bytes, byteArrayOutputStream, removeApp13Segment);
         return byteArrayOutputStream.toByteArray();
     }
 
     @Test
     public void leaveApp13Segment() throws Exception {
-        byte[] originalImage = generateImage();
-        byte[] taggedImage = addMetaData(originalImage);
-        byte[] untaggedImage = removeMetaData(taggedImage, false);
+        final byte[] originalImage = generateImage();
+        final byte[] taggedImage = addMetaData(originalImage);
+        final byte[] untaggedImage = removeMetaData(taggedImage, false);
         Assert.assertEquals(18, untaggedImage.length - originalImage.length);
     }
     
     @Test
     public void removeApp13Segment() throws Exception {
-        byte[] originalImage = generateImage();
-        byte[] taggedImage = addMetaData(originalImage);
-        byte[] untaggedImage = removeMetaData(taggedImage, true);
+        final byte[] originalImage = generateImage();
+        final byte[] taggedImage = addMetaData(originalImage);
+        final byte[] untaggedImage = removeMetaData(taggedImage, true);
         Assert.assertEquals(originalImage.length, untaggedImage.length);
     }
 }


[36/50] [abbrv] commons-imaging git commit: Allow PCX's RLE compression to span multiple lines when reading and when writing. This should not only allow us to read such images, but also compress the images we write better.

Posted by ch...@apache.org.
Allow PCX's RLE compression to span multiple lines when reading and
when writing. This should not only allow us to read such images, but also
compress the images we write better.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1781770 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/2c61aaa6
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/2c61aaa6
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/2c61aaa6

Branch: refs/heads/master
Commit: 2c61aaa61a74551573a7946cbf5f35727d405a59
Parents: 231f378
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sun Feb 5 14:50:40 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sun Feb 5 14:50:40 2017 +0000

----------------------------------------------------------------------
 .../imaging/formats/pcx/PcxImageParser.java     | 58 +++++------------
 .../commons/imaging/formats/pcx/PcxWriter.java  | 62 +++++-------------
 .../commons/imaging/formats/pcx/RleReader.java  | 65 +++++++++++++++++++
 .../commons/imaging/formats/pcx/RleWriter.java  | 68 ++++++++++++++++++++
 4 files changed, 164 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/2c61aaa6/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
index 6566078..909371e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
@@ -17,7 +17,6 @@
 package org.apache.commons.imaging.formats.pcx;
 
 import static org.apache.commons.imaging.ImagingConstants.PARAM_KEY_STRICT;
-import static org.apache.commons.imaging.common.BinaryFunctions.readByte;
 import static org.apache.commons.imaging.common.BinaryFunctions.readBytes;
 import static org.apache.commons.imaging.common.BinaryFunctions.skipBytes;
 import static org.apache.commons.imaging.common.ByteConversions.toUInt16;
@@ -299,43 +298,6 @@ public class PcxImageParser extends ImageParser {
         return true;
     }
 
-    private void readScanLine(final PcxHeader pcxHeader, final InputStream is,
-            final byte[] samples) throws IOException, ImageReadException {
-        if (pcxHeader.encoding == PcxHeader.ENCODING_UNCOMPRESSED) {
-            int r;
-            for (int bytesRead = 0; bytesRead < samples.length; bytesRead += r) {
-                r = is.read(samples, bytesRead, samples.length - bytesRead);
-                if (r < 0) {
-                    throw new ImageReadException(
-                            "Premature end of file reading image data");
-                }
-            }
-        } else {
-            if (pcxHeader.encoding == PcxHeader.ENCODING_RLE) {
-                for (int bytesRead = 0; bytesRead < samples.length;) {
-                    final byte b = readByte("Pixel", is, "Error reading image data");
-                    int count;
-                    byte sample;
-                    if ((b & 0xc0) == 0xc0) {
-                        count = b & 0x3f;
-                        sample = readByte("Pixel", is,
-                                "Error reading image data");
-                    } else {
-                        count = 1;
-                        sample = b;
-                    }
-                    for (int i = 0; i < count && bytesRead + i < samples.length; i++) {
-                        samples[bytesRead + i] = sample;
-                    }
-                    bytesRead += count;
-                }
-            } else {
-                throw new ImageReadException("Invalid PCX encoding "
-                        + pcxHeader.encoding);
-            }
-        }
-    }
-
     private int[] read256ColorPalette(final InputStream stream) throws IOException {
         final byte[] paletteBytes = readBytes("Palette", stream, 769,
                 "Error reading palette");
@@ -371,7 +333,17 @@ public class PcxImageParser extends ImageParser {
         if (ySize < 0) {
             throw new ImageReadException("Image height is negative");
         }
-
+        if (pcxHeader.nPlanes <= 0 || 4 < pcxHeader.nPlanes) {
+            throw new ImageReadException("Unsupported/invalid image with " + pcxHeader.nPlanes + " planes");
+        }
+        final RleReader rleReader;
+        if (pcxHeader.encoding == PcxHeader.ENCODING_UNCOMPRESSED) {
+            rleReader = new RleReader(false);
+        } else if (pcxHeader.encoding == PcxHeader.ENCODING_RLE) {
+            rleReader = new RleReader(true);
+        } else {
+            throw new ImageReadException("Unsupported/invalid image encoding " + pcxHeader.encoding);
+        }
         final int scanlineLength = pcxHeader.bytesPerLine * pcxHeader.nPlanes;
         final byte[] scanline = new byte[scanlineLength];
         if ((pcxHeader.bitsPerPixel == 1 || pcxHeader.bitsPerPixel == 2
@@ -380,7 +352,7 @@ public class PcxImageParser extends ImageParser {
             final int bytesPerImageRow = (xSize * pcxHeader.bitsPerPixel + 7) / 8;
             final byte[] image = new byte[ySize * bytesPerImageRow];
             for (int y = 0; y < ySize; y++) {
-                readScanLine(pcxHeader, is, scanline);
+                rleReader.read(is, scanline);
                 System.arraycopy(scanline, 0, image, y * bytesPerImageRow,
                         bytesPerImageRow);
             }
@@ -429,7 +401,7 @@ public class PcxImageParser extends ImageParser {
                     BufferedImage.TYPE_BYTE_BINARY, colorModel);
             final byte[] unpacked = new byte[xSize];
             for (int y = 0; y < ySize; y++) {
-                readScanLine(pcxHeader, is, scanline);
+                rleReader.read(is, scanline);
                 int nextByte = 0;
                 Arrays.fill(unpacked, (byte) 0);
                 for (int plane = 0; plane < pcxHeader.nPlanes; plane++) {
@@ -449,7 +421,7 @@ public class PcxImageParser extends ImageParser {
             image[1] = new byte[xSize * ySize];
             image[2] = new byte[xSize * ySize];
             for (int y = 0; y < ySize; y++) {
-                readScanLine(pcxHeader, is, scanline);
+                rleReader.read(is, scanline);
                 System.arraycopy(scanline, 0, image[0], y * xSize, xSize);
                 System.arraycopy(scanline, pcxHeader.bytesPerLine, image[1], y
                         * xSize, xSize);
@@ -471,7 +443,7 @@ public class PcxImageParser extends ImageParser {
             final int rowLength = 3 * xSize;
             final byte[] image = new byte[rowLength * ySize];
             for (int y = 0; y < ySize; y++) {
-                readScanLine(pcxHeader, is, scanline);
+                rleReader.read(is, scanline);
                 if (pcxHeader.bitsPerPixel == 24) {
                     System.arraycopy(scanline, 0, image, y * rowLength,
                             rowLength);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/2c61aaa6/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
index 0bc9baa..8b758a5 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
@@ -34,6 +34,7 @@ class PcxWriter {
     private int encoding;
     private int bitDepth = -1;
     private PixelDensity pixelDensity;
+    private final RleWriter rleWriter;
 
     public PcxWriter(Map<String, Object> params) throws ImageWriteException {
         // make copy of params; we'll clear keys as we consume them.
@@ -60,6 +61,11 @@ class PcxWriter {
                 }
             }
         }
+        if (encoding == PcxImageParser.PcxHeader.ENCODING_UNCOMPRESSED) {
+            rleWriter = new RleWriter(false);
+        } else {
+            rleWriter = new RleWriter(true);
+        }
 
         if (params.containsKey(PcxConstants.PARAM_KEY_PCX_BIT_DEPTH)) {
             final Object value = params.remove(PcxConstants.PARAM_KEY_PCX_BIT_DEPTH);
@@ -93,47 +99,6 @@ class PcxWriter {
         }
     }
 
-    private void writeScanLine(final BinaryOutputStream bos, final byte[] scanline)
-            throws IOException, ImageWriteException {
-        if (encoding == PcxImageParser.PcxHeader.ENCODING_UNCOMPRESSED) {
-            bos.write(scanline);
-        } else {
-            if (encoding == PcxImageParser.PcxHeader.ENCODING_RLE) {
-                int previousByte = -1;
-                int repeatCount = 0;
-                for (final byte element : scanline) {
-                    if ((element & 0xff) == previousByte
-                            && repeatCount < 63) {
-                        ++repeatCount;
-                    } else {
-                        if (repeatCount > 0) {
-                            if (repeatCount == 1
-                                    && (previousByte & 0xc0) != 0xc0) {
-                                bos.write(previousByte);
-                            } else {
-                                bos.write(0xc0 | repeatCount);
-                                bos.write(previousByte);
-                            }
-                        }
-                        previousByte = 0xff & element;
-                        repeatCount = 1;
-                    }
-                }
-                if (repeatCount > 0) {
-                    if (repeatCount == 1 && (previousByte & 0xc0) != 0xc0) {
-                        bos.write(previousByte);
-                    } else {
-                        bos.write(0xc0 | repeatCount);
-                        bos.write(previousByte);
-                    }
-                }
-            } else {
-                throw new ImageWriteException("Invalid PCX encoding "
-                        + encoding);
-            }
-        }
-    }
-
     public void writeImage(final BufferedImage src, final OutputStream os)
             throws ImageWriteException, IOException {
         final PaletteFactory paletteFactory = new PaletteFactory();
@@ -206,8 +171,9 @@ class PcxWriter {
                 rgbBytes[4 * x + 2] = (byte) ((rgbs[x] >> 16) & 0xff);
                 rgbBytes[4 * x + 3] = 0;
             }
-            writeScanLine(bos, rgbBytes);
+            rleWriter.write(bos, rgbBytes);
         }
+        rleWriter.flush(bos);
     }
 
     private void write24BppPCX(final BufferedImage src, final BinaryOutputStream bos)
@@ -243,8 +209,9 @@ class PcxWriter {
                 rgbBytes[bytesPerLine + x] = (byte) ((rgbs[x] >> 8) & 0xff);
                 rgbBytes[2 * bytesPerLine + x] = (byte) (rgbs[x] & 0xff);
             }
-            writeScanLine(bos, rgbBytes);
+            rleWriter.write(bos, rgbBytes);
         }
+        rleWriter.flush(bos);
     }
 
     private void writeBlackAndWhitePCX(final BufferedImage src,
@@ -292,8 +259,9 @@ class PcxWriter {
                 }
                 row[x / 8] |= (bit << (7 - (x % 8)));
             }
-            writeScanLine(bos, row);
+            rleWriter.write(bos, row);
         }
+        rleWriter.flush(bos);
     }
 
     private void write16ColorPCX(final BufferedImage src, final SimplePalette palette,
@@ -344,8 +312,9 @@ class PcxWriter {
                 final int index = palette.getPaletteIndex(0xffffff & argb);
                 indeces[x / 2] |= (index << 4 * (1 - (x % 2)));
             }
-            writeScanLine(bos, indeces);
+            rleWriter.write(bos, indeces);
         }
+        rleWriter.flush(bos);
     }
 
     private void write256ColorPCX(final BufferedImage src, final SimplePalette palette,
@@ -379,8 +348,9 @@ class PcxWriter {
                 final int index = palette.getPaletteIndex(0xffffff & argb);
                 indeces[x] = (byte) index;
             }
-            writeScanLine(bos, indeces);
+            rleWriter.write(bos, indeces);
         }
+        rleWriter.flush(bos);
         // palette
         bos.write(12);
         for (int i = 0; i < 256; i++) {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/2c61aaa6/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java b/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java
new file mode 100644
index 0000000..735a205
--- /dev/null
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java
@@ -0,0 +1,65 @@
+/*
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+
+package org.apache.commons.imaging.formats.pcx;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.BinaryFunctions;
+
+class RleReader {
+    private final boolean isCompressed;
+    private int count;
+    private byte sample;
+    
+    RleReader(final boolean isCompressed) {
+        this.isCompressed = isCompressed;
+    }
+    
+    void read(final InputStream is, final byte[] samples) throws IOException, ImageReadException {
+        if (isCompressed) {
+            final int prefill = Math.min(count, samples.length);
+            Arrays.fill(samples, 0, prefill, sample);
+            count -= prefill;
+            
+            for (int bytesRead = prefill; bytesRead < samples.length;) {
+                final byte b = BinaryFunctions.readByte("RleByte", is, "Error reading image data");
+                if ((b & 0xc0) == 0xc0) {
+                    count = b & 0x3f;
+                    sample = BinaryFunctions.readByte("RleValue", is, "Error reading image data");
+                } else {
+                    count = 1;
+                    sample = b;
+                }
+                final int samplesToAdd = Math.min(count, samples.length - bytesRead);
+                Arrays.fill(samples, bytesRead, bytesRead + samplesToAdd, sample);
+                bytesRead += samplesToAdd;
+                count -= samplesToAdd;
+            }
+        } else {
+            int r;
+            for (int bytesRead = 0; bytesRead < samples.length; bytesRead += r) {
+                r = is.read(samples, bytesRead, samples.length - bytesRead);
+                if (r < 0) {
+                    throw new ImageReadException(
+                            "Premature end of file reading image data");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/2c61aaa6/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java
new file mode 100644
index 0000000..ce4e3ea
--- /dev/null
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+
+package org.apache.commons.imaging.formats.pcx;
+
+import java.io.IOException;
+
+import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.common.BinaryOutputStream;
+
+class RleWriter {
+    private final boolean isCompressed;
+    private int previousByte = -1;
+    private int repeatCount = 0;
+
+    RleWriter(final boolean isCompressed) {
+        this.isCompressed = isCompressed;
+    }
+    
+    void write(final BinaryOutputStream bos, final byte[] samples)
+            throws IOException, ImageWriteException {
+        if (isCompressed) {
+            for (final byte element : samples) {
+                if ((element & 0xff) == previousByte
+                        && repeatCount < 63) {
+                    ++repeatCount;
+                } else {
+                    if (repeatCount > 0) {
+                        if (repeatCount == 1
+                                && (previousByte & 0xc0) != 0xc0) {
+                            bos.write(previousByte);
+                        } else {
+                            bos.write(0xc0 | repeatCount);
+                            bos.write(previousByte);
+                        }
+                    }
+                    previousByte = 0xff & element;
+                    repeatCount = 1;
+                }
+            }
+        } else {
+            bos.write(samples);
+        }
+    }
+    
+    void flush(final BinaryOutputStream bos) throws IOException {
+        if (repeatCount > 0) {
+            if (repeatCount == 1 && (previousByte & 0xc0) != 0xc0) {
+                bos.write(previousByte);
+            } else {
+                bos.write(0xc0 | repeatCount);
+                bos.write(previousByte);
+            }
+        }
+    }
+}


[38/50] [abbrv] commons-imaging git commit: Add support for writing 8 color PCX files.

Posted by ch...@apache.org.
Add support for writing 8 color PCX files.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1781791 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/56ca99fb
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/56ca99fb
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/56ca99fb

Branch: refs/heads/master
Commit: 56ca99fbb46c2a9dd1de472de7e71a7e74b97c70
Parents: e745858
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sun Feb 5 19:41:08 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sun Feb 5 19:41:08 2017 +0000

----------------------------------------------------------------------
 .../commons/imaging/formats/pcx/PcxWriter.java  | 71 ++++++++++++++++++--
 1 file changed, 65 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56ca99fb/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
index 3468df4..f774f0f 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
@@ -125,12 +125,14 @@ class PcxWriter {
             }
         } else if (palette.length() > 16 || bitDepth == 8) {
             write256ColorPCX(src, palette, bos);
-        } else if (palette.length() > 2 || bitDepth == 4) {
+        } else if (palette.length() > 8 || bitDepth == 4) {
             if (planes == 1) {
                 write16ColorPCXIn1Plane(src, palette, bos);
             } else {
                 write16ColorPCXIn4Planes(src, palette, bos);
             }
+        } else if (palette.length() > 2 || bitDepth == 3) {
+            write8ColorPcx(src, palette, bos);
         } else {
             boolean onlyBlackAndWhite = true;
             if (palette.length() >= 1) {
@@ -148,11 +150,7 @@ class PcxWriter {
             if (onlyBlackAndWhite) {
                 writeBlackAndWhitePCX(src, bos);
             } else {
-                if (planes == 1) {
-                    write16ColorPCXIn1Plane(src, palette, bos);
-                } else {
-                    write16ColorPCXIn4Planes(src, palette, bos);
-                }
+                write8ColorPcx(src, palette, bos);
             }
         }
     }
@@ -402,6 +400,67 @@ class PcxWriter {
         rleWriter.flush(bos);
     }
 
+    private void write8ColorPcx(final BufferedImage src, final SimplePalette palette,
+            final BinaryOutputStream bos) throws ImageWriteException, IOException {
+        int bytesPerLine = (src.getWidth() + 7) / 8;
+        if (bytesPerLine % 2 != 0) {
+            ++bytesPerLine;
+        }
+
+        final byte[] palette16 = new byte[16 * 3];
+        for (int i = 0; i < 8; i++) {
+            int rgb;
+            if (i < palette.length()) {
+                rgb = palette.getEntry(i);
+            } else {
+                rgb = 0;
+            }
+            palette16[3 * i + 0] = (byte) (0xff & (rgb >> 16));
+            palette16[3 * i + 1] = (byte) (0xff & (rgb >> 8));
+            palette16[3 * i + 2] = (byte) (0xff & rgb);
+        }
+
+        // PCX header
+        bos.write(10); // manufacturer
+        bos.write(5); // version
+        bos.write(encoding); // encoding
+        bos.write(1); // bits per pixel
+        bos.write2Bytes(0); // xMin
+        bos.write2Bytes(0); // yMin
+        bos.write2Bytes(src.getWidth() - 1); // xMax
+        bos.write2Bytes(src.getHeight() - 1); // yMax
+        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
+        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
+        bos.write(palette16); // 16 color palette
+        bos.write(0); // reserved
+        bos.write(3); // planes
+        bos.write2Bytes(bytesPerLine); // bytes per line
+        bos.write2Bytes(1); // palette info
+        bos.write2Bytes(0); // hScreenSize
+        bos.write2Bytes(0); // vScreenSize
+        bos.write(new byte[54]);
+
+        final byte[] plane0 = new byte[bytesPerLine];
+        final byte[] plane1 = new byte[bytesPerLine];
+        final byte[] plane2 = new byte[bytesPerLine];
+        for (int y = 0; y < src.getHeight(); y++) {
+            Arrays.fill(plane0, (byte)0);
+            Arrays.fill(plane1, (byte)0);
+            Arrays.fill(plane2, (byte)0);
+            for (int x = 0; x < src.getWidth(); x++) {
+                final int argb = src.getRGB(x, y);
+                final int index = palette.getPaletteIndex(0xffffff & argb);
+                plane0[x >>> 3] |= (index & 1) << (7 - (x & 7));
+                plane1[x >>> 3] |= ((index & 2) >> 1) << (7 - (x & 7));
+                plane2[x >>> 3] |= ((index & 4) >> 2) << (7 - (x & 7));
+            }
+            rleWriter.write(bos, plane0);
+            rleWriter.write(bos, plane1);
+            rleWriter.write(bos, plane2);
+        }
+        rleWriter.flush(bos);
+    }
+
     private void write256ColorPCX(final BufferedImage src, final SimplePalette palette,
             final BinaryOutputStream bos) throws ImageWriteException, IOException {
         final int bytesPerLine = src.getWidth() % 2 == 0 ? src.getWidth() : src.getWidth() + 1;


[17/50] [abbrv] commons-imaging git commit: Add final modifier to local variables.

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java b/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
index 91dfed9..0647eef 100644
--- a/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java
@@ -79,7 +79,7 @@ public class PngTextTest extends PngBaseTest {
 
         final List<PngText> readTexts = imageInfo.getTextChunks();
         assertEquals(readTexts.size(), 3);
-        for (PngText text : readTexts) {
+        for (final PngText text : readTexts) {
             if (text.keyword.equals("a")) {
                 assertEquals(text.text, "b");
             } else if (text.keyword.equals("c")) {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java b/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
index 4895f62..a33f782 100644
--- a/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
@@ -17,10 +17,10 @@ public class PnmImageParserTest {
 
     @Test
     public void testGetImageInfo_happyCase() throws ImageReadException, IOException {
-        byte[] bytes = "P1\n3 2\n0 1 0\n1 0 1\n".getBytes(US_ASCII);
-        Map<String, Object> params = Collections.emptyMap();
-        PnmImageParser underTest = new PnmImageParser();
-        ImageInfo results = underTest.getImageInfo(bytes, params);
+        final byte[] bytes = "P1\n3 2\n0 1 0\n1 0 1\n".getBytes(US_ASCII);
+        final Map<String, Object> params = Collections.emptyMap();
+        final PnmImageParser underTest = new PnmImageParser();
+        final ImageInfo results = underTest.getImageInfo(bytes, params);
         assertEquals(results.getBitsPerPixel(), 1);
         assertEquals(results.getWidth(), 3);
         assertEquals(results.getHeight(), 2);
@@ -33,25 +33,25 @@ public class PnmImageParserTest {
      */
     @Test(expected = ImageReadException.class)
     public void testGetImageInfo_invalidWidth() throws ImageReadException, IOException {
-        byte[] bytes = "P1\na 2\n0 0 0 0 0 0 0 0 0 0 0\n1 1 1 1 1 1 1 1 1 1 1\n".getBytes(US_ASCII);
-        Map<String, Object> params = Collections.emptyMap();
-        PnmImageParser underTest = new PnmImageParser();
+        final byte[] bytes = "P1\na 2\n0 0 0 0 0 0 0 0 0 0 0\n1 1 1 1 1 1 1 1 1 1 1\n".getBytes(US_ASCII);
+        final Map<String, Object> params = Collections.emptyMap();
+        final PnmImageParser underTest = new PnmImageParser();
         underTest.getImageInfo(bytes, params);
     }
 
     @Test(expected = ImageReadException.class)
     public void testGetImageInfo_invalidHeight() throws ImageReadException, IOException {
-        byte[] bytes = "P1\n2 a\n0 0\n0 0\n0 0\n0 0\n0 0\n0 1\n1 1\n1 1\n1 1\n1 1\n1 1\n".getBytes(US_ASCII);
-        Map<String, Object> params = Collections.emptyMap();
-        PnmImageParser underTest = new PnmImageParser();
+        final byte[] bytes = "P1\n2 a\n0 0\n0 0\n0 0\n0 0\n0 0\n0 1\n1 1\n1 1\n1 1\n1 1\n1 1\n".getBytes(US_ASCII);
+        final Map<String, Object> params = Collections.emptyMap();
+        final PnmImageParser underTest = new PnmImageParser();
         underTest.getImageInfo(bytes, params);
     }
 
     @Test(expected = ImageReadException.class)
     public void testGetImageInfo_missingWidthValue() throws ImageReadException, IOException {
-        byte[] bytes = "P7\nWIDTH \n".getBytes(US_ASCII);
-        Map<String, Object> params = Collections.emptyMap();
-        PnmImageParser underTest = new PnmImageParser();
+        final byte[] bytes = "P7\nWIDTH \n".getBytes(US_ASCII);
+        final Map<String, Object> params = Collections.emptyMap();
+        final PnmImageParser underTest = new PnmImageParser();
         underTest.getImageInfo(bytes, params);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
index 04e0815..f4d705c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
@@ -63,16 +63,16 @@ public class TiffLzwTest extends TiffBaseTest {
     @Test
     public void testTiffImageData() throws IOException, ImageReadException,
             ImageWriteException {
-        List<File> images = getTiffImages();
-        for (File image : images) {
+        final List<File> images = getTiffImages();
+        for (final File image : images) {
 
             Debug.debug("imageFile", image);
 
-            ByteSource byteSource = new ByteSourceFile(image);
-            List<byte[]> data = new TiffImageParser().collectRawImageData(byteSource,
+            final ByteSource byteSource = new ByteSourceFile(image);
+            final List<byte[]> data = new TiffImageParser().collectRawImageData(byteSource,
                     Collections.<String, Object>emptyMap());
 
-            for (byte[] bytes : data) {
+            for (final byte[] bytes : data) {
                 decompressRoundtripAndValidate(bytes);
             }
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
index 6a177d4..8f69a5f 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
@@ -41,18 +41,18 @@ public class TiffReadWriteTagsTest extends TiffBaseTest {
 
     @Test
     public void testReadWriteTags() throws ImageWriteException, ImageReadException, IOException {
-        String description = "A pretty picture";
-        short page = 1;
-        RationalNumber twoThirds = new RationalNumber(2, 3);
-        int t4Options = 0;
-        int width = 10;
-        short height = 10;
-        String area = "A good area";
-        float widthRes = 2.2f;
-        double geoDoubleParams = -8.4;
+        final String description = "A pretty picture";
+        final short page = 1;
+        final RationalNumber twoThirds = new RationalNumber(2, 3);
+        final int t4Options = 0;
+        final int width = 10;
+        final short height = 10;
+        final String area = "A good area";
+        final float widthRes = 2.2f;
+        final double geoDoubleParams = -8.4;
         
-        TiffOutputSet set = new TiffOutputSet();
-        TiffOutputDirectory dir = set.getOrCreateRootDirectory();
+        final TiffOutputSet set = new TiffOutputSet();
+        final TiffOutputDirectory dir = set.getOrCreateRootDirectory();
         dir.add(TiffTagConstants.TIFF_TAG_IMAGE_DESCRIPTION, description);
         dir.add(TiffTagConstants.TIFF_TAG_PAGE_NUMBER, page, page);
         dir.add(TiffTagConstants.TIFF_TAG_YRESOLUTION, twoThirds);
@@ -63,18 +63,18 @@ public class TiffReadWriteTagsTest extends TiffBaseTest {
         dir.add(MicrosoftHdPhotoTagConstants.EXIF_TAG_WIDTH_RESOLUTION, widthRes);
         dir.add(GeoTiffTagConstants.EXIF_TAG_GEO_DOUBLE_PARAMS_TAG, geoDoubleParams);
         
-        TiffImageWriterLossy writer = new TiffImageWriterLossy();
-        ByteArrayOutputStream tiff = new ByteArrayOutputStream();
+        final TiffImageWriterLossy writer = new TiffImageWriterLossy();
+        final ByteArrayOutputStream tiff = new ByteArrayOutputStream();
         writer.write(tiff, set);
         
-        TiffReader reader = new TiffReader(true);
-        Map<String, Object> params = new TreeMap<>();
-        FormatCompliance formatCompliance = new FormatCompliance("");
-        TiffContents contents = reader.readFirstDirectory(new ByteSourceArray(tiff.toByteArray()), params, true, formatCompliance);
-        TiffDirectory rootDir = contents.directories.get(0);
+        final TiffReader reader = new TiffReader(true);
+        final Map<String, Object> params = new TreeMap<>();
+        final FormatCompliance formatCompliance = new FormatCompliance("");
+        final TiffContents contents = reader.readFirstDirectory(new ByteSourceArray(tiff.toByteArray()), params, true, formatCompliance);
+        final TiffDirectory rootDir = contents.directories.get(0);
         assertEquals(description, rootDir.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_DESCRIPTION));
         assertEquals(page, rootDir.getFieldValue(TiffTagConstants.TIFF_TAG_PAGE_NUMBER, true)[0]);
-        RationalNumber yRes = rootDir.getFieldValue(TiffTagConstants.TIFF_TAG_YRESOLUTION);
+        final RationalNumber yRes = rootDir.getFieldValue(TiffTagConstants.TIFF_TAG_YRESOLUTION);
         assertEquals(twoThirds.numerator, yRes.numerator);
         assertEquals(twoThirds.divisor, yRes.divisor);
         assertEquals(t4Options, rootDir.getFieldValue(TiffTagConstants.TIFF_TAG_T4_OPTIONS));

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
index cf8a6c8..0f6838f 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
@@ -49,7 +49,7 @@ public class TiffRoundtripTest extends TiffBaseTest {
             final ImageInfo imageInfo = Imaging.getImageInfo(imageFile);
             assertNotNull(imageInfo);
 
-            BufferedImage image = Imaging.getBufferedImage(imageFile);
+            final BufferedImage image = Imaging.getBufferedImage(imageFile);
             assertNotNull(image);
 
             final int[] compressions = new int[]{

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
index bffda46..6aad65d 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
@@ -34,15 +34,15 @@ public class TiffSubImageTest extends TiffBaseTest {
 
     @Test
     public void testSubImage() throws ImageReadException, ImageWriteException, IOException {
-        BufferedImage src = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
-        byte[] imageBytes = Imaging.writeImageToBytes(src, ImageFormats.TIFF, null);
+        final BufferedImage src = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        final byte[] imageBytes = Imaging.writeImageToBytes(src, ImageFormats.TIFF, null);
         
-        Map<String, Object> params = new TreeMap<>();
+        final Map<String, Object> params = new TreeMap<>();
         params.put(TiffConstants.PARAM_KEY_SUBIMAGE_X, 0);
         params.put(TiffConstants.PARAM_KEY_SUBIMAGE_Y, 0);
         params.put(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, 2);
         params.put(TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, 3);
-        BufferedImage image = Imaging.getBufferedImage(imageBytes, params);
+        final BufferedImage image = Imaging.getBufferedImage(imageBytes, params);
         assertEquals(image.getWidth(), 2);
         assertEquals(image.getHeight(), 3);
     }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java
index b55cd70..9e42f01 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java
@@ -84,7 +84,7 @@ public class TiffTagIntegrityTest extends ImagingTest {
     }
 
     private void verifyFields(final Class<?> cls, final List<TagInfo> allTags) {
-        ArrayList<Integer> fieldTags = new ArrayList<>();
+        final ArrayList<Integer> fieldTags = new ArrayList<>();
         for (final Field field : cls.getFields()) {
             field.setAccessible(true);
             Object obj = null;
@@ -98,7 +98,7 @@ public class TiffTagIntegrityTest extends ImagingTest {
             if (!(obj instanceof TagInfo)) {
                 continue;
             }
-            TagInfo src = (TagInfo) obj;
+            final TagInfo src = (TagInfo) obj;
             if (src.tag == -1) {
                 // Skip TiffTagConstants.TIFF_TAG_UNKNOWN
                 continue;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectoryTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectoryTest.java
index cce1763..e7e35ac 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectoryTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectoryTest.java
@@ -39,11 +39,11 @@ public class TiffOutputDirectoryTest {
     public void testFindField() throws Exception {
         directory.add(TIFF_TAG_DOCUMENT_NAME, "Test.tiff");
 
-        TiffOutputField field = directory.findField(TIFF_TAG_DOCUMENT_NAME);
+        final TiffOutputField field = directory.findField(TIFF_TAG_DOCUMENT_NAME);
 
         assertNotNull(field);
         assertEquals(TIFF_TAG_DOCUMENT_NAME, field.tagInfo);
-        byte[] documentNameAsBytes = TIFF_TAG_DOCUMENT_NAME.encodeValue(TiffConstants.DEFAULT_TIFF_BYTE_ORDER, "Test.tiff");
+        final byte[] documentNameAsBytes = TIFF_TAG_DOCUMENT_NAME.encodeValue(TiffConstants.DEFAULT_TIFF_BYTE_ORDER, "Test.tiff");
         assertTrue(field.bytesEqual(documentNameAsBytes));
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSetTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSetTest.java
index 67ed6f3..90bc1de 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSetTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSetTest.java
@@ -41,7 +41,7 @@ public class TiffOutputSetTest {
     public void testImaging144() throws Exception {
         tiffOutputSet.setGPSInDegrees(1.0, 1.0);
 
-        TiffOutputField gpsVersionId = tiffOutputSet.findField(GpsTagConstants.GPS_TAG_GPS_VERSION_ID);
+        final TiffOutputField gpsVersionId = tiffOutputSet.findField(GpsTagConstants.GPS_TAG_GPS_VERSION_ID);
 
         assertNotNull(gpsVersionId);
         assertTrue(gpsVersionId.bytesEqual(GpsTagConstants.gpsVersion()));

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java b/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
index 2b0638d..287ded3 100644
--- a/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
+++ b/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
@@ -28,7 +28,7 @@ public class PaletteQuantizationTest extends ImagingTest {
 
     @Test
     public void testPaletteQuantization() throws ImageWriteException {
-        BufferedImage whiteImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        final BufferedImage whiteImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
         for (int y = 0; y < whiteImage.getHeight(); y++) {
             for (int x = 0; x < whiteImage.getWidth(); x++) {
                 whiteImage.setRGB(x, y, 0xFFFFFF);
@@ -36,7 +36,7 @@ public class PaletteQuantizationTest extends ImagingTest {
         }
         checkPaletteDetails(whiteImage, 10, 1);
         
-        BufferedImage whiteAndBlackImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        final BufferedImage whiteAndBlackImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
         for (int y = 0; y < whiteImage.getHeight(); y++) {
             for (int x = 0; x < 5; x++) {
                 whiteAndBlackImage.setRGB(x, y, 0xFFFFFF);
@@ -47,7 +47,7 @@ public class PaletteQuantizationTest extends ImagingTest {
         }
         checkPaletteDetails(whiteAndBlackImage, 10, 2);
         
-        BufferedImage rainbowImage = new BufferedImage(9, 10, BufferedImage.TYPE_INT_RGB);
+        final BufferedImage rainbowImage = new BufferedImage(9, 10, BufferedImage.TYPE_INT_RGB);
         for (int y = 0; y < whiteImage.getHeight(); y++) {
             for (int x = 0; x < 3; x++) {
                 rainbowImage.setRGB(x, y, 0xFF0000);
@@ -64,7 +64,7 @@ public class PaletteQuantizationTest extends ImagingTest {
     }
     
     private void checkPaletteDetails(final BufferedImage image, final int limit, final int expectedSize) throws ImageWriteException {
-        PaletteFactory paletteFactory = new PaletteFactory();
+        final PaletteFactory paletteFactory = new PaletteFactory();
         Palette palette;
 
         palette = paletteFactory.makeExactRgbPaletteSimple(image, limit);
@@ -93,7 +93,7 @@ public class PaletteQuantizationTest extends ImagingTest {
             //checkDithering(image, palette);
         }
         
-        MedianCutQuantizer medianCutQuantizer = new MedianCutQuantizer(true);
+        final MedianCutQuantizer medianCutQuantizer = new MedianCutQuantizer(true);
         palette = medianCutQuantizer.process(
                 image, limit, new MostPopulatedBoxesMedianCut(), false);
         assertEquals(expectedSize, palette.length());
@@ -104,15 +104,15 @@ public class PaletteQuantizationTest extends ImagingTest {
     }
     
     private void checkUniqueColors(final BufferedImage src, final Palette palette) throws ImageWriteException {
-        BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
+        final BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
         dst.getGraphics().drawImage(src, 0, 0, src.getWidth(), src.getHeight(), null);
         Dithering.applyFloydSteinbergDithering(dst, palette);
-        Palette ditheredPalette = new PaletteFactory().makeExactRgbPaletteSimple(dst, palette.length() * 2);
+        final Palette ditheredPalette = new PaletteFactory().makeExactRgbPaletteSimple(dst, palette.length() * 2);
         assertEquals(palette.length(), ditheredPalette.length());
     }
     
     private void checkPixelsAreIdentical(final BufferedImage src, final Palette palette) throws ImageWriteException {
-        BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
+        final BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
         dst.getGraphics().drawImage(src, 0, 0, src.getWidth(), src.getHeight(), null);
         Dithering.applyFloydSteinbergDithering(dst, palette);
         for (int y = 0; y < src.getHeight(); y++) {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/roundtrip/GrayscaleRountripTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/roundtrip/GrayscaleRountripTest.java b/src/test/java/org/apache/commons/imaging/roundtrip/GrayscaleRountripTest.java
index f5de332..5b60acc 100644
--- a/src/test/java/org/apache/commons/imaging/roundtrip/GrayscaleRountripTest.java
+++ b/src/test/java/org/apache/commons/imaging/roundtrip/GrayscaleRountripTest.java
@@ -45,7 +45,7 @@ public class GrayscaleRountripTest extends RoundtripBase {
 
     @Theory
     public void testGrayscaleRoundtrip(final BufferedImage testImage, final FormatInfo formatInfo) throws Exception {
-            boolean imageExact = formatInfo.colorSupport != FormatInfo.COLOR_BITMAP;
+            final boolean imageExact = formatInfo.colorSupport != FormatInfo.COLOR_BITMAP;
 
             roundtrip(formatInfo, testImage, "gray", imageExact);
     }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/38c8705a/src/test/java/org/apache/commons/imaging/roundtrip/NullParametersRoundtripTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/roundtrip/NullParametersRoundtripTest.java b/src/test/java/org/apache/commons/imaging/roundtrip/NullParametersRoundtripTest.java
index c5aad6a..1471541 100644
--- a/src/test/java/org/apache/commons/imaging/roundtrip/NullParametersRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/roundtrip/NullParametersRoundtripTest.java
@@ -43,7 +43,7 @@ public class NullParametersRoundtripTest extends RoundtripBase {
         Imaging.getImageSize(temp1, null);
         Imaging.getMetadata(temp1, null);
         Imaging.getICCProfile(temp1, null);
-        BufferedImage imageRead = Imaging.getBufferedImage(temp1, null);
+        final BufferedImage imageRead = Imaging.getBufferedImage(temp1, null);
 
         assertNotNull(imageRead);
     }


[24/50] [abbrv] commons-imaging git commit: Use try with resources.

Posted by ch...@apache.org.
Use try with resources.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775930 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/fabe22ad
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/fabe22ad
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/fabe22ad

Branch: refs/heads/master
Commit: fabe22ad4250319db5f5f125d27c8528093d29f0
Parents: 0c07670
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:26:38 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:26:38 2016 +0000

----------------------------------------------------------------------
 .../imaging/formats/tiff/write/TiffImageWriterLossless.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/fabe22ad/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
index 8e80447..0347fb4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
@@ -314,9 +314,10 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
 
         // write in the new items
         for (final TiffOutputItem outputItem : outputItems) {
-            final BufferOutputStream tos = new BufferOutputStream(output, (int) outputItem.getOffset());
-            final BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
-            outputItem.writeItem(bos);
+            try (final BinaryOutputStream bos = new BinaryOutputStream(
+                    new BufferOutputStream(output, (int) outputItem.getOffset()), byteOrder)) {
+                outputItem.writeItem(bos);
+            }
         }
 
         os.write(output);


[37/50] [abbrv] commons-imaging git commit: Allow giving PCX a hint as to the number of planes to use, and by default, write 16 color images using 4 planes of 1 bit instead of 1 plane of 4 bits, as GIMP and Apache OpenOffice support the former but not th

Posted by ch...@apache.org.
Allow giving PCX a hint as to the number of planes to use, and by default,
write 16 color images using 4 planes of 1 bit instead of 1 plane of 4 bits,
as GIMP and Apache OpenOffice support the former but not the latter.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1781785 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/e745858e
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/e745858e
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/e745858e

Branch: refs/heads/master
Commit: e745858e4942c5faa73af661b441e8c0d55d8b09
Parents: 2c61aaa
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sun Feb 5 17:07:51 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sun Feb 5 17:07:51 2017 +0000

----------------------------------------------------------------------
 .../imaging/formats/pcx/PcxConstants.java       |  2 +
 .../commons/imaging/formats/pcx/PcxWriter.java  | 91 +++++++++++++++++++-
 2 files changed, 90 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/e745858e/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
index 864123a..a491786 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
@@ -22,6 +22,8 @@ public final class PcxConstants {
 
     public static final String PARAM_KEY_PCX_BIT_DEPTH = "PCX_BIT_DEPTH";
 
+    public static final String PARAM_KEY_PCX_PLANES = "PCX_PLANES";
+    
     private PcxConstants() {
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/e745858e/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
index 8b758a5..3468df4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
@@ -33,6 +33,7 @@ import org.apache.commons.imaging.palette.SimplePalette;
 class PcxWriter {
     private int encoding;
     private int bitDepth = -1;
+    private int planes = -1;
     private PixelDensity pixelDensity;
     private final RleWriter rleWriter;
 
@@ -77,6 +78,17 @@ class PcxWriter {
                 bitDepth = ((Number) value).intValue();
             }
         }
+        
+        if (params.containsKey(PcxConstants.PARAM_KEY_PCX_PLANES)) {
+            final Object value = params.remove(PcxConstants.PARAM_KEY_PCX_PLANES);
+            if (value != null) {
+                if (!(value instanceof Number)) {
+                    throw new ImageWriteException(
+                            "Invalid planes parameter: " + value);
+                }
+                planes = ((Number) value).intValue();
+            }
+        }
 
         if (params.containsKey(ImagingConstants.PARAM_KEY_PIXEL_DENSITY)) {
             final Object value = params.remove(ImagingConstants.PARAM_KEY_PIXEL_DENSITY);
@@ -114,7 +126,11 @@ class PcxWriter {
         } else if (palette.length() > 16 || bitDepth == 8) {
             write256ColorPCX(src, palette, bos);
         } else if (palette.length() > 2 || bitDepth == 4) {
-            write16ColorPCX(src, palette, bos);
+            if (planes == 1) {
+                write16ColorPCXIn1Plane(src, palette, bos);
+            } else {
+                write16ColorPCXIn4Planes(src, palette, bos);
+            }
         } else {
             boolean onlyBlackAndWhite = true;
             if (palette.length() >= 1) {
@@ -132,7 +148,11 @@ class PcxWriter {
             if (onlyBlackAndWhite) {
                 writeBlackAndWhitePCX(src, bos);
             } else {
-                write16ColorPCX(src, palette, bos);
+                if (planes == 1) {
+                    write16ColorPCXIn1Plane(src, palette, bos);
+                } else {
+                    write16ColorPCXIn4Planes(src, palette, bos);
+                }
             }
         }
     }
@@ -264,7 +284,7 @@ class PcxWriter {
         rleWriter.flush(bos);
     }
 
-    private void write16ColorPCX(final BufferedImage src, final SimplePalette palette,
+    private void write16ColorPCXIn1Plane(final BufferedImage src, final SimplePalette palette,
             final BinaryOutputStream bos) throws ImageWriteException, IOException {
         int bytesPerLine = (src.getWidth() + 1) / 2;
         if (bytesPerLine % 2 != 0) {
@@ -317,6 +337,71 @@ class PcxWriter {
         rleWriter.flush(bos);
     }
 
+    private void write16ColorPCXIn4Planes(final BufferedImage src, final SimplePalette palette,
+            final BinaryOutputStream bos) throws ImageWriteException, IOException {
+        int bytesPerLine = (src.getWidth() + 7) / 8;
+        if (bytesPerLine % 2 != 0) {
+            ++bytesPerLine;
+        }
+
+        final byte[] palette16 = new byte[16 * 3];
+        for (int i = 0; i < 16; i++) {
+            int rgb;
+            if (i < palette.length()) {
+                rgb = palette.getEntry(i);
+            } else {
+                rgb = 0;
+            }
+            palette16[3 * i + 0] = (byte) (0xff & (rgb >> 16));
+            palette16[3 * i + 1] = (byte) (0xff & (rgb >> 8));
+            palette16[3 * i + 2] = (byte) (0xff & rgb);
+        }
+
+        // PCX header
+        bos.write(10); // manufacturer
+        bos.write(5); // version
+        bos.write(encoding); // encoding
+        bos.write(1); // bits per pixel
+        bos.write2Bytes(0); // xMin
+        bos.write2Bytes(0); // yMin
+        bos.write2Bytes(src.getWidth() - 1); // xMax
+        bos.write2Bytes(src.getHeight() - 1); // yMax
+        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
+        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
+        bos.write(palette16); // 16 color palette
+        bos.write(0); // reserved
+        bos.write(4); // planes
+        bos.write2Bytes(bytesPerLine); // bytes per line
+        bos.write2Bytes(1); // palette info
+        bos.write2Bytes(0); // hScreenSize
+        bos.write2Bytes(0); // vScreenSize
+        bos.write(new byte[54]);
+
+        final byte[] plane0 = new byte[bytesPerLine];
+        final byte[] plane1 = new byte[bytesPerLine];
+        final byte[] plane2 = new byte[bytesPerLine];
+        final byte[] plane3 = new byte[bytesPerLine];
+        for (int y = 0; y < src.getHeight(); y++) {
+            Arrays.fill(plane0, (byte)0);
+            Arrays.fill(plane1, (byte)0);
+            Arrays.fill(plane2, (byte)0);
+            Arrays.fill(plane3, (byte)0);
+            for (int x = 0; x < src.getWidth(); x++) {
+                final int argb = src.getRGB(x, y);
+                final int index = palette.getPaletteIndex(0xffffff & argb);
+                plane0[x >>> 3] |= (index & 1) << (7 - (x & 7));
+                plane1[x >>> 3] |= ((index & 2) >> 1) << (7 - (x & 7));
+                plane2[x >>> 3] |= ((index & 4) >> 2) << (7 - (x & 7));
+                plane3[x >>> 3] |= ((index & 8) >> 3) << (7 - (x & 7));
+            }
+            rleWriter.write(bos, plane0);
+            rleWriter.write(bos, plane1);
+            rleWriter.write(bos, plane2);
+            rleWriter.write(bos, plane3);
+        }
+        rleWriter.flush(bos);
+    }
+
     private void write256ColorPCX(final BufferedImage src, final SimplePalette palette,
             final BinaryOutputStream bos) throws ImageWriteException, IOException {
         final int bytesPerLine = src.getWidth() % 2 == 0 ? src.getWidth() : src.getWidth() + 1;


[08/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775878 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/650fa548
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/650fa548
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/650fa548

Branch: refs/heads/master
Commit: 650fa548a0e7f1192cbfa2297637c536b65f6f38
Parents: 4e0d10a
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:19:25 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:19:25 2016 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/xpm/XpmImageParser.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/650fa548/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index dd0122c..c8b0508 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -239,8 +239,7 @@ public class XpmImageParser extends ImageParser {
 
     private XpmHeader readXpmHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
-        final XpmParseResult result = parseXpmHeader(byteSource);
-        return result.xpmHeader;
+        return parseXpmHeader(byteSource).xpmHeader;
     }
 
     private XpmParseResult parseXpmHeader(final ByteSource byteSource)


[47/50] [abbrv] commons-imaging git commit: Remove unused property

Posted by ch...@apache.org.
Remove unused property

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795462 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/2127270f
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/2127270f
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/2127270f

Branch: refs/heads/master
Commit: 2127270f3d4e930d4db1cef7ef1d39baca6ce63f
Parents: cfeff18
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:43:05 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:43:05 2017 +0000

----------------------------------------------------------------------
 .../apache/commons/imaging/common/BinaryOutputStream.java   | 9 ---------
 1 file changed, 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/2127270f/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java b/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
index 56b3ced..202dfb0 100644
--- a/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
+++ b/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
@@ -24,17 +24,8 @@ public class BinaryOutputStream extends OutputStream {
     private final OutputStream os;
     // default byte order for Java, many file formats.
     private ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
-    private boolean debug;
     private int count;
 
-    public final void setDebug(final boolean b) {
-        debug = b;
-    }
-
-    public final boolean getDebug() {
-        return debug;
-    }
-
     public BinaryOutputStream(final OutputStream os, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
         this.os = os;


[09/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775879 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/23c17bfd
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/23c17bfd
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/23c17bfd

Branch: refs/heads/master
Commit: 23c17bfd1736ba20d14fdb9227ea6ac2bce0e8d9
Parents: 650fa54
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:19:48 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:19:48 2016 +0000

----------------------------------------------------------------------
 src/main/java/org/apache/commons/imaging/Imaging.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/23c17bfd/src/main/java/org/apache/commons/imaging/Imaging.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java
index bab9ff0..fc3a5d1 100644
--- a/src/main/java/org/apache/commons/imaging/Imaging.java
+++ b/src/main/java/org/apache/commons/imaging/Imaging.java
@@ -703,9 +703,7 @@ public final class Imaging {
 
     private static ImageInfo getImageInfo(final ByteSource byteSource, final Map<String, Object> params)
             throws ImageReadException, IOException {
-        final ImageParser imageParser = getImageParser(byteSource);
-
-        return imageParser.getImageInfo(byteSource, params);
+        return getImageParser(byteSource).getImageInfo(byteSource, params);
     }
 
     private static ImageParser getImageParser(final ByteSource byteSource)


[06/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775876 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/d272f274
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/d272f274
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/d272f274

Branch: refs/heads/master
Commit: d272f2745d227d6a72937d2fbcc3907a758e6431
Parents: c067996
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:18:27 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:18:27 2016 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/d272f274/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
index 7383fb2..79b1454 100644
--- a/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
@@ -158,8 +158,7 @@ public class WbmpImageParser extends ImageParser {
     private WbmpHeader readWbmpHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
         try (InputStream is = byteSource.getInputStream()) {
-            final WbmpHeader ret = readWbmpHeader(is);
-            return ret;
+            return readWbmpHeader(is);
         }
     }
 


[02/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775871 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/ed36249c
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/ed36249c
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/ed36249c

Branch: refs/heads/master
Commit: ed36249c2162632b4d1dbdd89152d12c5fab35a9
Parents: 7f3d659
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:14:54 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:14:54 2016 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/psd/PsdImageParser.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/ed36249c/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
index 454cf32..5dc1417 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
@@ -377,8 +377,7 @@ public class PsdImageParser extends ImageParser {
     private PsdImageContents readImageContents(final ByteSource byteSource)
             throws ImageReadException, IOException {
         try (InputStream is = byteSource.getInputStream()) {
-            final PsdImageContents imageContents = readImageContents(is);
-            return imageContents;
+            return readImageContents(is);
         }
     }
 


[22/50] [abbrv] commons-imaging git commit: Use try with resources.

Posted by ch...@apache.org.
Use try with resources.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775928 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/20515734
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/20515734
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/20515734

Branch: refs/heads/master
Commit: 20515734fb4a2567afc6fc8a8a39257e69b4aab8
Parents: 3ec9067
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:23:07 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:23:07 2016 +0000

----------------------------------------------------------------------
 .../tiff/datareaders/DataReaderTiled.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/20515734/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
index 9864e06..91ca4c5 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
@@ -115,40 +115,40 @@ public final class DataReaderTiled extends ImageDataReader {
 
         // End of May 2012 changes
 
-        final BitInputStream bis = new BitInputStream(new ByteArrayInputStream(bytes), byteOrder);
+        try (final BitInputStream bis = new BitInputStream(new ByteArrayInputStream(bytes), byteOrder)) {
 
-        final int pixelsPerTile = tileWidth * tileLength;
+            final int pixelsPerTile = tileWidth * tileLength;
 
-        int tileX = 0;
-        int tileY = 0;
+            int tileX = 0;
+            int tileY = 0;
 
-        int[] samples = new int[bitsPerSampleLength];
-        resetPredictor();
-        for (int i = 0; i < pixelsPerTile; i++) {
+            int[] samples = new int[bitsPerSampleLength];
+            resetPredictor();
+            for (int i = 0; i < pixelsPerTile; i++) {
 
-            final int x = tileX + startX;
-            final int y = tileY + startY;
+                final int x = tileX + startX;
+                final int y = tileY + startY;
 
-            getSamplesAsBytes(bis, samples);
+                getSamplesAsBytes(bis, samples);
 
-            if ((x < xLimit) && (y < yLimit)) {
-                samples = applyPredictor(samples);
-                photometricInterpreter.interpretPixel(imageBuilder, samples, x,
-                        y);
-            }
+                if ((x < xLimit) && (y < yLimit)) {
+                    samples = applyPredictor(samples);
+                    photometricInterpreter.interpretPixel(imageBuilder, samples, x, y);
+                }
 
-            tileX++;
+                tileX++;
 
-            if (tileX >= tileWidth) {
-                tileX = 0;
-                resetPredictor();
-                tileY++;
-                bis.flushCache();
-                if (tileY >= tileLength) {
-                    break;
+                if (tileX >= tileWidth) {
+                    tileX = 0;
+                    resetPredictor();
+                    tileY++;
+                    bis.flushCache();
+                    if (tileY >= tileLength) {
+                        break;
+                    }
                 }
-            }
 
+            }
         }
     }
 


[49/50] [abbrv] commons-imaging git commit: Fix Checkstyle error: Static variable definition in wrong order.

Posted by ch...@apache.org.
Fix Checkstyle error: Static variable definition in wrong order.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795464 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/8a583a2d
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/8a583a2d
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/8a583a2d

Branch: refs/heads/master
Commit: 8a583a2d0b57a3e48c18c88add79e2061c39fe19
Parents: a9cca21
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:45:32 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:45:32 2017 +0000

----------------------------------------------------------------------
 .../commons/imaging/common/bytesource/ByteSourceInputStream.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/8a583a2d/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
index 58dbfeb..b5603dc 100644
--- a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
+++ b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
@@ -24,9 +24,10 @@ import java.io.InputStream;
 import org.apache.commons.imaging.common.BinaryFunctions;
 
 public class ByteSourceInputStream extends ByteSource {
+    private static final int BLOCK_SIZE = 1024;
+
     private final InputStream is;
     private CacheBlock cacheHead;
-    private static final int BLOCK_SIZE = 1024;
     private byte[] readBuffer;
     private long streamLength = -1;
 


[27/50] [abbrv] commons-imaging git commit: Use try with resources.

Posted by ch...@apache.org.
Use try with resources.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775933 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/72af6b47
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/72af6b47
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/72af6b47

Branch: refs/heads/master
Commit: 72af6b4741626fa0e5b41faf3f591c5650d8df1b
Parents: be1c511
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:32:07 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:32:07 2016 +0000

----------------------------------------------------------------------
 .../commons/imaging/common/bytesource/ByteSourceDataTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/72af6b47/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
index 0cb154c..1c4e646 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
@@ -107,10 +107,11 @@ public class ByteSourceDataTest extends ByteSourceTest {
 
         // test cache by completely reading InputStream N times.
         for (int j = 0; j < 5; j++) {
-            final InputStream is = byteSource.getInputStream();
-            final byte dst[] = IOUtils.toByteArray(is);
+            try (final InputStream is = byteSource.getInputStream()) {
+                final byte dst[] = IOUtils.toByteArray(is);
 
-            assertArrayEquals(src, dst);
+                assertArrayEquals(src, dst);
+            }
         }
 
         {


[16/50] [abbrv] commons-imaging git commit: Add final modifier to method parameters.

Posted by ch...@apache.org.
Add final modifier to method parameters.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775888 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/56e0133a
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/56e0133a
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/56e0133a

Branch: refs/heads/master
Commit: 56e0133a0f9b7c89eb180696b13e53ba38007beb
Parents: b232532
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:58:51 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:58:51 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/commons/imaging/ColorTools.java     |  2 +-
 src/main/java/org/apache/commons/imaging/ImageInfo.java |  4 ++--
 .../org/apache/commons/imaging/color/ColorCieLab.java   |  2 +-
 .../org/apache/commons/imaging/color/ColorCieLch.java   |  2 +-
 .../org/apache/commons/imaging/color/ColorCieLuv.java   |  2 +-
 .../java/org/apache/commons/imaging/color/ColorCmy.java |  2 +-
 .../org/apache/commons/imaging/color/ColorCmyk.java     |  2 +-
 .../java/org/apache/commons/imaging/color/ColorHsl.java |  2 +-
 .../java/org/apache/commons/imaging/color/ColorHsv.java |  2 +-
 .../apache/commons/imaging/color/ColorHunterLab.java    |  2 +-
 .../java/org/apache/commons/imaging/color/ColorXyz.java |  2 +-
 .../commons/imaging/formats/bmp/BmpImageContents.java   |  2 +-
 .../apache/commons/imaging/formats/icns/IcnsType.java   |  2 +-
 .../commons/imaging/formats/jpeg/JpegImageParser.java   |  2 +-
 .../imaging/formats/jpeg/segments/App14Segment.java     |  4 ++--
 .../imaging/formats/jpeg/segments/AppnSegment.java      |  2 +-
 .../imaging/formats/jpeg/segments/ComSegment.java       |  2 +-
 .../imaging/formats/jpeg/segments/DhtSegment.java       |  8 ++++----
 .../imaging/formats/jpeg/segments/GenericSegment.java   |  6 +++---
 .../imaging/formats/jpeg/segments/UnknownSegment.java   |  2 +-
 .../commons/imaging/formats/png/InterlaceMethod.java    |  2 +-
 .../commons/imaging/formats/png/PngColorType.java       |  8 ++++----
 .../commons/imaging/formats/png/PngImageParser.java     |  2 +-
 .../apache/commons/imaging/formats/png/PngWriter.java   |  2 +-
 .../commons/imaging/formats/png/ScanExpediter.java      |  2 +-
 .../imaging/formats/png/ScanExpediterInterlaced.java    | 12 ++++++------
 .../imaging/formats/png/chunks/PngChunkIdat.java        |  2 +-
 .../imaging/formats/png/chunks/PngChunkIhdr.java        |  2 +-
 .../imaging/formats/png/chunks/PngChunkPhys.java        |  2 +-
 .../imaging/formats/png/chunks/PngChunkScal.java        |  2 +-
 .../png/transparencyfilters/TransparencyFilter.java     |  2 +-
 .../TransparencyFilterGrayscale.java                    |  2 +-
 .../TransparencyFilterTrueColor.java                    |  2 +-
 .../apache/commons/imaging/formats/pnm/PgmWriter.java   |  2 +-
 .../apache/commons/imaging/formats/pnm/PpmWriter.java   |  2 +-
 .../commons/imaging/formats/psd/ImageResourceType.java  |  4 ++--
 .../commons/imaging/formats/psd/PsdHeaderInfo.java      |  2 +-
 .../commons/imaging/formats/tiff/TiffDirectory.java     |  2 +-
 .../commons/imaging/formats/tiff/TiffImageData.java     |  2 +-
 .../apache/commons/imaging/formats/tiff/TiffTags.java   |  2 +-
 .../formats/tiff/datareaders/ImageDataReader.java       |  2 +-
 .../photometricinterpreters/PhotometricInterpreter.java |  2 +-
 .../apache/commons/imaging/palette/ColorComponent.java  |  4 ++--
 .../apache/commons/imaging/ImagingGuessFormatTest.java  |  2 +-
 .../commons/imaging/common/RationalNumberTest.java      |  2 +-
 .../imaging/common/bytesource/ByteSourceDataTest.java   |  2 +-
 .../imaging/common/bytesource/ByteSourceImageTest.java  |  2 +-
 .../apache/commons/imaging/formats/bmp/BmpReadTest.java |  2 +-
 .../apache/commons/imaging/formats/dcx/DcxReadTest.java |  2 +-
 .../apache/commons/imaging/formats/gif/GifReadTest.java |  2 +-
 .../commons/imaging/formats/icns/IcnsReadTest.java      |  2 +-
 .../apache/commons/imaging/formats/ico/IcoReadTest.java |  2 +-
 .../commons/imaging/formats/jpeg/JpegReadTest.java      |  2 +-
 .../commons/imaging/formats/jpeg/exif/ExifDumpTest.java |  2 +-
 .../commons/imaging/formats/jpeg/exif/GpsTest.java      |  2 +-
 .../imaging/formats/jpeg/exif/MakerNoteFieldTest.java   |  2 +-
 .../imaging/formats/jpeg/exif/MicrosoftTagTest.java     |  2 +-
 .../imaging/formats/jpeg/exif/SpecificExifTagTest.java  |  2 +-
 .../imaging/formats/jpeg/exif/TextFieldTest.java        |  2 +-
 .../formats/jpeg/exif/WriteExifMetadataExampleTest.java |  2 +-
 .../commons/imaging/formats/jpeg/iptc/IptcAddTest.java  |  2 +-
 .../commons/imaging/formats/jpeg/iptc/IptcDumpTest.java |  2 +-
 .../imaging/formats/jpeg/iptc/IptcFullDiscardTest.java  |  4 ++--
 .../imaging/formats/jpeg/iptc/IptcUpdateTest.java       |  6 +++---
 .../imaging/formats/jpeg/xmp/JpegXmpDumpTest.java       |  2 +-
 .../imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java    |  2 +-
 .../imaging/palette/PaletteQuantizationTest.java        |  6 +++---
 .../commons/imaging/roundtrip/BitmapRoundtripTest.java  |  2 +-
 68 files changed, 90 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/ColorTools.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/ColorTools.java b/src/main/java/org/apache/commons/imaging/ColorTools.java
index e4fb115..7f50f64 100644
--- a/src/main/java/org/apache/commons/imaging/ColorTools.java
+++ b/src/main/java/org/apache/commons/imaging/ColorTools.java
@@ -185,7 +185,7 @@ public class ColorTools {
         return convertBetweenColorSpaces(bi, from, srgbCM.getColorSpace());
     }
 
-    public BufferedImage convertBetweenICCProfiles(BufferedImage bi, ICC_Profile from, ICC_Profile to) {
+    public BufferedImage convertBetweenICCProfiles(final BufferedImage bi, final ICC_Profile from, final ICC_Profile to) {
         final ICC_ColorSpace csFrom = new ICC_ColorSpace(from);
         final ICC_ColorSpace csTo = new ICC_ColorSpace(to);
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/ImageInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/ImageInfo.java b/src/main/java/org/apache/commons/imaging/ImageInfo.java
index 781ed0d..e9de2ef 100644
--- a/src/main/java/org/apache/commons/imaging/ImageInfo.java
+++ b/src/main/java/org/apache/commons/imaging/ImageInfo.java
@@ -40,7 +40,7 @@ public class ImageInfo {
 
         private String description;
 
-        ColorType(String description) {
+        ColorType(final String description) {
             this.description = description;
         }
 
@@ -66,7 +66,7 @@ public class ImageInfo {
 
         private String description;
 
-        CompressionAlgorithm(String description) {
+        CompressionAlgorithm(final String description) {
             this.description = description;
         }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java b/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
index d04b47e..e9167f2 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
@@ -84,7 +84,7 @@ public final class ColorCieLab {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java b/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
index b9f56a4..8c9314a 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
@@ -84,7 +84,7 @@ public final class ColorCieLch {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java b/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
index 20e4a45..456aa36 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
@@ -84,7 +84,7 @@ public final class ColorCieLuv {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCmy.java b/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
index e8da778..15a1483 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
@@ -114,7 +114,7 @@ public final class ColorCmy {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java b/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
index da65fdf..15e1858 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
@@ -124,7 +124,7 @@ public final class ColorCmyk {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorHsl.java b/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
index c167651..c08b3d8 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
@@ -84,7 +84,7 @@ public final class ColorHsl {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorHsv.java b/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
index 39ca880..4e2b63a 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
@@ -84,7 +84,7 @@ public final class ColorHsv {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java b/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
index cbb4db3..ee719d8 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
@@ -84,7 +84,7 @@ public final class ColorHunterLab {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorXyz.java b/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
index 1c30989..68491e2 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
@@ -84,7 +84,7 @@ public final class ColorXyz {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageContents.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageContents.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageContents.java
index ce56e7f..c3197b3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageContents.java
+++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageContents.java
@@ -23,7 +23,7 @@ class BmpImageContents {
     final byte[] imageData;
     final PixelParser pixelParser;
 
-    public BmpImageContents(BmpHeaderInfo bhi, byte[] colorTable, byte[] imageData, PixelParser pixelParser) {
+    public BmpImageContents(final BmpHeaderInfo bhi, final byte[] colorTable, final byte[] imageData, final PixelParser pixelParser) {
         this.bhi = bhi;
         this.colorTable = colorTable;
         this.imageData = imageData;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
index 6d9a4fd..276da92 100644
--- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
@@ -85,7 +85,7 @@ enum IcnsType {
     private final int bitsPerPixel;
     private final boolean hasMask;
 
-    private IcnsType(String type, int width, int height, int bitsPerPixel, boolean hasMask) {
+    private IcnsType(final String type, final int width, final int height, final int bitsPerPixel, final boolean hasMask) {
         this.type = typeAsInt(type);
         this.width = width;
         this.height = height;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
index 5ce2362..6b11c3a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
@@ -199,7 +199,7 @@ public class JpegImageParser extends ImageParser {
         return result;
     }
 
-    private byte[] assembleSegments(List<App2Segment> segments) throws ImageReadException {
+    private byte[] assembleSegments(final List<App2Segment> segments) throws ImageReadException {
         try {
             return assembleSegments(segments, false);
         } catch (ImageReadException e) {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
index e49877a..2685666 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
@@ -41,11 +41,11 @@ public class App14Segment extends AppnSegment {
         ADOBE_PREFIX = adobe;
     }
 
-    public App14Segment(int marker, byte[] segmentData) throws IOException {
+    public App14Segment(final int marker, final byte[] segmentData) throws IOException {
         this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
     }
     
-    public App14Segment(int marker, int markerLength, InputStream is) throws IOException {
+    public App14Segment(final int marker, final int markerLength, final InputStream is) throws IOException {
         super(marker, markerLength, is);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
index bee3a41..c6f3bd6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
@@ -23,7 +23,7 @@ import org.apache.commons.imaging.formats.jpeg.JpegConstants;
 
 public class AppnSegment extends GenericSegment {
 
-    public AppnSegment(int marker, int markerLength, InputStream is) throws IOException {
+    public AppnSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
         super(marker, markerLength, is);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
index e211aca..5665f67 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
@@ -25,7 +25,7 @@ public class ComSegment extends GenericSegment {
         super(marker, segmentData);
     }
 
-    public ComSegment(int marker, int markerLength, InputStream is) throws IOException {
+    public ComSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
         super(marker, markerLength, is);
     }
     

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
index 2f106d5..81cfd20 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
@@ -114,19 +114,19 @@ public class DhtSegment extends Segment {
 
         }
 
-        public int getHuffVal(int i) {
+        public int getHuffVal(final int i) {
             return huffVal[i];
         }
 
-        public int getMinCode(int i) {
+        public int getMinCode(final int i) {
             return minCode[i];
         }
 
-        public int getMaxCode(int i) {
+        public int getMaxCode(final int i) {
             return maxCode[i];
         }
 
-        public int getValPtr(int i) {
+        public int getValPtr(final int i) {
             return valPtr[i];
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
index 3aa49c0..e557f71 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
@@ -26,7 +26,7 @@ import static org.apache.commons.imaging.common.BinaryFunctions.*;
 public abstract class GenericSegment extends Segment {
     private final byte[] segmentData;
 
-    public GenericSegment(int marker, int markerLength, InputStream is) throws IOException {
+    public GenericSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
         super(marker, markerLength);
 
         segmentData = readBytes("Segment Data", is, markerLength, "Invalid Segment: insufficient data");
@@ -66,7 +66,7 @@ public abstract class GenericSegment extends Segment {
      * @see GenericSegment#getSegmentData()
      * @return the bye in the segment's contents
      */
-    protected byte getSegmentData(int offset) {
+    protected byte getSegmentData(final int offset) {
         return segmentData[offset];
     }
 
@@ -76,7 +76,7 @@ public abstract class GenericSegment extends Segment {
      * @return the encoded bytes
      * @throws UnsupportedEncodingException
      */
-    public String getSegmentDataAsString(String encoding) throws UnsupportedEncodingException {
+    public String getSegmentDataAsString(final String encoding) throws UnsupportedEncodingException {
         return new String(segmentData, encoding);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
index c94f37c..e52f7ed 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
@@ -20,7 +20,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 public class UnknownSegment extends GenericSegment {
-    public UnknownSegment(int marker, int markerLength, InputStream is) throws IOException {
+    public UnknownSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
         super(marker, markerLength, is);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java b/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
index c8d890d..c25cdd9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
@@ -28,7 +28,7 @@ public enum InterlaceMethod {
 
     private final boolean progressive;
 
-    private InterlaceMethod(boolean progressive) {
+    private InterlaceMethod(final boolean progressive) {
         this.progressive = progressive;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
index 27a1ce6..4be7660 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
@@ -35,7 +35,7 @@ public enum PngColorType {
     private final int samplesPerPixel;
     private final int[] allowedBitDepths;
 
-    PngColorType(int value, boolean greyscale, boolean alpha, int samplesPerPixel, int[] allowedBitDepths) {
+    PngColorType(final int value, final boolean greyscale, final boolean alpha, final int samplesPerPixel, final int[] allowedBitDepths) {
         this.value = value;
         this.greyscale = greyscale;
         this.alpha = alpha;
@@ -59,11 +59,11 @@ public enum PngColorType {
         return samplesPerPixel;
     }
 
-    boolean isBitDepthAllowed(int bitDepth) {
+    boolean isBitDepthAllowed(final int bitDepth) {
         return Arrays.binarySearch(allowedBitDepths, bitDepth) >= 0;
     }
 
-    public static PngColorType getColorType(int value) {
+    public static PngColorType getColorType(final int value) {
         for (PngColorType type : values()) {
             if (type.value == value) {
                 return type;
@@ -73,7 +73,7 @@ public enum PngColorType {
         return null;
     }
 
-    static PngColorType getColorType(boolean alpha, boolean grayscale) {
+    static PngColorType getColorType(final boolean alpha, final boolean grayscale) {
         if (grayscale) {
             if (alpha) {
                 return PngColorType.GREYSCALE_WITH_ALPHA;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
index be37af3..0dfa167 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
@@ -306,7 +306,7 @@ public class PngImageParser extends ImageParser {
     // BinaryFileParser
     // I may not have always preserved byte order correctly.
 
-    private TransparencyFilter getTransparencyFilter(PngColorType pngColorType, PngChunk pngChunktRNS)
+    private TransparencyFilter getTransparencyFilter(final PngColorType pngColorType, final PngChunk pngChunktRNS)
             throws ImageReadException, IOException {
         switch (pngColorType) {
             case GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale sample.

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
index 6edb2b8..2589a14 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
@@ -97,7 +97,7 @@ class PngWriter {
 
         public ImageHeader(final int width, final int height, final byte bitDepth,
                 final PngColorType pngColorType, final byte compressionMethod, final byte filterMethod,
-                InterlaceMethod interlaceMethod) {
+                final InterlaceMethod interlaceMethod) {
             this.width = width;
             this.height = height;
             this.bitDepth = bitDepth;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
index 073abb7..4d58f79 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
@@ -171,7 +171,7 @@ abstract class ScanExpediter {
         }
     }
 
-    ScanlineFilter getScanlineFilter(FilterType filterType, int bytesPerPixel) throws ImageReadException {
+    ScanlineFilter getScanlineFilter(final FilterType filterType, final int bytesPerPixel) throws ImageReadException {
         switch (filterType) {
             case NONE:
                 return new ScanlineFilterNone();

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
index 3def0e3..8e8a513 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
@@ -32,12 +32,12 @@ class ScanExpediterInterlaced extends ScanExpediter {
 //    private static final int Block_Height[] = { 8, 8, 4, 4, 2, 2, 1 };
 //    private static final int Block_Width[] = { 8, 4, 4, 2, 2, 1, 1 };
 
-    ScanExpediterInterlaced(int width, int height, InputStream is,
-            BufferedImage bi,
-            PngColorType pngColorType, int bitDepth, int bitsPerPixel,
-            PngChunkPlte fPNGChunkPLTE,
-            GammaCorrection gammaCorrection,
-            TransparencyFilter transparencyFilter)
+    ScanExpediterInterlaced(final int width, final int height, final InputStream is,
+            final BufferedImage bi,
+            final PngColorType pngColorType, final int bitDepth, final int bitsPerPixel,
+            final PngChunkPlte fPNGChunkPLTE,
+            final GammaCorrection gammaCorrection,
+            final TransparencyFilter transparencyFilter)
 
     {
         super(width, height, is, bi, pngColorType, bitDepth, bitsPerPixel,

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java
index 27dcaf7..171ecbd 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java
@@ -18,7 +18,7 @@ package org.apache.commons.imaging.formats.png.chunks;
 
 public class PngChunkIdat extends PngChunk {
 
-    public PngChunkIdat(int length, int chunkType, int crc, byte[] bytes) {
+    public PngChunkIdat(final int length, final int chunkType, final int crc, final byte[] bytes) {
         super(length, chunkType, crc, bytes);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
index dda2282..cb5ffab 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
@@ -34,7 +34,7 @@ public class PngChunkIhdr extends PngChunk {
     public final int filterMethod;
     public final InterlaceMethod interlaceMethod;
 
-    public PngChunkIhdr(int length, int chunkType, int crc, byte[] bytes) throws ImageReadException, IOException {
+    public PngChunkIhdr(final int length, final int chunkType, final int crc, final byte[] bytes) throws ImageReadException, IOException {
         super(length, chunkType, crc, bytes);
 
         final ByteArrayInputStream is = new ByteArrayInputStream(bytes);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java
index 2e37dd3..2fd914d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java
@@ -26,7 +26,7 @@ public class PngChunkPhys extends PngChunk {
     public final int pixelsPerUnitYAxis;
     public final int unitSpecifier;
 
-    public PngChunkPhys(int length, int chunkType, int crc, byte[] bytes) throws IOException {
+    public PngChunkPhys(final int length, final int chunkType, final int crc, final byte[] bytes) throws IOException {
         super(length, chunkType, crc, bytes);
 
         final ByteArrayInputStream is = new ByteArrayInputStream(bytes);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
index 9a585e2..6de9c99 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkScal.java
@@ -27,7 +27,7 @@ public class PngChunkScal extends PngChunk {
    public final double unitsPerPixelYAxis;
    public final int unitSpecifier;
 
-   public PngChunkScal(int length, int chunkType, int crc, byte[] bytes)
+   public PngChunkScal(final int length, final int chunkType, final int crc, final byte[] bytes)
          throws ImageReadException, IOException {
       super(length, chunkType, crc, bytes);
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilter.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilter.java
index 9a87759..ce04042 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilter.java
@@ -35,7 +35,7 @@ public abstract class TransparencyFilter extends BinaryFileParser {
     /**
      * @return a byte
      */
-    public byte getByte(int offset) {
+    public byte getByte(final int offset) {
         return bytes[offset];
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
index fc9281d..fb121c6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
@@ -26,7 +26,7 @@ import static org.apache.commons.imaging.common.BinaryFunctions.*;
 public class TransparencyFilterGrayscale extends TransparencyFilter {
     private final int transparentColor;
 
-    public TransparencyFilterGrayscale(byte[] bytes) throws IOException {
+    public TransparencyFilterGrayscale(final byte[] bytes) throws IOException {
         super(bytes);
 
         ByteArrayInputStream is = new ByteArrayInputStream(bytes);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
index 31bc130..ecc42d9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
@@ -26,7 +26,7 @@ import static org.apache.commons.imaging.common.BinaryFunctions.*;
 public class TransparencyFilterTrueColor extends TransparencyFilter {
     private final int transparentColor;
 
-    public TransparencyFilterTrueColor(byte[] bytes) throws IOException {
+    public TransparencyFilterTrueColor(final byte[] bytes) throws IOException {
         super(bytes);
 
         ByteArrayInputStream is = new ByteArrayInputStream(bytes);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
index e46f672..caed6a7 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
@@ -27,7 +27,7 @@ class PgmWriter implements PnmWriter {
 
     private final boolean rawbits;
 
-    public PgmWriter(boolean rawbits) {
+    public PgmWriter(final boolean rawbits) {
         this.rawbits = rawbits;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
index ef54269..146f2eb 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
@@ -27,7 +27,7 @@ class PpmWriter implements PnmWriter {
 
     private final boolean rawbits;
 
-    public PpmWriter(boolean rawbits) {
+    public PpmWriter(final boolean rawbits) {
         this.rawbits = rawbits;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java b/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
index 6cf293b..5b330b5 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
@@ -127,13 +127,13 @@ class ImageResourceType {
 
     public final String description;
 
-    public ImageResourceType(int id, String description) {
+    public ImageResourceType(final int id, final String description) {
         this.from = id;
         this.to = id;
         this.description = description;
     }
 
-    public ImageResourceType(int id, int id2, String description) {
+    public ImageResourceType(final int id, final int id2, final String description) {
         this.from = id;
         this.to = id2;
         this.description = description;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
index 0305980..6eac7c8 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
@@ -29,7 +29,7 @@ public class PsdHeaderInfo {
     public final int depth;
     public final int mode;
 
-    public PsdHeaderInfo(int version, byte[] reserved, int channels, int rows, int columns, int depth, int mode) {
+    public PsdHeaderInfo(final int version, final byte[] reserved, final int channels, final int rows, final int columns, final int depth, final int mode) {
         this.version = version;
         this.reserved = reserved.clone();
         this.channels = channels;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
index 53be341..84cd1c8 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
@@ -64,7 +64,7 @@ public class TiffDirectory extends TiffElement {
     private TiffImageData tiffImageData;
     private JpegImageData jpegImageData;
 
-    public TiffDirectory(int type, List<TiffField> entries, long offset, long nextDirectoryOffset) {
+    public TiffDirectory(final int type, final List<TiffField> entries, final long offset, final long nextDirectoryOffset) {
         super(offset, TiffConstants.TIFF_DIRECTORY_HEADER_LENGTH
                 + entries.size() * TiffConstants.TIFF_ENTRY_LENGTH
                 + TiffConstants.TIFF_DIRECTORY_FOOTER_LENGTH);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
index 3b3d405..2996229 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
@@ -104,7 +104,7 @@ public abstract class TiffImageData {
             return strips;
         }
 
-        public TiffElement.DataElement getImageData(int offset) {
+        public TiffElement.DataElement getImageData(final int offset) {
             return strips[offset];
         }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
index 18e0969..339726c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
@@ -110,7 +110,7 @@ final class TiffTags {
         return map;
     }
 
-    static Integer getTagCount(int tag) {
+    static Integer getTagCount(final int tag) {
         return TAG_COUNTS.get(tag);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java
index 217e480..ab182e2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java
@@ -85,7 +85,7 @@ public abstract class ImageDataReader {
      * @param size the size to check
      * @return true if all the bits per sample entries are the same
      */
-    protected boolean isHomogenous(int size) {
+    protected boolean isHomogenous(final int size) {
         for (final int element : bitsPerSample) {
             if (element != size) {
                 return false;

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
index 508fd61..c3c707c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
@@ -40,7 +40,7 @@ public abstract class PhotometricInterpreter {
     public abstract void interpretPixel(ImageBuilder imageBuilder,
             int[] samples, int x, int y) throws ImageReadException, IOException;
     
-    protected int getBitsPerSample(int offset) {
+    protected int getBitsPerSample(final int offset) {
         return bitsPerSample[offset];
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/main/java/org/apache/commons/imaging/palette/ColorComponent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/palette/ColorComponent.java b/src/main/java/org/apache/commons/imaging/palette/ColorComponent.java
index be88d79..77ac38b 100644
--- a/src/main/java/org/apache/commons/imaging/palette/ColorComponent.java
+++ b/src/main/java/org/apache/commons/imaging/palette/ColorComponent.java
@@ -24,11 +24,11 @@ enum ColorComponent {
     
     private final int shift;
 
-    private ColorComponent(int shift) {
+    private ColorComponent(final int shift) {
         this.shift = shift;
     }
 
-    public int argbComponent(int argb) {
+    public int argbComponent(final int argb) {
         return (argb >> shift) & 0xff;
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java b/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
index b0be8bc..a15a317 100644
--- a/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
+++ b/src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java
@@ -72,7 +72,7 @@ public class ImagingGuessFormatTest extends ImagingTest {
         );
     }
 
-    public ImagingGuessFormatTest(ImageFormats expectedFormat, String pathToFile) {
+    public ImagingGuessFormatTest(final ImageFormats expectedFormat, final String pathToFile) {
         this.expectedFormat = expectedFormat;
         this.pathToFile = pathToFile;
     }

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java b/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
index c3d4d21..a1f1412 100644
--- a/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
@@ -108,7 +108,7 @@ public class RationalNumberTest extends ImagingTest {
         );
     }
 
-    public RationalNumberTest(double testValue) {
+    public RationalNumberTest(final double testValue) {
         this.testValue = testValue;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
index f4fdddb..0cb154c 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
@@ -43,7 +43,7 @@ public class ByteSourceDataTest extends ByteSourceTest {
         return Arrays.asList(getTestByteArrays());
     }
 
-    public ByteSourceDataTest(byte[] testByteArray) {
+    public ByteSourceDataTest(final byte[] testByteArray) {
         this.testByteArray = testByteArray;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
index d296eca..0593640 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
@@ -54,7 +54,7 @@ public class ByteSourceImageTest extends ByteSourceTest {
         return getTestImages();
     }
 
-    public ByteSourceImageTest(File imageFile) {
+    public ByteSourceImageTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
index 43c6348..7327cf7 100644
--- a/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
@@ -44,7 +44,7 @@ public class BmpReadTest extends BmpBaseTest {
         return getBmpImages();
     }
 
-    public BmpReadTest(File imageFile) {
+    public BmpReadTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
index 8201880..d0484fa 100644
--- a/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
@@ -40,7 +40,7 @@ public class DcxReadTest extends DcxBaseTest {
         return getDcxImages();
     }
 
-    public DcxReadTest(File imageFile) {
+    public DcxReadTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java b/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
index ae30b9e..3ab4ba5 100644
--- a/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
@@ -40,7 +40,7 @@ public class GifReadTest extends GifBaseTest {
         return getGifImages();
     }
 
-    public GifReadTest(File imageFile) {
+    public GifReadTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
index adcd6d1..ea6ff3c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
@@ -42,7 +42,7 @@ public class IcnsReadTest extends IcnsBaseTest {
         return getIcnsImages();
     }
 
-    public IcnsReadTest(File imageFile) {
+    public IcnsReadTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
index 3230894..dbb7325 100644
--- a/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
@@ -40,7 +40,7 @@ public class IcoReadTest extends IcoBaseTest {
         return getIcoImages();
     }
 
-    public IcoReadTest(File imageFile) {
+    public IcoReadTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
index 35754e7..fd9f133 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
@@ -46,7 +46,7 @@ public class JpegReadTest extends JpegBaseTest {
         return getJpegImages();
     }
 
-    public JpegReadTest(File imageFile) {
+    public JpegReadTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
index 7fa78f9..f904433 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
@@ -45,7 +45,7 @@ public class ExifDumpTest extends ExifBaseTest {
         return getImagesWithExifData();
     }
 
-    public ExifDumpTest(File imageFile) {
+    public ExifDumpTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
index b2c34c7..4be530b 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
@@ -41,7 +41,7 @@ public class GpsTest extends ExifBaseTest {
         return getImagesWithExifData();
     }
 
-    public GpsTest(File imageFile) {
+    public GpsTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java
index c89005c..6ba57d3 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java
@@ -28,7 +28,7 @@ import org.apache.commons.imaging.util.Debug;
 
 public class MakerNoteFieldTest extends SpecificExifTagTest {
 
-    public MakerNoteFieldTest(File imageFile) {
+    public MakerNoteFieldTest(final File imageFile) {
         super(imageFile);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
index b765e32..9333c96 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MicrosoftTagTest.java
@@ -75,7 +75,7 @@ public class MicrosoftTagTest extends ExifBaseTest {
         }
     }
 
-    private byte[] cleanImage(File imageWithExif) throws ImageReadException, ImageWriteException, IOException {
+    private byte[] cleanImage(final File imageWithExif) throws ImageReadException, ImageWriteException, IOException {
         // Windows doesn't show XP tags if same-meaning tags exist in IPTC or XMP. Remove them: 
         final ByteArrayOutputStream noXmp = new ByteArrayOutputStream();
         new JpegXmpRewriter().removeXmpXml(imageWithExif, noXmp);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
index 728f81c..30d2102 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
@@ -46,7 +46,7 @@ public abstract class SpecificExifTagTest extends ExifBaseTest {
         return getImagesWithExifData();
     }
 
-    public SpecificExifTagTest(File imageFile) {
+    public SpecificExifTagTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java
index d1d13e5..a6f8023 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/TextFieldTest.java
@@ -31,7 +31,7 @@ import org.junit.Assert;
 
 public class TextFieldTest extends SpecificExifTagTest {
 
-    public TextFieldTest(File imageFile) {
+    public TextFieldTest(final File imageFile) {
         super(imageFile);
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
index 09f4664..5cd48f2 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
@@ -36,7 +36,7 @@ public class WriteExifMetadataExampleTest extends ExifBaseTest {
         return getJpegImages();
     }
 
-    public WriteExifMetadataExampleTest(File imageFile) {
+    public WriteExifMetadataExampleTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
index b467fc7..5c7128c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
@@ -49,7 +49,7 @@ public class IptcAddTest extends IptcBaseTest {
         return getJpegImages();
     }
 
-    public IptcAddTest(File imageFile) {
+    public IptcAddTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
index 4e17f40..e19dddd 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
@@ -44,7 +44,7 @@ public class IptcDumpTest extends IptcBaseTest {
         return getImagesWithIptcData();
     }
 
-    public IptcDumpTest(File imageFile) {
+    public IptcDumpTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
index f4a8e22..faafec3 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcFullDiscardTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
 
 public class IptcFullDiscardTest {
     
-    private byte[] addMetaData(byte[] bytes) throws Exception {
+    private byte[] addMetaData(final byte[] bytes) throws Exception {
         IptcRecord record = new IptcRecord(IptcTypes.KEYWORDS, "meta; data");
         PhotoshopApp13Data data = new PhotoshopApp13Data(Collections.singletonList(record), Collections.<IptcBlock> emptyList());
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
@@ -46,7 +46,7 @@ public class IptcFullDiscardTest {
         return byteArrayOutputStream.toByteArray();
     }
     
-    private byte[] removeMetaData(byte[] bytes, boolean removeApp13Segment) throws Exception {
+    private byte[] removeMetaData(final byte[] bytes, final boolean removeApp13Segment) throws Exception {
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         new JpegIptcRewriter().removeIPTC(bytes, byteArrayOutputStream, removeApp13Segment);
         return byteArrayOutputStream.toByteArray();

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
index 4f17c8d..863435a 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
@@ -51,7 +51,7 @@ public class IptcUpdateTest extends IptcBaseTest {
         return getImagesWithIptcData();
     }
 
-    public IptcUpdateTest(File imageFile) {
+    public IptcUpdateTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 
@@ -80,7 +80,7 @@ public class IptcUpdateTest extends IptcBaseTest {
                 || outMetadata.getItems().size() == 0);
     }
 
-    public File removeIptc(ByteSource byteSource) throws Exception {
+    public File removeIptc(final ByteSource byteSource) throws Exception {
         final File noIptcFile = createTempFile(imageFile.getName() + ".iptc.remove.", ".jpg");
 
         try (OutputStream os = new BufferedOutputStream(new FileOutputStream(noIptcFile))) {
@@ -160,7 +160,7 @@ public class IptcUpdateTest extends IptcBaseTest {
         assertTrue(outMetadata.getItems().size() == 2);
     }
 
-    public File writeIptc(ByteSource byteSource, PhotoshopApp13Data newData) throws IOException, ImageReadException, ImageWriteException {
+    public File writeIptc(final ByteSource byteSource, final PhotoshopApp13Data newData) throws IOException, ImageReadException, ImageWriteException {
         final File updated = createTempFile(imageFile.getName()
                 + ".iptc.update.", ".jpg");
         try (FileOutputStream fos = new FileOutputStream(updated);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
index 96e9c08..53d1a0c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
@@ -41,7 +41,7 @@ public class JpegXmpDumpTest extends JpegXmpBaseTest {
         return getImagesWithXmpData();
     }
 
-    public JpegXmpDumpTest(File imageFile) {
+    public JpegXmpDumpTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
index 74e0b42..1e3d1ce 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
@@ -46,7 +46,7 @@ public class JpegXmpRewriteTest extends JpegXmpBaseTest {
         return getImagesWithXmpData();
     }
 
-    public JpegXmpRewriteTest(File imageFile) {
+    public JpegXmpRewriteTest(final File imageFile) {
         this.imageFile = imageFile;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java b/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
index 626a001..2b0638d 100644
--- a/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
+++ b/src/test/java/org/apache/commons/imaging/palette/PaletteQuantizationTest.java
@@ -63,7 +63,7 @@ public class PaletteQuantizationTest extends ImagingTest {
         checkPaletteDetails(rainbowImage, 2, 2);
     }
     
-    private void checkPaletteDetails(BufferedImage image, final int limit, final int expectedSize) throws ImageWriteException {
+    private void checkPaletteDetails(final BufferedImage image, final int limit, final int expectedSize) throws ImageWriteException {
         PaletteFactory paletteFactory = new PaletteFactory();
         Palette palette;
 
@@ -103,7 +103,7 @@ public class PaletteQuantizationTest extends ImagingTest {
         }
     }
     
-    private void checkUniqueColors(BufferedImage src, Palette palette) throws ImageWriteException {
+    private void checkUniqueColors(final BufferedImage src, final Palette palette) throws ImageWriteException {
         BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
         dst.getGraphics().drawImage(src, 0, 0, src.getWidth(), src.getHeight(), null);
         Dithering.applyFloydSteinbergDithering(dst, palette);
@@ -111,7 +111,7 @@ public class PaletteQuantizationTest extends ImagingTest {
         assertEquals(palette.length(), ditheredPalette.length());
     }
     
-    private void checkPixelsAreIdentical(BufferedImage src, Palette palette) throws ImageWriteException {
+    private void checkPixelsAreIdentical(final BufferedImage src, final Palette palette) throws ImageWriteException {
         BufferedImage dst = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
         dst.getGraphics().drawImage(src, 0, 0, src.getWidth(), src.getHeight(), null);
         Dithering.applyFloydSteinbergDithering(dst, palette);

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/56e0133a/src/test/java/org/apache/commons/imaging/roundtrip/BitmapRoundtripTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/roundtrip/BitmapRoundtripTest.java b/src/test/java/org/apache/commons/imaging/roundtrip/BitmapRoundtripTest.java
index 6c0a049..dd94354 100644
--- a/src/test/java/org/apache/commons/imaging/roundtrip/BitmapRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/roundtrip/BitmapRoundtripTest.java
@@ -44,7 +44,7 @@ public class BitmapRoundtripTest extends RoundtripBase {
     public static FormatInfo[] formatInfos = FormatInfo.READ_WRITE_FORMATS;
 
     @Theory
-    public void testBitmapRoundtrip(BufferedImage testImage, FormatInfo formatInfo) throws Exception {
+    public void testBitmapRoundtrip(final BufferedImage testImage, final FormatInfo formatInfo) throws Exception {
         roundtrip(formatInfo, testImage, "bitmap", true);
     }
 }


[14/50] [abbrv] commons-imaging git commit: Always use blocks.

Posted by ch...@apache.org.
Always use blocks.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775886 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/eb8be124
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/eb8be124
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/eb8be124

Branch: refs/heads/master
Commit: eb8be124f7d1ebc75e3ed69c0a7d8802cea29d67
Parents: e6799d8
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:50:18 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:50:18 2016 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/color/ColorCmyk.java  |  4 +++-
 .../commons/imaging/formats/pnm/PnmImageParser.java  | 15 ++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/eb8be124/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java b/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
index fb4c4f0..da65fdf 100644
--- a/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
+++ b/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
@@ -128,7 +128,9 @@ public final class ColorCmyk {
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) return false;
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         ColorCmyk colorCmyk = (ColorCmyk) o;
         if (Double.compare(colorCmyk.C, C) != 0) {

http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/eb8be124/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
index 3ae6b0b..4acd09d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
@@ -156,28 +156,33 @@ public class PnmImageParser extends ImageParser {
                 final String type = tokenizer.nextToken();
                 if ("WIDTH".equals(type)) {
                     seenWidth = true;
-                    if(!tokenizer.hasMoreTokens())
+                    if(!tokenizer.hasMoreTokens()) {
                         throw new ImageReadException("PAM header has no WIDTH value");
+                    }
                     width = Integer.parseInt(tokenizer.nextToken());
                 } else if ("HEIGHT".equals(type)) {
                     seenHeight = true;
-                    if(!tokenizer.hasMoreTokens())
+                    if(!tokenizer.hasMoreTokens()) {
                         throw new ImageReadException("PAM header has no HEIGHT value");
+                    }
                     height = Integer.parseInt(tokenizer.nextToken());
                 } else if ("DEPTH".equals(type)) {
                     seenDepth = true;
-                    if(!tokenizer.hasMoreTokens())
+                    if(!tokenizer.hasMoreTokens()) {
                         throw new ImageReadException("PAM header has no DEPTH value");
+                    }
                     depth = Integer.parseInt(tokenizer.nextToken());
                 } else if ("MAXVAL".equals(type)) {
                     seenMaxVal = true;
-                    if(!tokenizer.hasMoreTokens())
+                    if(!tokenizer.hasMoreTokens()) {
                         throw new ImageReadException("PAM header has no MAXVAL value");
+                    }
                     maxVal = Integer.parseInt(tokenizer.nextToken());
                 } else if ("TUPLTYPE".equals(type)) {
                     seenTupleType = true;
-                    if(!tokenizer.hasMoreTokens())
+                    if(!tokenizer.hasMoreTokens()) {
                         throw new ImageReadException("PAM header has no TUPLTYPE value");
+                    }
                     tupleType.append(tokenizer.nextToken());
                 } else if ("ENDHDR".equals(type)) {
                     break;


[28/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775934 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/4ec828ec
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/4ec828ec
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/4ec828ec

Branch: refs/heads/master
Commit: 4ec828ecaeb0b704c0023be0ecd518f2db9c4575
Parents: 72af6b4
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:32:41 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:32:41 2016 +0000

----------------------------------------------------------------------
 .../imaging/common/bytesource/ByteSourceDataTest.java       | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/4ec828ec/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
index 1c4e646..b030062 100644
--- a/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
+++ b/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceDataTest.java
@@ -59,8 +59,7 @@ public class ByteSourceDataTest extends ByteSourceTest {
             // test that all bytes written to file.
             assertTrue(src.length == file.length());
 
-            final ByteSource byteSource = new ByteSourceFile(file);
-            return byteSource;
+            return new ByteSourceFile(file);
         }
     }
 
@@ -71,8 +70,7 @@ public class ByteSourceDataTest extends ByteSourceTest {
 
             final FileInputStream is = new FileInputStream(file);
 
-            final ByteSource byteSource = new ByteSourceInputStream(is, null);
-            return byteSource;
+            return new ByteSourceInputStream(is, null);
         }
     }
 
@@ -81,8 +79,7 @@ public class ByteSourceDataTest extends ByteSourceTest {
         public ByteSource getByteSource(final byte src[]) throws IOException {
             final ByteArrayInputStream is = new ByteArrayInputStream(src);
 
-            final ByteSource byteSource = new ByteSourceInputStream(is, null);
-            return byteSource;
+            return new ByteSourceInputStream(is, null);
         }
 
     }


[33/50] [abbrv] commons-imaging git commit: Match XPM color names case insensitively.

Posted by ch...@apache.org.
Match XPM color names case insensitively.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780731 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/104b4095
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/104b4095
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/104b4095

Branch: refs/heads/master
Commit: 104b40953929ac7d672427008e111c6c721639ab
Parents: 316d61d
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sat Jan 28 18:41:17 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sat Jan 28 18:41:17 2017 +0000

----------------------------------------------------------------------
 .../apache/commons/imaging/formats/xpm/XpmImageParser.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/104b4095/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index e3b19fd..26bcff0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -36,6 +36,7 @@ import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
@@ -91,7 +92,7 @@ public class XpmImageParser extends ImageParser {
                             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)
+                            colors.put(colorName.toLowerCase(Locale.ENGLISH), 0xff000000 | (red << 16)
                                     | (green << 8) | blue);
                         } catch (final NumberFormatException nfe) {
                             throw new ImageReadException("Couldn't parse color in rgb.txt", nfe);
@@ -353,8 +354,9 @@ public class XpmImageParser extends ImageParser {
             return 0x00000000;
         } else {
             loadColorNames();
-            if (colorNames.containsKey(color)) {
-                return colorNames.get(color);
+            final String colorLowercase = color.toLowerCase(Locale.ENGLISH);
+            if (colorNames.containsKey(colorLowercase)) {
+                return colorNames.get(colorLowercase);
             }
             return 0x00000000;
         }


[12/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775882 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/0ac4d259
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/0ac4d259
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/0ac4d259

Branch: refs/heads/master
Commit: 0ac4d259f5d9d44cade33f2b7d38f8cf34dda80c
Parents: 1743e64
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:26:55 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:26:55 2016 +0000

----------------------------------------------------------------------
 .../apache/commons/imaging/common/bytesource/ByteSourceFile.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/0ac4d259/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
index 87adbd8..a48381a 100644
--- a/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
+++ b/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
@@ -64,8 +64,7 @@ public class ByteSourceFile extends ByteSource {
     public byte[] getAll() throws IOException {
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
-        try (FileInputStream fis = new FileInputStream(file);
-                InputStream is = new BufferedInputStream(fis)) {
+        try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
             final byte[] buffer = new byte[1024];
             int read;
             while ((read = is.read(buffer)) > 0) {


[39/50] [abbrv] commons-imaging git commit: Add support for writing 4 color PCX images, and clean up and simplify the writing code.

Posted by ch...@apache.org.
Add support for writing 4 color PCX images, and clean up and simplify
the writing code.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1782282 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/1d68e1d4
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/1d68e1d4
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/1d68e1d4

Branch: refs/heads/master
Commit: 1d68e1d4a4600a287f947827acc046a784133cf0
Parents: 56ca99f
Author: Damjan Jovanovic <da...@apache.org>
Authored: Thu Feb 9 00:03:32 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Thu Feb 9 00:03:32 2017 +0000

----------------------------------------------------------------------
 .../commons/imaging/formats/pcx/PcxWriter.java  | 461 ++++++-------------
 1 file changed, 137 insertions(+), 324 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/1d68e1d4/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
index f774f0f..a75ea87 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
@@ -32,8 +32,8 @@ import org.apache.commons.imaging.palette.SimplePalette;
 
 class PcxWriter {
     private int encoding;
-    private int bitDepth = -1;
-    private int planes = -1;
+    private int bitDepthWanted = -1;
+    private int planesWanted = -1;
     private PixelDensity pixelDensity;
     private final RleWriter rleWriter;
 
@@ -75,7 +75,7 @@ class PcxWriter {
                     throw new ImageWriteException(
                             "Invalid bit depth parameter: " + value);
                 }
-                bitDepth = ((Number) value).intValue();
+                bitDepthWanted = ((Number) value).intValue();
             }
         }
         
@@ -86,7 +86,7 @@ class PcxWriter {
                     throw new ImageWriteException(
                             "Invalid planes parameter: " + value);
                 }
-                planes = ((Number) value).intValue();
+                planesWanted = ((Number) value).intValue();
             }
         }
 
@@ -110,29 +110,40 @@ class PcxWriter {
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }
     }
-
+    
     public void writeImage(final BufferedImage src, final OutputStream os)
             throws ImageWriteException, IOException {
         final PaletteFactory paletteFactory = new PaletteFactory();
         final SimplePalette palette = paletteFactory.makeExactRgbPaletteSimple(src, 256);
         final BinaryOutputStream bos = new BinaryOutputStream(os,
                 ByteOrder.LITTLE_ENDIAN);
-        if (palette == null || bitDepth == 24 || bitDepth == 32) {
-            if (bitDepth == 32) {
-                write32BppPCX(src, bos);
+        final int bitDepth;
+        final int planes;
+        if (palette == null || bitDepthWanted == 24 || bitDepthWanted == 32) {
+            if (bitDepthWanted == 32) {
+                bitDepth = 32;
+                planes = 1;
             } else {
-                write24BppPCX(src, bos);
+                bitDepth = 8;
+                planes = 3;
             }
-        } else if (palette.length() > 16 || bitDepth == 8) {
-            write256ColorPCX(src, palette, bos);
-        } else if (palette.length() > 8 || bitDepth == 4) {
-            if (planes == 1) {
-                write16ColorPCXIn1Plane(src, palette, bos);
+        } else if (palette.length() > 16 || bitDepthWanted == 8) {
+            bitDepth = 8;
+            planes = 1;
+        } else if (palette.length() > 8 || bitDepthWanted == 4) {
+            if (planesWanted == 1) {
+                bitDepth = 4;
+                planes = 1;
             } else {
-                write16ColorPCXIn4Planes(src, palette, bos);
+                bitDepth = 1;
+                planes = 4;
             }
-        } else if (palette.length() > 2 || bitDepth == 3) {
-            write8ColorPcx(src, palette, bos);
+        } else if (palette.length() > 4 || bitDepthWanted == 3) {
+            bitDepth = 1;
+            planes = 3;
+        } else if (palette.length() > 2 || bitDepthWanted == 2) {
+            bitDepth = 1;
+            planes = 2;
         } else {
             boolean onlyBlackAndWhite = true;
             if (palette.length() >= 1) {
@@ -148,147 +159,20 @@ class PcxWriter {
                 }
             }
             if (onlyBlackAndWhite) {
-                writeBlackAndWhitePCX(src, bos);
+                bitDepth = 1;
+                planes = 1;
             } else {
-                write8ColorPcx(src, palette, bos);
+                bitDepth = 1;
+                planes = 2;
             }
         }
-    }
-
-    private void write32BppPCX(final BufferedImage src, final BinaryOutputStream bos)
-            throws ImageWriteException, IOException {
-        final int bytesPerLine = src.getWidth() % 2 == 0 ? src.getWidth() : src.getWidth() + 1;
-
-        // PCX header
-        bos.write(10); // manufacturer
-        bos.write(5); // version
-        bos.write(encoding); // encoding
-        bos.write(32); // bits per pixel
-        bos.write2Bytes(0); // xMin
-        bos.write2Bytes(0); // yMin
-        bos.write2Bytes(src.getWidth() - 1); // xMax
-        bos.write2Bytes(src.getHeight() - 1); // yMax
-        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
-        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.write(new byte[48]); // 16 color palette
-        bos.write(0); // reserved
-        bos.write(1); // planes
-        bos.write2Bytes(bytesPerLine); // bytes per line
-        bos.write2Bytes(1); // palette info
-        bos.write2Bytes(0); // hScreenSize
-        bos.write2Bytes(0); // vScreenSize
-        bos.write(new byte[54]);
-
-        final int[] rgbs = new int[src.getWidth()];
-        final byte[] rgbBytes = new byte[4 * bytesPerLine];
-        for (int y = 0; y < src.getHeight(); y++) {
-            src.getRGB(0, y, src.getWidth(), 1, rgbs, 0, src.getWidth());
-            for (int x = 0; x < rgbs.length; x++) {
-                rgbBytes[4 * x + 0] = (byte) (rgbs[x] & 0xff);
-                rgbBytes[4 * x + 1] = (byte) ((rgbs[x] >> 8) & 0xff);
-                rgbBytes[4 * x + 2] = (byte) ((rgbs[x] >> 16) & 0xff);
-                rgbBytes[4 * x + 3] = 0;
-            }
-            rleWriter.write(bos, rgbBytes);
-        }
-        rleWriter.flush(bos);
-    }
-
-    private void write24BppPCX(final BufferedImage src, final BinaryOutputStream bos)
-            throws ImageWriteException, IOException {
-        final int bytesPerLine = src.getWidth() % 2 == 0 ? src.getWidth() : src.getWidth() + 1;
-
-        // PCX header
-        bos.write(10); // manufacturer
-        bos.write(5); // version
-        bos.write(encoding); // encoding
-        bos.write(8); // bits per pixel
-        bos.write2Bytes(0); // xMin
-        bos.write2Bytes(0); // yMin
-        bos.write2Bytes(src.getWidth() - 1); // xMax
-        bos.write2Bytes(src.getHeight() - 1); // yMax
-        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
-        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.write(new byte[48]); // 16 color palette
-        bos.write(0); // reserved
-        bos.write(3); // planes
-        bos.write2Bytes(bytesPerLine); // bytes per line
-        bos.write2Bytes(1); // palette info
-        bos.write2Bytes(0); // hScreenSize
-        bos.write2Bytes(0); // vScreenSize
-        bos.write(new byte[54]);
-
-        final int[] rgbs = new int[src.getWidth()];
-        final byte[] rgbBytes = new byte[3 * bytesPerLine];
-        for (int y = 0; y < src.getHeight(); y++) {
-            src.getRGB(0, y, src.getWidth(), 1, rgbs, 0, src.getWidth());
-            for (int x = 0; x < rgbs.length; x++) {
-                rgbBytes[x] = (byte) ((rgbs[x] >> 16) & 0xff);
-                rgbBytes[bytesPerLine + x] = (byte) ((rgbs[x] >> 8) & 0xff);
-                rgbBytes[2 * bytesPerLine + x] = (byte) (rgbs[x] & 0xff);
-            }
-            rleWriter.write(bos, rgbBytes);
-        }
-        rleWriter.flush(bos);
-    }
-
-    private void writeBlackAndWhitePCX(final BufferedImage src,
-            final BinaryOutputStream bos)
-            throws ImageWriteException, IOException {
-        int bytesPerLine = (src.getWidth() + 7) / 8;
-        if (bytesPerLine % 2 != 0) {
-            ++bytesPerLine;
-        }
-
-        // PCX header
-        bos.write(10); // manufacturer
-        bos.write(3); // version - it seems some apps only open
-        // black and white files if the version is 3...
-        bos.write(encoding); // encoding
-        bos.write(1); // bits per pixel
-        bos.write2Bytes(0); // xMin
-        bos.write2Bytes(0); // yMin
-        bos.write2Bytes(src.getWidth() - 1); // xMax
-        bos.write2Bytes(src.getHeight() - 1); // yMax
-        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
-        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.write(new byte[48]); // 16 color palette
-        bos.write(0); // reserved
-        bos.write(1); // planes
-        bos.write2Bytes(bytesPerLine); // bytes per line
-        bos.write2Bytes(1); // palette info
-        bos.write2Bytes(0); // hScreenSize
-        bos.write2Bytes(0); // vScreenSize
-        bos.write(new byte[54]);
-
-        final byte[] row = new byte[bytesPerLine];
-        for (int y = 0; y < src.getHeight(); y++) {
-            Arrays.fill(row, (byte) 0);
-            for (int x = 0; x < src.getWidth(); x++) {
-                final int rgb = 0xffffff & src.getRGB(x, y);
-                int bit;
-                if (rgb == 0x000000) {
-                    bit = 0;
-                } else if (rgb == 0xffffff) {
-                    bit = 1;
-                } else {
-                    throw new ImageWriteException(
-                            "Pixel neither black nor white");
-                }
-                row[x / 8] |= (bit << (7 - (x % 8)));
-            }
-            rleWriter.write(bos, row);
-        }
-        rleWriter.flush(bos);
-    }
-
-    private void write16ColorPCXIn1Plane(final BufferedImage src, final SimplePalette palette,
-            final BinaryOutputStream bos) throws ImageWriteException, IOException {
-        int bytesPerLine = (src.getWidth() + 1) / 2;
-        if (bytesPerLine % 2 != 0) {
-            ++bytesPerLine;
+        
+        int bytesPerLine = (bitDepth * src.getWidth() + 7) / 8;
+        if ((bytesPerLine % 2) != 0) {
+            // must be even:
+            bytesPerLine++;
         }
-
+        
         final byte[] palette16 = new byte[16 * 3];
         for (int i = 0; i < 16; i++) {
             int rgb;
@@ -304,9 +188,9 @@ class PcxWriter {
 
         // PCX header
         bos.write(10); // manufacturer
-        bos.write(5); // version
+        bos.write(bitDepth == 1 && planes == 1 ? 3 : 5); // version. Some apps only open black and white PCX with version=3.
         bos.write(encoding); // encoding
-        bos.write(4); // bits per pixel
+        bos.write(bitDepth); // bits per pixel
         bos.write2Bytes(0); // xMin
         bos.write2Bytes(0); // yMin
         bos.write2Bytes(src.getWidth() - 1); // xMax
@@ -315,198 +199,127 @@ class PcxWriter {
         bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
         bos.write(palette16); // 16 color palette
         bos.write(0); // reserved
-        bos.write(1); // planes
+        bos.write(planes); // planes
         bos.write2Bytes(bytesPerLine); // bytes per line
         bos.write2Bytes(1); // palette info
         bos.write2Bytes(0); // hScreenSize
         bos.write2Bytes(0); // vScreenSize
         bos.write(new byte[54]);
 
-        final byte[] indeces = new byte[bytesPerLine];
-        for (int y = 0; y < src.getHeight(); y++) {
-            Arrays.fill(indeces, (byte) 0);
-            for (int x = 0; x < src.getWidth(); x++) {
-                final int argb = src.getRGB(x, y);
-                final int index = palette.getPaletteIndex(0xffffff & argb);
-                indeces[x / 2] |= (index << 4 * (1 - (x % 2)));
-            }
-            rleWriter.write(bos, indeces);
-        }
-        rleWriter.flush(bos);
-    }
-
-    private void write16ColorPCXIn4Planes(final BufferedImage src, final SimplePalette palette,
-            final BinaryOutputStream bos) throws ImageWriteException, IOException {
-        int bytesPerLine = (src.getWidth() + 7) / 8;
-        if (bytesPerLine % 2 != 0) {
-            ++bytesPerLine;
+        if (bitDepth == 32) {
+            writePixels32(src, bytesPerLine, bos);
+        } else {
+            writePixels(src, bitDepth, planes, bytesPerLine, palette, bos);
         }
-
-        final byte[] palette16 = new byte[16 * 3];
-        for (int i = 0; i < 16; i++) {
-            int rgb;
-            if (i < palette.length()) {
-                rgb = palette.getEntry(i);
-            } else {
-                rgb = 0;
+        
+        if (bitDepth == 8 && planes == 1) {
+            // 256 color palette
+            bos.write(12);
+            for (int i = 0; i < 256; i++) {
+                int rgb;
+                if (i < palette.length()) {
+                    rgb = palette.getEntry(i);
+                } else {
+                    rgb = 0;
+                }
+                bos.write((rgb >> 16) & 0xff);
+                bos.write((rgb >> 8) & 0xff);
+                bos.write(rgb & 0xff);
             }
-            palette16[3 * i + 0] = (byte) (0xff & (rgb >> 16));
-            palette16[3 * i + 1] = (byte) (0xff & (rgb >> 8));
-            palette16[3 * i + 2] = (byte) (0xff & rgb);
         }
-
-        // PCX header
-        bos.write(10); // manufacturer
-        bos.write(5); // version
-        bos.write(encoding); // encoding
-        bos.write(1); // bits per pixel
-        bos.write2Bytes(0); // xMin
-        bos.write2Bytes(0); // yMin
-        bos.write2Bytes(src.getWidth() - 1); // xMax
-        bos.write2Bytes(src.getHeight() - 1); // yMax
-        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
-        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.write(palette16); // 16 color palette
-        bos.write(0); // reserved
-        bos.write(4); // planes
-        bos.write2Bytes(bytesPerLine); // bytes per line
-        bos.write2Bytes(1); // palette info
-        bos.write2Bytes(0); // hScreenSize
-        bos.write2Bytes(0); // vScreenSize
-        bos.write(new byte[54]);
-
+    }
+    
+    private void writePixels(final BufferedImage src, final int bitDepth, final int planes,
+            final int bytesPerLine, final SimplePalette palette, final BinaryOutputStream bos) throws IOException, ImageWriteException {
         final byte[] plane0 = new byte[bytesPerLine];
         final byte[] plane1 = new byte[bytesPerLine];
         final byte[] plane2 = new byte[bytesPerLine];
         final byte[] plane3 = new byte[bytesPerLine];
+        final byte[][] allPlanes = { plane0, plane1, plane2, plane3 };
+        
         for (int y = 0; y < src.getHeight(); y++) {
-            Arrays.fill(plane0, (byte)0);
-            Arrays.fill(plane1, (byte)0);
-            Arrays.fill(plane2, (byte)0);
-            Arrays.fill(plane3, (byte)0);
-            for (int x = 0; x < src.getWidth(); x++) {
-                final int argb = src.getRGB(x, y);
-                final int index = palette.getPaletteIndex(0xffffff & argb);
-                plane0[x >>> 3] |= (index & 1) << (7 - (x & 7));
-                plane1[x >>> 3] |= ((index & 2) >> 1) << (7 - (x & 7));
-                plane2[x >>> 3] |= ((index & 4) >> 2) << (7 - (x & 7));
-                plane3[x >>> 3] |= ((index & 8) >> 3) << (7 - (x & 7));
+            for (int i = 0; i < planes; i++) {
+                Arrays.fill(allPlanes[i], (byte)0);
             }
-            rleWriter.write(bos, plane0);
-            rleWriter.write(bos, plane1);
-            rleWriter.write(bos, plane2);
-            rleWriter.write(bos, plane3);
-        }
-        rleWriter.flush(bos);
-    }
-
-    private void write8ColorPcx(final BufferedImage src, final SimplePalette palette,
-            final BinaryOutputStream bos) throws ImageWriteException, IOException {
-        int bytesPerLine = (src.getWidth() + 7) / 8;
-        if (bytesPerLine % 2 != 0) {
-            ++bytesPerLine;
-        }
-
-        final byte[] palette16 = new byte[16 * 3];
-        for (int i = 0; i < 8; i++) {
-            int rgb;
-            if (i < palette.length()) {
-                rgb = palette.getEntry(i);
-            } else {
-                rgb = 0;
+            
+            if (bitDepth == 1 && planes == 1) {
+                for (int x = 0; x < src.getWidth(); x++) {
+                    final int rgb = 0xffffff & src.getRGB(x, y);
+                    int bit;
+                    if (rgb == 0x000000) {
+                        bit = 0;
+                    } else {
+                        bit = 1;
+                    }
+                    plane0[x >>> 3] |= (bit << (7 - (x & 7)));
+                }
+            } else if (bitDepth == 1 && planes == 2) {
+                for (int x = 0; x < src.getWidth(); x++) {
+                    final int argb = src.getRGB(x, y);
+                    final int index = palette.getPaletteIndex(0xffffff & argb);
+                    plane0[x >>> 3] |= (index & 1) << (7 - (x & 7));
+                    plane1[x >>> 3] |= ((index & 2) >> 1) << (7 - (x & 7));
+                }
+            } else if (bitDepth == 1 && planes == 3) {
+                for (int x = 0; x < src.getWidth(); x++) {
+                    final int argb = src.getRGB(x, y);
+                    final int index = palette.getPaletteIndex(0xffffff & argb);
+                    plane0[x >>> 3] |= (index & 1) << (7 - (x & 7));
+                    plane1[x >>> 3] |= ((index & 2) >> 1) << (7 - (x & 7));
+                    plane2[x >>> 3] |= ((index & 4) >> 2) << (7 - (x & 7));
+                }
+            } else if (bitDepth == 1 && planes == 4) {
+                for (int x = 0; x < src.getWidth(); x++) {
+                    final int argb = src.getRGB(x, y);
+                    final int index = palette.getPaletteIndex(0xffffff & argb);
+                    plane0[x >>> 3] |= (index & 1) << (7 - (x & 7));
+                    plane1[x >>> 3] |= ((index & 2) >> 1) << (7 - (x & 7));
+                    plane2[x >>> 3] |= ((index & 4) >> 2) << (7 - (x & 7));
+                    plane3[x >>> 3] |= ((index & 8) >> 3) << (7 - (x & 7));
+                }
+            } else if (bitDepth == 4 && planes == 1) {
+                for (int x = 0; x < src.getWidth(); x++) {
+                    final int argb = src.getRGB(x, y);
+                    final int index = palette.getPaletteIndex(0xffffff & argb);
+                    plane0[x >>> 1] |= (index << 4 * (1 - (x & 1)));
+                }
+            } else if (bitDepth == 8 && planes == 1) {
+                for (int x = 0; x < src.getWidth(); x++) {
+                    final int argb = src.getRGB(x, y);
+                    final int index = palette.getPaletteIndex(0xffffff & argb);
+                    plane0[x] = (byte) index;
+                }
+            } else if (bitDepth == 8 && planes == 3) {
+                for (int x = 0; x < src.getWidth(); x++) {
+                    final int argb = src.getRGB(x, y);
+                    plane0[x] = (byte) (argb >>> 16);
+                    plane1[x] = (byte) (argb >>> 8);
+                    plane2[x] = (byte) argb;
+                }
             }
-            palette16[3 * i + 0] = (byte) (0xff & (rgb >> 16));
-            palette16[3 * i + 1] = (byte) (0xff & (rgb >> 8));
-            palette16[3 * i + 2] = (byte) (0xff & rgb);
-        }
-
-        // PCX header
-        bos.write(10); // manufacturer
-        bos.write(5); // version
-        bos.write(encoding); // encoding
-        bos.write(1); // bits per pixel
-        bos.write2Bytes(0); // xMin
-        bos.write2Bytes(0); // yMin
-        bos.write2Bytes(src.getWidth() - 1); // xMax
-        bos.write2Bytes(src.getHeight() - 1); // yMax
-        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
-        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.write(palette16); // 16 color palette
-        bos.write(0); // reserved
-        bos.write(3); // planes
-        bos.write2Bytes(bytesPerLine); // bytes per line
-        bos.write2Bytes(1); // palette info
-        bos.write2Bytes(0); // hScreenSize
-        bos.write2Bytes(0); // vScreenSize
-        bos.write(new byte[54]);
-
-        final byte[] plane0 = new byte[bytesPerLine];
-        final byte[] plane1 = new byte[bytesPerLine];
-        final byte[] plane2 = new byte[bytesPerLine];
-        for (int y = 0; y < src.getHeight(); y++) {
-            Arrays.fill(plane0, (byte)0);
-            Arrays.fill(plane1, (byte)0);
-            Arrays.fill(plane2, (byte)0);
-            for (int x = 0; x < src.getWidth(); x++) {
-                final int argb = src.getRGB(x, y);
-                final int index = palette.getPaletteIndex(0xffffff & argb);
-                plane0[x >>> 3] |= (index & 1) << (7 - (x & 7));
-                plane1[x >>> 3] |= ((index & 2) >> 1) << (7 - (x & 7));
-                plane2[x >>> 3] |= ((index & 4) >> 2) << (7 - (x & 7));
+            
+            for (int i = 0; i < planes; i++) {
+                rleWriter.write(bos, allPlanes[i]);
             }
-            rleWriter.write(bos, plane0);
-            rleWriter.write(bos, plane1);
-            rleWriter.write(bos, plane2);
         }
         rleWriter.flush(bos);
     }
 
-    private void write256ColorPCX(final BufferedImage src, final SimplePalette palette,
-            final BinaryOutputStream bos) throws ImageWriteException, IOException {
-        final int bytesPerLine = src.getWidth() % 2 == 0 ? src.getWidth() : src.getWidth() + 1;
-
-        // PCX header
-        bos.write(10); // manufacturer
-        bos.write(5); // version
-        bos.write(encoding); // encoding
-        bos.write(8); // bits per pixel
-        bos.write2Bytes(0); // xMin
-        bos.write2Bytes(0); // yMin
-        bos.write2Bytes(src.getWidth() - 1); // xMax
-        bos.write2Bytes(src.getHeight() - 1); // yMax
-        bos.write2Bytes((short) Math.round(pixelDensity.horizontalDensityInches())); // hDpi
-        bos.write2Bytes((short) Math.round(pixelDensity.verticalDensityInches())); // vDpi
-        bos.write(new byte[48]); // 16 color palette
-        bos.write(0); // reserved
-        bos.write(1); // planes
-        bos.write2Bytes(bytesPerLine); // bytes per line
-        bos.write2Bytes(1); // palette info
-        bos.write2Bytes(0); // hScreenSize
-        bos.write2Bytes(0); // vScreenSize
-        bos.write(new byte[54]);
-
-        final byte[] indeces = new byte[bytesPerLine];
+    private void writePixels32(final BufferedImage src, final int bytesPerLine,
+            final BinaryOutputStream bos) throws IOException, ImageWriteException {
+        
+        final int[] rgbs = new int[src.getWidth()];
+        final byte[] plane = new byte[4 * bytesPerLine];
         for (int y = 0; y < src.getHeight(); y++) {
-            for (int x = 0; x < src.getWidth(); x++) {
-                final int argb = src.getRGB(x, y);
-                final int index = palette.getPaletteIndex(0xffffff & argb);
-                indeces[x] = (byte) index;
+            src.getRGB(0, y, src.getWidth(), 1, rgbs, 0, src.getWidth());
+            for (int x = 0; x < rgbs.length; x++) {
+                plane[4 * x + 0] = (byte) rgbs[x];
+                plane[4 * x + 1] = (byte) (rgbs[x] >> 8);
+                plane[4 * x + 2] = (byte) (rgbs[x] >> 16);
+                plane[4 * x + 3] = 0;
             }
-            rleWriter.write(bos, indeces);
+            rleWriter.write(bos, plane);
         }
         rleWriter.flush(bos);
-        // palette
-        bos.write(12);
-        for (int i = 0; i < 256; i++) {
-            int rgb;
-            if (i < palette.length()) {
-                rgb = palette.getEntry(i);
-            } else {
-                rgb = 0;
-            }
-            bos.write((rgb >> 16) & 0xff);
-            bos.write((rgb >> 8) & 0xff);
-            bos.write(rgb & 0xff);
-        }
     }
 }


[30/50] [abbrv] commons-imaging git commit: XBM values can span multiple pixels, but do not span multiple image rows.

Posted by ch...@apache.org.
XBM values can span multiple pixels, but do not span multiple image rows.

Patch by: me


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780709 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/b33463dc
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/b33463dc
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/b33463dc

Branch: refs/heads/master
Commit: b33463dc694d6b33628af4a23c85afcbb6eb64b7
Parents: 960adeb
Author: Damjan Jovanovic <da...@apache.org>
Authored: Sat Jan 28 15:45:05 2017 +0000
Committer: Damjan Jovanovic <da...@apache.org>
Committed: Sat Jan 28 15:45:05 2017 +0000

----------------------------------------------------------------------
 .../imaging/formats/xbm/XbmImageParser.java     | 59 +++++++++++---------
 1 file changed, 34 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/b33463dc/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index 1e1cae0..c9c9b1c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -244,32 +244,41 @@ public class XbmImageParser extends ImageParser {
 
         final int rowLength = (xbmHeader.width + 7) / 8;
         final byte[] imageData = new byte[rowLength * xbmHeader.height];
-        for (int i = 0; i < imageData.length; ) {
-            token = cParser.nextToken();
-            if (token == null || !token.startsWith("0x")) {
-                throw new ImageReadException("Parsing XBM file failed, "
-                        + "hex value missing");
-            }
-            if (token.length() > hexWidth) {
-                throw new ImageReadException("Parsing XBM file failed, "
-                        + "hex value too long");
-            }
-            final int value = Integer.parseInt(token.substring(2), 16);
-            final int flipped = Integer.reverse(value) >>> (32 - inputWidth);
-            if (inputWidth == 16 && i < imageData.length) {
-                imageData[i++] = (byte) (flipped >>> 8);
-            }
-            imageData[i++] = (byte) flipped;
+        int i = 0;
+        for (int y = 0; y < xbmHeader.height; y++) {
+            for (int x = 0; x < xbmHeader.width; x += inputWidth) {
+                token = cParser.nextToken();
+                if (token == null || !token.startsWith("0x")) {
+                    throw new ImageReadException("Parsing XBM file failed, "
+                            + "hex value missing");
+                }
+                if (token.length() > hexWidth) {
+                    throw new ImageReadException("Parsing XBM file failed, "
+                            + "hex value too long");
+                }
+                final int value = Integer.parseInt(token.substring(2), 16);
+                final int flipped = Integer.reverse(value) >>> (32 - inputWidth);
+                if (inputWidth == 16) {
+                    if ((x + 8) < xbmHeader.width) {
+                        imageData[i++] = (byte) (flipped >>> 8);
+                        imageData[i++] = (byte) flipped;
+                    } else {
+                        imageData[i++] = (byte) flipped;
+                    }
+                } else {
+                    imageData[i++] = (byte) flipped;
+                }
 
-            token = cParser.nextToken();
-            if (token == null) {
-                throw new ImageReadException("Parsing XBM file failed, "
-                        + "premature end of file");
-            }
-            if (!",".equals(token)
-                    && ((i < imageData.length) || !"}".equals(token))) {
-                throw new ImageReadException("Parsing XBM file failed, "
-                        + "punctuation error");
+                token = cParser.nextToken();
+                if (token == null) {
+                    throw new ImageReadException("Parsing XBM file failed, "
+                            + "premature end of file");
+                }
+                if (!",".equals(token)
+                        && ((i < imageData.length) || !"}".equals(token))) {
+                    throw new ImageReadException("Parsing XBM file failed, "
+                            + "punctuation error");
+                }
             }
         }
 


[48/50] [abbrv] commons-imaging git commit: Fix Checkstyle error: 'static' modifier out of order with the JLS suggestions.

Posted by ch...@apache.org.
Fix Checkstyle error: 'static' modifier out of order with the JLS suggestions.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795463 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/a9cca21a
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/a9cca21a
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/a9cca21a

Branch: refs/heads/master
Commit: a9cca21aac4e1712da67a54de7b7a9fcd50b2d85
Parents: 2127270
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:44:46 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:44:46 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/commons/imaging/common/RationalNumber.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/a9cca21a/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/RationalNumber.java b/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
index 285c4c7..4d7c756 100644
--- a/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
+++ b/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
@@ -119,9 +119,8 @@ public class RationalNumber extends Number {
         nf.setMaximumFractionDigits(3);
         return nf.format((double) numerator / (double) divisor);
     }
-    
 
-    private final static class Option {
+    private static final class Option {
         public final RationalNumber rationalNumber;
         public final double error;
 


[26/50] [abbrv] commons-imaging git commit: Use try with resources.

Posted by ch...@apache.org.
Use try with resources.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775932 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/be1c5111
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/be1c5111
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/be1c5111

Branch: refs/heads/master
Commit: be1c5111c25b1ad7401d04e246417ed22bc7ce37
Parents: 9658a25
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:29:00 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:29:00 2016 +0000

----------------------------------------------------------------------
 .../common/itu_t4/T4AndT6Compression.java       | 41 ++++++++++----------
 1 file changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/be1c5111/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java b/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
index dcb6c77..5a090a7 100644
--- a/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
+++ b/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
@@ -170,30 +170,31 @@ public final class T4AndT6Compression {
     public static byte[] compressT4_1D(final byte[] uncompressed, final int width,
             final int height, final boolean hasFill) throws ImageWriteException {
         final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(uncompressed));
-        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
-        if (hasFill) {
-            T4_T6_Tables.EOL16.writeBits(outputStream);
-        } else {
-            T4_T6_Tables.EOL.writeBits(outputStream);
-        }
-        
-        for (int y = 0; y < height; y++) {
-            compress1DLine(inputStream, outputStream, null, width);
+        try (final BitArrayOutputStream outputStream = new BitArrayOutputStream()) {
             if (hasFill) {
-                int bitsAvailable = outputStream.getBitsAvailableInCurrentByte();
-                if (bitsAvailable < 4) {
-                    outputStream.flush();
-                    bitsAvailable = 8;
-                }
-                for (; bitsAvailable > 4; bitsAvailable--) {
-                    outputStream.writeBit(0);
+                T4_T6_Tables.EOL16.writeBits(outputStream);
+            } else {
+                T4_T6_Tables.EOL.writeBits(outputStream);
+            }
+
+            for (int y = 0; y < height; y++) {
+                compress1DLine(inputStream, outputStream, null, width);
+                if (hasFill) {
+                    int bitsAvailable = outputStream.getBitsAvailableInCurrentByte();
+                    if (bitsAvailable < 4) {
+                        outputStream.flush();
+                        bitsAvailable = 8;
+                    }
+                    for (; bitsAvailable > 4; bitsAvailable--) {
+                        outputStream.writeBit(0);
+                    }
                 }
+                T4_T6_Tables.EOL.writeBits(outputStream);
+                inputStream.flushCache();
             }
-            T4_T6_Tables.EOL.writeBits(outputStream);
-            inputStream.flushCache();
+
+            return outputStream.toByteArray();
         }
-        
-        return outputStream.toByteArray();
     }
 
     /**


[25/50] [abbrv] commons-imaging git commit: Use try with resources.

Posted by ch...@apache.org.
Use try with resources.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775931 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/9658a258
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/9658a258
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/9658a258

Branch: refs/heads/master
Commit: 9658a258478c651fd37cbb300ffcd7eba929a0c3
Parents: fabe22a
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 23:28:09 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 23:28:09 2016 +0000

----------------------------------------------------------------------
 .../imaging/common/itu_t4/T4AndT6Compression.java  | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/9658a258/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java b/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
index 96169d8..dcb6c77 100644
--- a/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
+++ b/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
@@ -112,16 +112,17 @@ public final class T4AndT6Compression {
      * @return the compressed data
      * @throws ImageWriteException
      */
-    public static byte[] compressModifiedHuffman(final byte[] uncompressed,
-            final int width, final int height) throws ImageWriteException {
+    public static byte[] compressModifiedHuffman(final byte[] uncompressed, final int width, final int height)
+            throws ImageWriteException {
         final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(uncompressed));
-        final BitArrayOutputStream outputStream = new BitArrayOutputStream();
-        for (int y = 0; y < height; y++) {
-            compress1DLine(inputStream, outputStream, null, width);
-            inputStream.flushCache();
-            outputStream.flush();
+        try (final BitArrayOutputStream outputStream = new BitArrayOutputStream()) {
+            for (int y = 0; y < height; y++) {
+                compress1DLine(inputStream, outputStream, null, width);
+                inputStream.flushCache();
+                outputStream.flush();
+            }
+            return outputStream.toByteArray();
         }
-        return outputStream.toByteArray();
     }
 
     /**


[46/50] [abbrv] commons-imaging git commit: Another local variable we can inline

Posted by ch...@apache.org.
Another local variable we can inline

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795461 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/cfeff184
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/cfeff184
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/cfeff184

Branch: refs/heads/master
Commit: cfeff18434fbe5075bbeed5b8dff2e974cf0980d
Parents: 2e8379b
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:29:54 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:29:54 2017 +0000

----------------------------------------------------------------------
 src/main/java/org/apache/commons/imaging/Imaging.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/cfeff184/src/main/java/org/apache/commons/imaging/Imaging.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/Imaging.java b/src/main/java/org/apache/commons/imaging/Imaging.java
index 3fbb2c9..b42bce1 100644
--- a/src/main/java/org/apache/commons/imaging/Imaging.java
+++ b/src/main/java/org/apache/commons/imaging/Imaging.java
@@ -170,10 +170,8 @@ public final class Imaging {
         String normalizedFilename = filename.toLowerCase(Locale.ENGLISH);
 
         for (final ImageParser imageParser : ImageParser.getAllImageParsers()) {
-            final String[] exts = imageParser.getAcceptedExtensions();
-
-            for (final String ext : exts) {
-                if (normalizedFilename.endsWith(ext.toLowerCase(Locale.ENGLISH))) {
+            for (final String extension : imageParser.getAcceptedExtensions()) {
+                if (normalizedFilename.endsWith(extension.toLowerCase(Locale.ENGLISH))) {
                     return true;
                 }
             }


[07/50] [abbrv] commons-imaging git commit: Local variable is not needed.

Posted by ch...@apache.org.
Local variable is not needed.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775877 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/4e0d10ad
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/4e0d10ad
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/4e0d10ad

Branch: refs/heads/master
Commit: 4e0d10adfaafdc4c37d9f0194990d4c3a6a45747
Parents: d272f27
Author: Gary D. Gregory <gg...@apache.org>
Authored: Fri Dec 23 18:18:59 2016 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Fri Dec 23 18:18:59 2016 +0000

----------------------------------------------------------------------
 .../org/apache/commons/imaging/formats/xbm/XbmImageParser.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/4e0d10ad/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
index bfe5547..a57fd78 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
@@ -134,8 +134,7 @@ public class XbmImageParser extends ImageParser {
 
     private XbmHeader readXbmHeader(final ByteSource byteSource)
             throws ImageReadException, IOException {
-        final XbmParseResult result = parseXbmHeader(byteSource);
-        return result.xbmHeader;
+        return parseXbmHeader(byteSource).xbmHeader;
     }
 
     private XbmParseResult parseXbmHeader(final ByteSource byteSource)


[40/50] [abbrv] commons-imaging git commit: Add missing Apache License header

Posted by ch...@apache.org.
Add missing Apache License header

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1795453 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/6d048e6f
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/6d048e6f
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/6d048e6f

Branch: refs/heads/master
Commit: 6d048e6f082f99f2d0f7a1afc8c21e82d451d9c6
Parents: 1d68e1d
Author: Benedikt Ritter <br...@apache.org>
Authored: Wed May 17 21:03:09 2017 +0000
Committer: Benedikt Ritter <br...@apache.org>
Committed: Wed May 17 21:03:09 2017 +0000

----------------------------------------------------------------------
 .../imaging/formats/pnm/PnmImageParserTest.java     | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/6d048e6f/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java b/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
index a33f782..31a61ce 100644
--- a/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/pnm/PnmImageParserTest.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.commons.imaging.formats.pnm;
 
 import java.io.IOException;