commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1544840 [1/3] - in /commons/proper/imaging/trunk: ./ src/main/java/org/apache/commons/imaging/ src/main/java/org/apache/commons/imaging/color/ src/main/java/org/apache/commons/imaging/common/ src/main/java/org/apache/commons/imaging/common...
Date Sat, 23 Nov 2013 17:19:38 GMT
Author: damjan
Date: Sat Nov 23 17:19:36 2013
New Revision: 1544840

URL: http://svn.apache.org/r1544840
Log:
Configure PMD better.
Fix many PMD reported problems.


Added:
    commons/proper/imaging/trunk/pmd-ruleset.xml   (with props)
Removed:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffFieldFactory.java
Modified:
    commons/proper/imaging/trunk/pom.xml
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ByteConversions.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/FastByteArrayOutputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IBufferedImageFactory.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IImageMetadata.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/writers/BmpWriterRgb.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsDecoder.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/ZigZag.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcConstants.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcType.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/Segment.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngText.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterNone.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffElement.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TagConstantsUtils.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Dithering.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/ParamMap.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java

Added: commons/proper/imaging/trunk/pmd-ruleset.xml
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/pmd-ruleset.xml?rev=1544840&view=auto
==============================================================================
--- commons/proper/imaging/trunk/pmd-ruleset.xml (added)
+++ commons/proper/imaging/trunk/pmd-ruleset.xml Sat Nov 23 17:19:36 2013
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+
+<!--
+   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.
+  -->
+
+<ruleset name="Apache Commons Imaging PMD ruleset"
+    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+
+  <description>This PMD ruleset checks Apache Commons Imaging code</description>
+
+  <rule ref="rulesets/java/basic.xml">
+    <!-- Nested if statements can be good for readability -->
+    <exclude name="CollapsibleIfStatements"/>
+  </rule>
+
+  <rule ref="rulesets/java/braces.xml"/>
+  <rule ref="rulesets/java/clone.xml"/>
+  <rule ref="rulesets/java/comments.xml/CommentContent"/>
+  <rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor"/>
+  <rule ref="rulesets/java/controversial.xml/AtLeastOneConstructor"/>
+  <rule ref="rulesets/java/controversial.xml/DontImportSun"/>
+  <rule ref="rulesets/java/controversial.xml/SuspiciousOctalEscape"/>
+  <rule ref="rulesets/java/controversial.xml/AvoidUsingVolatile"/>
+  <rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode"/>
+  <rule ref="rulesets/java/controversial.xml/AvoidAccessibilityAlteration"/>
+  <rule ref="rulesets/java/controversial.xml/DoNotCallGarbageCollectionExplicitly"/>
+  <rule ref="rulesets/java/controversial.xml/UseObjectForClearerAPI"/>
+  <rule ref="rulesets/java/design.xml">
+    <!-- FIXME: we should eventually replace constant interfaces -->
+    <exclude name="AvoidConstantsInterface"/>
+    <exclude name="AvoidDeeplyNestedIfStmts"/>
+    <exclude name="AvoidReassigningParameters"/>
+    <exclude name="ConfusingTernary"/>
+    <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
+    <exclude name="GodClass"/>
+    <exclude name="ReturnEmptyArrayRatherThanNull"/>
+    <exclude name="SwitchStmtsShouldHaveDefault"/>
+    <exclude name="UnnecessaryLocalBeforeReturn"/>
+  </rule>
+  <rule ref="rulesets/java/empty.xml">
+    <!-- empty if statements are useful to skip actions taken by else (if(s)) -->
+    <exclude name="EmptyIfStmt"/>
+  </rule>
+  <rule ref="rulesets/java/finalizers.xml"/>
+  <rule ref="rulesets/java/imports.xml"/>
+  <rule ref="rulesets/java/migrating.xml"/>
+  <rule ref="rulesets/java/optimizations.xml">
+    <exclude name="AvoidInstantiatingObjectsInLoops"/>
+    <exclude name="RedundantFieldInitializer"/>
+    <exclude name="PrematureDeclaration"/>
+  </rule>
+  <rule ref="rulesets/java/strings.xml">
+    <exclude name="AvoidDuplicateLiterals"/>
+  </rule>
+  <rule ref="rulesets/java/unnecessary.xml">
+    <!-- Parentheses are useful for grouping subexpressions -->
+    <exclude name="UselessParentheses"/>
+  </rule>
+  <rule ref="rulesets/java/unusedcode.xml"/>
+</ruleset>

Propchange: commons/proper/imaging/trunk/pmd-ruleset.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/imaging/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/pom.xml?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/pom.xml (original)
+++ commons/proper/imaging/trunk/pom.xml Sat Nov 23 17:19:36 2013
@@ -257,6 +257,9 @@
         <version>3.0.1</version>
         <configuration>
           <targetJdk>${maven.compile.target}</targetJdk>
+          <rulesets>
+            <ruleset>${basedir}/pmd-ruleset.xml</ruleset>
+          </rulesets>
         </configuration>
       </plugin>
       <plugin>

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java Sat Nov 23 17:19:36 2013
@@ -74,7 +74,7 @@ public class FormatCompliance {
     public void dump(final PrintWriter pw) {
         pw.println("Format Compliance: " + description);
 
-        if (comments.size() == 0) {
+        if (comments.isEmpty()) {
             pw.println("\t" + "No comments.");
         } else {
             for (int i = 0; i < comments.size(); i++) {
@@ -135,10 +135,11 @@ public class FormatCompliance {
             }
         }
 
-        final StringBuilder result = new StringBuilder();
-        result.append(name + ": " + "Unexpected value: (valid: ");
+        final StringBuilder result = new StringBuilder(43);
+        result.append(name);
+        result.append(": Unexpected value: (valid: ");
         if (valid.length > 1) {
-            result.append("{");
+            result.append('{');
         }
         for (int i = 0; i < valid.length; i++) {
             if (i > 0) {
@@ -147,7 +148,7 @@ public class FormatCompliance {
             result.append(getValueDescription(valid[i]));
         }
         if (valid.length > 1) {
-            result.append("}");
+            result.append('}');
         }
         result.append(", actual: " + getValueDescription(actual) + ")");
         addComment(result.toString());

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java Sat Nov 23 17:19:36 2013
@@ -48,9 +48,9 @@ public class ImageDump {
             return "CS_LINEAR_RGB";
         case ColorSpace.CS_PYCC:
             return "CS_PYCC";
+        default:
+            return "unknown";
         }
-
-        return "unknown";
     }
 
     public void dumpColorSpace(final String prefix, final ColorSpace cs) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java Sat Nov 23 17:19:36 2013
@@ -25,6 +25,7 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.commons.imaging.common.BinaryFileParser;
@@ -950,10 +951,11 @@ public abstract class ImageParser extend
         final int index = filename.lastIndexOf('.');
         if (index >= 0) {
             String ext = filename.substring(index);
-            ext = ext.toLowerCase();
+            ext = ext.toLowerCase(Locale.ENGLISH);
 
             for (final String ext2 : exts) {
-                if (ext2.toLowerCase().equals(ext)) {
+                final String ext2Lower = ext2.toLowerCase(Locale.ENGLISH);
+                if (ext2Lower.equals(ext)) {
                     return true;
                 }
             }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java Sat Nov 23 17:19:36 2013
@@ -28,6 +28,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import org.apache.commons.imaging.common.IImageMetadata;
@@ -84,6 +85,25 @@ import org.apache.commons.imaging.util.I
  * @see <a href="http://commons.apache.org/imaging/formatsupport.html">Format Support</a>
  */
 public abstract class Imaging implements ImagingConstants {
+    private static final int[] MAGIC_NUMBERS_GIF = { 0x47, 0x49, };
+    private static final int[] MAGIC_NUMBERS_PNG = { 0x89, 0x50, };
+    private static final int[] MAGIC_NUMBERS_JPEG = { 0xff, 0xd8, };
+    private static final int[] MAGIC_NUMBERS_BMP = { 0x42, 0x4d, };
+    private static final int[] MAGIC_NUMBERS_TIFF_MOTOROLA = { 0x4D, 0x4D, };
+    private static final int[] MAGIC_NUMBERS_TIFF_INTEL = { 0x49, 0x49, };
+    private static final int[] MAGIC_NUMBERS_PAM = { 0x50, 0x37, };
+    private static final int[] MAGIC_NUMBERS_PSD = { 0x38, 0x42, };
+    private static final int[] MAGIC_NUMBERS_PBM_A = { 0x50, 0x31, };
+    private static final int[] MAGIC_NUMBERS_PBM_B = { 0x50, 0x34, };
+    private static final int[] MAGIC_NUMBERS_PGM_A = { 0x50, 0x32, };
+    private static final int[] MAGIC_NUMBERS_PGM_B = { 0x50, 0x35, };
+    private static final int[] MAGIC_NUMBERS_PPM_A = { 0x50, 0x33, };
+    private static final int[] MAGIC_NUMBERS_PPM_B = { 0x50, 0x36, };
+    private static final int[] MAGIC_NUMBERS_JBIG2_1 = { 0x97, 0x4A, };
+    private static final int[] MAGIC_NUMBERS_JBIG2_2 = { 0x42, 0x32, };
+    private static final int[] MAGIC_NUMBERS_ICNS = { 0x69, 0x63, };
+    private static final int[] MAGIC_NUMBERS_DCX = { 0xB1, 0x68, };
+    private static final int[] MAGIC_NUMBERS_RGBE = { 0x23, 0x3F, };
 
     /**
      * Attempts to determine if a file contains an image recorded in 
@@ -116,14 +136,14 @@ public abstract class Imaging implements
             return false;
         }
         
-        filename = filename.toLowerCase();
+        filename = 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())) {
+                if (filename.endsWith(ext.toLowerCase(Locale.ENGLISH))) {
                     return true;
                 }
             }
@@ -172,26 +192,6 @@ public abstract class Imaging implements
         return guessFormat(new ByteSourceFile(file));
     }
 
-    private static final int[] MAGIC_NUMBERS_GIF = { 0x47, 0x49, };
-    private static final int[] MAGIC_NUMBERS_PNG = { 0x89, 0x50, };
-    private static final int[] MAGIC_NUMBERS_JPEG = { 0xff, 0xd8, };
-    private static final int[] MAGIC_NUMBERS_BMP = { 0x42, 0x4d, };
-    private static final int[] MAGIC_NUMBERS_TIFF_MOTOROLA = { 0x4D, 0x4D, };
-    private static final int[] MAGIC_NUMBERS_TIFF_INTEL = { 0x49, 0x49, };
-    private static final int[] MAGIC_NUMBERS_PAM = { 0x50, 0x37, };
-    private static final int[] MAGIC_NUMBERS_PSD = { 0x38, 0x42, };
-    private static final int[] MAGIC_NUMBERS_PBM_A = { 0x50, 0x31, };
-    private static final int[] MAGIC_NUMBERS_PBM_B = { 0x50, 0x34, };
-    private static final int[] MAGIC_NUMBERS_PGM_A = { 0x50, 0x32, };
-    private static final int[] MAGIC_NUMBERS_PGM_B = { 0x50, 0x35, };
-    private static final int[] MAGIC_NUMBERS_PPM_A = { 0x50, 0x33, };
-    private static final int[] MAGIC_NUMBERS_PPM_B = { 0x50, 0x36, };
-    private static final int[] MAGIC_NUMBERS_JBIG2_1 = { 0x97, 0x4A, };
-    private static final int[] MAGIC_NUMBERS_JBIG2_2 = { 0x42, 0x32, };
-    private static final int[] MAGIC_NUMBERS_ICNS = { 0x69, 0x63, };
-    private static final int[] MAGIC_NUMBERS_DCX = { 0xB1, 0x68, };
-    private static final int[] MAGIC_NUMBERS_RGBE = { 0x23, 0x3F, };
-
     private static boolean compareBytePair(final int[] a, final int b[]) {
         if (a.length != 2 && b.length != 2) {
             throw new RuntimeException("Invalid Byte Pair.");
@@ -1488,18 +1488,18 @@ public abstract class Imaging implements
 
         params.put(PARAM_KEY_FORMAT, format);
 
+        ImageParser imageParser = null;
         for (final ImageParser imageParser2 : imageParsers) {
-            final ImageParser imageParser = imageParser2;
-
-            if (!imageParser.canAcceptType(format)) {
-                continue;
+            if (imageParser2.canAcceptType(format)) {
+                imageParser = imageParser2;
+                break;
             }
-
+        }
+        if (imageParser != null) {
             imageParser.writeImage(src, os, params);
-            return;
+        } else {
+            throw new ImageWriteException("Unknown Format: " + format);
         }
-
-        throw new ImageWriteException("Unknown Format: " + format);
     }
 
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java Sat Nov 23 17:19:36 2013
@@ -29,7 +29,7 @@ public interface ImagingConstants {
      * <p>
      * Valid values: Boolean.TRUE and Boolean.FALSE.
      */
-    public static final String PARAM_KEY_VERBOSE = "VERBOSE";
+    String PARAM_KEY_VERBOSE = "VERBOSE";
 
     /**
      * Parameter key. Used to hint the filename when reading from a byte array
@@ -43,7 +43,7 @@ public interface ImagingConstants {
      * 
      * @see java.io.InputStream
      */
-    public static final String PARAM_KEY_FILENAME = "FILENAME";
+    String PARAM_KEY_FILENAME = "FILENAME";
 
     /**
      * Parameter key. Used in write operations to indicate desired image format.
@@ -54,7 +54,7 @@ public interface ImagingConstants {
      * 
      * @see org.apache.commons.imaging.ImageFormats
      */
-    public static final String PARAM_KEY_FORMAT = "FORMAT";
+    String PARAM_KEY_FORMAT = "FORMAT";
 
     /**
      * Parameter key. Used in write operations to indicate desired compression
@@ -70,9 +70,9 @@ public interface ImagingConstants {
      * 
      * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants
      */
-    public static final String PARAM_KEY_COMPRESSION = "COMPRESSION";
+    String PARAM_KEY_COMPRESSION = "COMPRESSION";
 
-    public static final String BUFFERED_IMAGE_FACTORY = "BUFFERED_IMAGE_FACTORY";
+    String BUFFERED_IMAGE_FACTORY = "BUFFERED_IMAGE_FACTORY";
 
     /**
      * Parameter key. Indicates whether to read embedded thumbnails.
@@ -84,7 +84,7 @@ public interface ImagingConstants {
      * 
      * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants
      */
-    public static final String PARAM_KEY_READ_THUMBNAILS = "READ_THUMBNAILS";
+    String PARAM_KEY_READ_THUMBNAILS = "READ_THUMBNAILS";
 
     /**
      * Parameter key. Indicates whether to throw exceptions when parsing invalid
@@ -96,7 +96,7 @@ public interface ImagingConstants {
      * 
      * @see org.apache.commons.imaging.formats.tiff.constants.TiffConstants
      */
-    public static final String PARAM_KEY_STRICT = "STRICT";
+    String PARAM_KEY_STRICT = "STRICT";
 
     /**
      * Parameter key.
@@ -108,7 +108,7 @@ public interface ImagingConstants {
      * 
      * @see org.apache.commons.imaging.formats.tiff.write.TiffOutputSet
      */
-    public static final String PARAM_KEY_EXIF = "EXIF";
+    String PARAM_KEY_EXIF = "EXIF";
 
     /**
      * Parameter key.
@@ -118,7 +118,7 @@ public interface ImagingConstants {
      * Valid values: String of XMP XML.
      * <p>
      */
-    public static final String PARAM_KEY_XMP_XML = "XMP_XML";
+    String PARAM_KEY_XMP_XML = "XMP_XML";
 
     /**
      * Parameter key. Used in write operations to indicate the desired pixel
@@ -129,5 +129,5 @@ public interface ImagingConstants {
      * 
      * @see org.apache.commons.imaging.PixelDensity
      */
-    public static final String PARAM_KEY_PIXEL_DENSITY = "PIXEL_DENSITY";
+    String PARAM_KEY_PIXEL_DENSITY = "PIXEL_DENSITY";
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java Sat Nov 23 17:19:36 2013
@@ -20,7 +20,7 @@ package org.apache.commons.imaging;
  * Used to specify pixel density and physical dimensions when reading or
  * storing image information.
  */
-public class PixelDensity {
+public final class PixelDensity {
     private final double horizontalDensity;
     private final double verticalDensity;
     // / One-tenth of a millimetre units.

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java Sat Nov 23 17:19:36 2013
@@ -17,16 +17,19 @@
 package org.apache.commons.imaging.color;
 
 
-public abstract class ColorConversions {
-    public static final ColorCieLab convertXYZtoCIELab(final ColorXyz xyz) {
-        return convertXYZtoCIELab(xyz.X, xyz.Y, xyz.Z);
-    }
-
+public final class ColorConversions {
     private static final double ref_X = 95.047;  // Observer= 2°, Illuminant= D65
     private static final double ref_Y = 100.000;
     private static final double ref_Z = 108.883;
+    
+    private ColorConversions() {
+    }
+
+    public static ColorCieLab convertXYZtoCIELab(final ColorXyz xyz) {
+        return convertXYZtoCIELab(xyz.X, xyz.Y, xyz.Z);
+    }
 
-    public static final ColorCieLab convertXYZtoCIELab(final double X, final double Y,
+    public static ColorCieLab convertXYZtoCIELab(final double X, final double Y,
             final double Z) {
 
         double var_X = X / ref_X; // ref_X = 95.047 Observer= 2°, Illuminant=
@@ -56,11 +59,11 @@ public abstract class ColorConversions {
         return new ColorCieLab(L, a, b);
     }
 
-    public static final ColorXyz convertCIELabtoXYZ(final ColorCieLab cielab) {
+    public static ColorXyz convertCIELabtoXYZ(final ColorCieLab cielab) {
         return convertCIELabtoXYZ(cielab.L, cielab.a, cielab.b);
     }
 
-    public static final ColorXyz convertCIELabtoXYZ(final double L, final double a, final double b) {
+    public static ColorXyz convertCIELabtoXYZ(final double L, final double a, final double b) {
         double var_Y = (L + 16) / 116.0;
         double var_X = a / 500 + var_Y;
         double var_Z = var_Y - b / 200.0;
@@ -89,11 +92,11 @@ public abstract class ColorConversions {
         return new ColorXyz(X, Y, Z);
     }
 
-    public static final ColorHunterLab convertXYZtoHunterLab(final ColorXyz xyz) {
+    public static ColorHunterLab convertXYZtoHunterLab(final ColorXyz xyz) {
         return convertXYZtoHunterLab(xyz.X, xyz.Y, xyz.Z);
     }
 
-    public static final ColorHunterLab convertXYZtoHunterLab(final double X,
+    public static ColorHunterLab convertXYZtoHunterLab(final double X,
             final double Y, final double Z) {
         final double L = 10 * Math.sqrt(Y);
         final double a = 17.5 * (((1.02 * X) - Y) / Math.sqrt(Y));
@@ -102,11 +105,11 @@ public abstract class ColorConversions {
         return new ColorHunterLab(L, a, b);
     }
 
-    public static final ColorXyz convertHunterLabtoXYZ(final ColorHunterLab cielab) {
+    public static ColorXyz convertHunterLabtoXYZ(final ColorHunterLab cielab) {
         return convertHunterLabtoXYZ(cielab.L, cielab.a, cielab.b);
     }
 
-    public static final ColorXyz convertHunterLabtoXYZ(final double L, final double a,
+    public static ColorXyz convertHunterLabtoXYZ(final double L, final double a,
             final double b) {
         final double var_Y = L / 10;
         final double var_X = a / 17.5 * L / 10;
@@ -119,11 +122,11 @@ public abstract class ColorConversions {
         return new ColorXyz(X, Y, Z);
     }
 
-    public static final int convertXYZtoRGB(final ColorXyz xyz) {
+    public static int convertXYZtoRGB(final ColorXyz xyz) {
         return convertXYZtoRGB(xyz.X, xyz.Y, xyz.Z);
     }
 
-    public static final int convertXYZtoRGB(final double X, final double Y, final double Z) {
+    public static int convertXYZtoRGB(final double X, final double Y, final double Z) {
         // Observer = 2°, Illuminant = D65
         final double var_X = X / 100.0; // Where X = 0 ÷ 95.047
         final double var_Y = Y / 100.0; // Where Y = 0 ÷ 100.000
@@ -156,7 +159,7 @@ public abstract class ColorConversions {
         return convertRGBtoRGB(R, G, B);
     }
 
-    public static final ColorXyz convertRGBtoXYZ(final int rgb) {
+    public static ColorXyz convertRGBtoXYZ(final int rgb) {
         final int r = 0xff & (rgb >> 16);
         final int g = 0xff & (rgb >> 8);
         final int b = 0xff & (rgb >> 0);
@@ -193,7 +196,7 @@ public abstract class ColorConversions {
         return new ColorXyz(X, Y, Z);
     }
 
-    public static final ColorCmy convertRGBtoCMY(final int rgb) {
+    public static ColorCmy convertRGBtoCMY(final int rgb) {
         final int R = 0xff & (rgb >> 16);
         final int G = 0xff & (rgb >> 8);
         final int B = 0xff & (rgb >> 0);
@@ -208,7 +211,7 @@ public abstract class ColorConversions {
         return new ColorCmy(C, M, Y);
     }
 
-    public static final int convertCMYtoRGB(final ColorCmy cmy) {
+    public static int convertCMYtoRGB(final ColorCmy cmy) {
         // From Ghostscript's gdevcdj.c:
         // * Ghostscript: R = (1.0 - C) * (1.0 - K)
         // * Adobe: R = 1.0 - min(1.0, C + K)
@@ -225,7 +228,7 @@ public abstract class ColorConversions {
         return convertRGBtoRGB(R, G, B);
     }
 
-    public static final ColorCmyk convertCMYtoCMYK(final ColorCmy cmy) {
+    public static ColorCmyk convertCMYtoCMYK(final ColorCmy cmy) {
         // Where CMYK and CMY values = 0 ÷ 1
 
         double C = cmy.C;
@@ -255,11 +258,11 @@ public abstract class ColorConversions {
         return new ColorCmyk(C, M, Y, var_K);
     }
 
-    public static final ColorCmy convertCMYKtoCMY(final ColorCmyk cmyk) {
+    public static ColorCmy convertCMYKtoCMY(final ColorCmyk cmyk) {
         return convertCMYKtoCMY(cmyk.C, cmyk.M, cmyk.Y, cmyk.K);
     }
 
-    public static final ColorCmy convertCMYKtoCMY(double C, double M, double Y,
+    public static ColorCmy convertCMYKtoCMY(double C, double M, double Y,
             final double K) {
         // Where CMYK and CMY values = 0 ÷ 1
 
@@ -270,7 +273,7 @@ public abstract class ColorConversions {
         return new ColorCmy(C, M, Y);
     }
 
-    public static final int convertCMYKtoRGB(final int c, final int m, final int y, final int k)
+    public static int convertCMYKtoRGB(final int c, final int m, final int y, final int k)
     // throws ImageReadException, IOException
     {
         final double C = c / 255.0;
@@ -281,7 +284,7 @@ public abstract class ColorConversions {
         return convertCMYtoRGB(convertCMYKtoCMY(C, M, Y, K));
     }
 
-    public static final ColorHsl convertRGBtoHSL(final int rgb) {
+    public static ColorHsl convertRGBtoHSL(final int rgb) {
 
         final int R = 0xff & (rgb >> 16);
         final int G = 0xff & (rgb >> 8);
@@ -406,7 +409,7 @@ public abstract class ColorConversions {
         return (v1);
     }
 
-    public static final ColorHsv convertRGBtoHSV(final int rgb) {
+    public static ColorHsv convertRGBtoHSV(final int rgb) {
         final int R = 0xff & (rgb >> 16);
         final int G = 0xff & (rgb >> 8);
         final int B = 0xff & (rgb >> 0);
@@ -523,7 +526,7 @@ public abstract class ColorConversions {
         return convertRGBtoRGB(R, G, B);
     }
 
-    public static final int convertCMYKtoRGB_Adobe(final int sc, final int sm, final int sy,
+    public static int convertCMYKtoRGB_Adobe(final int sc, final int sm, final int sy,
             final int sk) {
         final int red = 255 - (sc + sk);
         final int green = 255 - (sm + sk);
@@ -540,7 +543,7 @@ public abstract class ColorConversions {
         return f * f;
     }
 
-    public static final int convertCIELabtoARGBTest(final int cieL, final int cieA, final int cieB) {
+    public static int convertCIELabtoARGBTest(final int cieL, final int cieA, final int cieB) {
         double X, Y, Z;
 
         {
@@ -616,7 +619,7 @@ public abstract class ColorConversions {
         return convertRGBtoRGB(R, G, B);
     }
 
-    private static final int convertRGBtoRGB(final double R, final double G, final double B) {
+    private static int convertRGBtoRGB(final double R, final double G, final double B) {
         int red = (int) Math.round(R);
         int green = (int) Math.round(G);
         int blue = (int) Math.round(B);
@@ -631,7 +634,7 @@ public abstract class ColorConversions {
         return rgb;
     }
 
-    private static final int convertRGBtoRGB(int red, int green, int blue) {
+    private static int convertRGBtoRGB(int red, int green, int blue) {
         red = Math.min(255, Math.max(0, red));
         green = Math.min(255, Math.max(0, green));
         blue = Math.min(255, Math.max(0, blue));

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java Sat Nov 23 17:19:36 2013
@@ -320,7 +320,7 @@ public class BasicCParser {
                     i += 2;
                     int constant;
                     try {
-                        constant = Integer.parseInt("" + hex1 + hex2, 16);
+                        constant = Integer.parseInt(Character.toString(hex1) + Character.toString(hex2), 16);
                     } catch (final NumberFormatException nfe) {
                         throw new ImageReadException(
                                 "Parsing XPM file failed, "

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java Sat Nov 23 17:19:36 2013
@@ -33,7 +33,11 @@ public class BinaryFileParser {
         this.byteOrder = byteOrder;
     }
 
+    /**
+     * Constructs a BinaryFileParser with the default, big-endian, byte order.
+     */
     public BinaryFileParser() {
+        // as above
     }
 
     protected void setByteOrder(final ByteOrder byteOrder) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java Sat Nov 23 17:19:36 2013
@@ -28,8 +28,11 @@ import org.apache.commons.imaging.ImageR
 /**
  * Convenience methods for various binary and I/O operations.
  */
-public class BinaryFunctions {
-    public static final boolean startsWith(final byte haystack[], final byte needle[]) {
+public final class BinaryFunctions {
+    private BinaryFunctions() {
+    }
+    
+    public static boolean startsWith(final byte haystack[], final byte needle[]) {
         if (needle == null) {
             return false;
         }
@@ -49,7 +52,7 @@ public class BinaryFunctions {
         return true;
     }
 
-    public static final byte readByte(final String name, final InputStream is, final String exception)
+    public static byte readByte(final String name, final InputStream is, final String exception)
             throws IOException {
         final int result = is.read();
         if ((result < 0)) {
@@ -58,13 +61,13 @@ public class BinaryFunctions {
         return (byte) (0xff & result);
     }
 
-    public static final byte[] readBytes(final String name, final InputStream is, final int length)
+    public static byte[] readBytes(final String name, final InputStream is, final int length)
             throws IOException {
         final String exception = name + " could not be read.";
         return readBytes(name, is, length, exception);
     }
 
-    public static final byte[] readBytes(final String name, final InputStream is, final int length,
+    public static byte[] readBytes(final String name, final InputStream is, final int length,
             final String exception) throws IOException {
         final byte result[] = new byte[length];
         int read = 0;
@@ -81,11 +84,11 @@ public class BinaryFunctions {
         return result;
     }
 
-    public static final byte[] readBytes(final InputStream is, final int count) throws IOException {
+    public static byte[] readBytes(final InputStream is, final int count) throws IOException {
         return readBytes("", is, count, "Unexpected EOF");
     }
 
-    public static final void readAndVerifyBytes(final InputStream is, final byte expected[],
+    public static void readAndVerifyBytes(final InputStream is, final byte expected[],
             final String exception) throws ImageReadException, IOException {
         for (final byte element : expected) {
             final int data = is.read();
@@ -101,7 +104,7 @@ public class BinaryFunctions {
         }
     }
 
-    public static final void readAndVerifyBytes(final InputStream is,
+    public static void readAndVerifyBytes(final InputStream is,
             final BinaryConstant expected, final String exception)
             throws ImageReadException, IOException {
         for (int i = 0; i < expected.size(); i++) {
@@ -118,7 +121,7 @@ public class BinaryFunctions {
         }
     }
 
-    public static final void readAndVerifyBytes(final String name, final InputStream is,
+    public static void readAndVerifyBytes(final String name, final InputStream is,
             final byte expected[], final String exception) throws ImageReadException,
             IOException {
         final byte bytes[] = readBytes(name, is, expected.length, exception);
@@ -130,7 +133,7 @@ public class BinaryFunctions {
         }
     }
 
-    public static final void skipBytes(final InputStream is, final long length, final String exception)
+    public static void skipBytes(final InputStream is, final long length, final String exception)
             throws IOException {
         long total = 0;
         while (length != total) {
@@ -142,7 +145,7 @@ public class BinaryFunctions {
         }
     }
 
-    public static final void scanForByte(final InputStream is, final byte value)
+    public static void scanForByte(final InputStream is, final byte value)
             throws IOException {
         int count = 0;
         for (int i = 0; count < 3; i++) {
@@ -157,31 +160,31 @@ public class BinaryFunctions {
         }
     }
 
-    public static final byte[] remainingBytes(final String name, final byte bytes[], final int count) {
+    public static byte[] remainingBytes(final String name, final byte bytes[], final int count) {
         return slice(bytes, count, bytes.length - count);
     }
 
-    public static final byte[] slice(final byte bytes[], final int start, final int count) {
+    public static byte[] slice(final byte bytes[], final int start, final int count) {
         final byte result[] = new byte[count];
         System.arraycopy(bytes, start, result, 0, count);
         return result;
     }
 
-    public static final byte[] tail(final byte bytes[], int count) {
+    public static byte[] tail(final byte bytes[], int count) {
         if (count > bytes.length) {
             count = bytes.length;
         }
         return slice(bytes, bytes.length - count, count);
     }
 
-    public static final byte[] head(final byte bytes[], int count) {
+    public static byte[] head(final byte bytes[], int count) {
         if (count > bytes.length) {
             count = bytes.length;
         }
         return slice(bytes, 0, count);
     }
 
-    public static final boolean compareBytes(final byte a[], final int aStart, final byte b[],
+    public static boolean compareBytes(final byte a[], final int aStart, final byte b[],
             final int bStart, final int length) {
         if (a.length < (aStart + length)) {
             return false;
@@ -199,7 +202,7 @@ public class BinaryFunctions {
         return true;
     }
 
-    public static final int read4Bytes(final String name, final InputStream is,
+    public static int read4Bytes(final String name, final InputStream is,
             final String exception, final ByteOrder byteOrder) throws IOException {
         final int byte0 = is.read();
         final int byte1 = is.read();
@@ -221,7 +224,7 @@ public class BinaryFunctions {
         return result;
     }
 
-    public static final int read3Bytes(final String name, final InputStream is,
+    public static int read3Bytes(final String name, final InputStream is,
             final String exception, final ByteOrder byteOrder) throws IOException {
         final int byte0 = is.read();
         final int byte1 = is.read();
@@ -242,7 +245,7 @@ public class BinaryFunctions {
         return result;
     }
 
-    public static final int read2Bytes(final String name, final InputStream is,
+    public static int read2Bytes(final String name, final InputStream is,
             final String exception, final ByteOrder byteOrder) throws IOException {
         final int byte0 = is.read();
         final int byte1 = is.read();
@@ -260,33 +263,33 @@ public class BinaryFunctions {
         return result;
     }
 
-    public static final void printCharQuad(final String msg, final int i) {
+    public static void printCharQuad(final String msg, final int i) {
         System.out.println(msg + ": '" + (char) (0xff & (i >> 24))
                 + (char) (0xff & (i >> 16)) + (char) (0xff & (i >> 8))
                 + (char) (0xff & (i >> 0)) + "'");
 
     }
 
-    public static final void printCharQuad(final PrintWriter pw, final String msg, final int i) {
+    public static void printCharQuad(final PrintWriter pw, final String msg, final int i) {
         pw.println(msg + ": '" + (char) (0xff & (i >> 24))
                 + (char) (0xff & (i >> 16)) + (char) (0xff & (i >> 8))
                 + (char) (0xff & (i >> 0)) + "'");
 
     }
 
-    public static final void printByteBits(final String msg, final byte i) {
+    public static void printByteBits(final String msg, final byte i) {
         System.out.println(msg + ": '" + Integer.toBinaryString(0xff & i));
     }
 
-    public static final int charsToQuad(final char c1, final char c2, final char c3, final char c4) {
+    public static int charsToQuad(final char c1, final char c2, final char c3, final char c4) {
         return (((0xff & c1) << 24) | ((0xff & c2) << 16) | ((0xff & c3) << 8) | ((0xff & c4) << 0));
     }
 
-    public static final int findNull(final byte src[]) {
+    public static int findNull(final byte src[]) {
         return findNull(src, 0);
     }
 
-    public static final int findNull(final byte src[], final int start) {
+    public static int findNull(final byte src[], final int start) {
         for (int i = start; i < src.length; i++) {
             if (src[i] == 0) {
                 return i;
@@ -295,7 +298,7 @@ public class BinaryFunctions {
         return -1;
     }
 
-    public static final byte[] getRAFBytes(final RandomAccessFile raf, final long pos,
+    public static byte[] getRAFBytes(final RandomAccessFile raf, final long pos,
             final int length, final String exception) throws IOException {
         final byte result[] = new byte[length];
 
@@ -315,11 +318,11 @@ public class BinaryFunctions {
 
     }
 
-    public static final void skipBytes(final InputStream is, final long length) throws IOException {
+    public static void skipBytes(final InputStream is, final long length) throws IOException {
         skipBytes(is, length, "Couldn't skip bytes");
     }
 
-    public static final void copyStreamToStream(final InputStream is, final OutputStream os)
+    public static void copyStreamToStream(final InputStream is, final OutputStream os)
             throws IOException {
         final byte buffer[] = new byte[1024];
         int read;
@@ -328,7 +331,7 @@ public class BinaryFunctions {
         }
     }
 
-    public static final byte[] getStreamBytes(final InputStream is) throws IOException {
+    public static byte[] getStreamBytes(final InputStream is) throws IOException {
         final ByteArrayOutputStream os = new ByteArrayOutputStream();
         copyStreamToStream(is, os);
         return os.toByteArray();

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java Sat Nov 23 17:19:36 2013
@@ -25,9 +25,11 @@ import java.io.InputStream;
  * < 8 bit fields across byte boundaries.
  */
 public class BitInputStream extends InputStream {
-
     private final InputStream is;
     private final ByteOrder byteOrder;
+    private int cache;
+    private int cacheBitsRemaining = 0;
+    private long bytes_read = 0;
 
     public BitInputStream(final InputStream is, final ByteOrder byteOrder) {
         this.is = is;
@@ -42,10 +44,6 @@ public class BitInputStream extends Inpu
         return is.read();
     }
 
-    private int cache;
-    private int cacheBitsRemaining = 0;
-    private long bytes_read = 0;
-
     public final int readBits(final int count) throws IOException {
         if (count < 8) {
             if (cacheBitsRemaining == 0) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java Sat Nov 23 17:19:36 2013
@@ -28,6 +28,9 @@ public class BitInputStreamFlexible exte
     // TODO should be byte order conscious, ie TIFF for reading
     // samples size<8 - shuoldn't that effect their order within byte?
     private final InputStream is;
+    private int cache;
+    private int cacheBitsRemaining = 0;
+    private long bytesRead = 0;
 
     public BitInputStreamFlexible(final InputStream is) {
         this.is = is;
@@ -42,10 +45,6 @@ public class BitInputStreamFlexible exte
         return is.read();
     }
 
-    private int cache;
-    private int cacheBitsRemaining = 0;
-    private long bytesRead = 0;
-
     public final int readBits(int count) throws IOException {
 
         if (count <= 32)  {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ByteConversions.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ByteConversions.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ByteConversions.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ByteConversions.java Sat Nov 23 17:19:36 2013
@@ -20,7 +20,10 @@ package org.apache.commons.imaging.commo
  * Convenience methods for converting data types to and from
  * byte arrays.
  */
-public class ByteConversions {
+public final class ByteConversions {
+    private ByteConversions() {
+    }
+    
     public static byte[] toBytes(final short value, final ByteOrder byteOrder) {
         final byte[] result = new byte[2];
         toBytes(value, byteOrder, result, 0);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/FastByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/FastByteArrayOutputStream.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/FastByteArrayOutputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/FastByteArrayOutputStream.java Sat Nov 23 17:19:36 2013
@@ -24,13 +24,12 @@ import java.io.OutputStream;
   */
 public class FastByteArrayOutputStream extends OutputStream {
     private final byte bytes[];
+    private int count = 0;
 
     public FastByteArrayOutputStream(final int length) {
         bytes = new byte[length];
     }
 
-    private int count = 0;
-
     @Override
     public void write(final int value) throws IOException {
         if (count >= bytes.length) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IBufferedImageFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IBufferedImageFactory.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IBufferedImageFactory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IBufferedImageFactory.java Sat Nov 23 17:19:36 2013
@@ -20,9 +20,9 @@ package org.apache.commons.imaging.commo
 import java.awt.image.BufferedImage;
 
 public interface IBufferedImageFactory {
-    public BufferedImage getColorBufferedImage(int width, int height,
+    BufferedImage getColorBufferedImage(int width, int height,
             boolean hasAlpha);
 
-    public BufferedImage getGrayscaleBufferedImage(int width, int height,
+    BufferedImage getGrayscaleBufferedImage(int width, int height,
             boolean hasAlpha);
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IImageMetadata.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IImageMetadata.java Sat Nov 23 17:19:36 2013
@@ -19,13 +19,13 @@ package org.apache.commons.imaging.commo
 import java.util.List;
 
 public interface IImageMetadata {
-    public String toString(String prefix);
+    String toString(String prefix);
 
-    public List<? extends IImageMetadataItem> getItems();
+    List<? extends IImageMetadataItem> getItems();
 
-    public interface IImageMetadataItem {
-        public String toString(String prefix);
+    interface IImageMetadataItem {
+        String toString(String prefix);
 
-        public String toString();
+        String toString();
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java Sat Nov 23 17:19:36 2013
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class ImageMetadata implements IImageMetadata {
+    protected static final String newline = System.getProperty("line.separator");
     private final List<IImageMetadataItem> items = new ArrayList<IImageMetadataItem>();
 
     public void add(final String keyword, final String text) {
@@ -34,9 +35,6 @@ public class ImageMetadata implements II
         return new ArrayList<IImageMetadataItem>(items);
     }
 
-    protected static final String newline = System
-            .getProperty("line.separator");
-
     @Override
     public String toString() {
         return toString(null);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java Sat Nov 23 17:19:36 2013
@@ -116,7 +116,7 @@ public class RationalNumber extends Numb
 
     public String toDisplayString() {
         if ((numerator % divisor) == 0) {
-            return "" + (numerator / divisor);
+            return Integer.toString(numerator / divisor);
         }
         final NumberFormat nf = NumberFormat.getInstance();
         nf.setMaximumFractionDigits(3);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java Sat Nov 23 17:19:36 2013
@@ -19,6 +19,8 @@ package org.apache.commons.imaging.commo
 public abstract class RationalNumberUtilities extends Number {
 
     private static final long serialVersionUID = 4636553158238799602L;
+    // int-precision tolerance
+    private static final double TOLERANCE = 1E-8;
 
     private static class Option {
         public final RationalNumber rationalNumber;
@@ -41,9 +43,6 @@ public abstract class RationalNumberUtil
         }
     }
 
-    // int-precision tolerance
-    private static final double TOLERANCE = 1E-8;
-
     //
     // calculate rational number using successive approximations.
     //

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java Sat Nov 23 17:19:36 2013
@@ -24,11 +24,11 @@ import java.util.zip.InflaterInputStream
 
 import org.apache.commons.imaging.util.IoUtils;
 
-public class ZLibUtils extends BinaryFunctions {
+public class ZLibUtils {
     public final byte[] inflate(final byte bytes[]) throws IOException {
         final ByteArrayInputStream in = new ByteArrayInputStream(bytes);
         final InflaterInputStream zIn = new InflaterInputStream(in);
-        return getStreamBytes(zIn);
+        return BinaryFunctions.getStreamBytes(zIn);
     }
 
     public final byte[] deflate(final byte bytes[]) throws IOException {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java Sat Nov 23 17:19:36 2013
@@ -21,7 +21,7 @@ import java.io.InputStream;
 
 import org.apache.commons.imaging.common.BinaryFunctions;
 
-public abstract class ByteSource extends BinaryFunctions {
+public abstract class ByteSource {
     protected final String filename;
 
     public ByteSource(final String filename) {
@@ -33,7 +33,7 @@ public abstract class ByteSource extends
         boolean succeeded = false;
         try {
             is = getInputStream();
-            skipBytes(is, start);
+            BinaryFunctions.skipBytes(is, start);
             succeeded = true;
         } finally {
             if (!succeeded && is != null) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java Sat Nov 23 17:19:36 2013
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.RandomAccessFile;
 
+import org.apache.commons.imaging.common.BinaryFunctions;
 import org.apache.commons.imaging.util.IoUtils;
 
 public class ByteSourceFile extends ByteSource {
@@ -59,7 +60,7 @@ public class ByteSourceFile extends Byte
                         + ", data length: " + raf.length() + ").");
             }
 
-            final byte[] ret = getRAFBytes(raf, start, length,
+            final byte[] ret = BinaryFunctions.getRAFBytes(raf, start, length,
                     "Could not read value from file");
             canThrow = true;
             return ret;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java Sat Nov 23 17:19:36 2013
@@ -21,10 +21,14 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.commons.imaging.common.BinaryFunctions;
+
 public class ByteSourceInputStream extends ByteSource {
     private final InputStream is;
     private CacheBlock cacheHead = null;
     private static final int BLOCK_SIZE = 1024;
+    private byte readBuffer[] = null;
+    private long streamLength = -1;
 
     public ByteSourceInputStream(final InputStream is, final String filename) {
         super(filename);
@@ -54,8 +58,6 @@ public class ByteSourceInputStream exten
 
     }
 
-    private byte readBuffer[] = null;
-
     private CacheBlock readBlock() throws IOException {
         if (null == readBuffer) {
             readBuffer = new byte[BLOCK_SIZE];
@@ -217,7 +219,7 @@ public class ByteSourceInputStream exten
         }
 
         final InputStream cis = getInputStream();
-        skipBytes(cis, blockStart);
+        BinaryFunctions.skipBytes(cis, blockStart);
 
         final byte bytes[] = new byte[blockLength];
         int total = 0;
@@ -233,8 +235,6 @@ public class ByteSourceInputStream exten
         }
     }
 
-    private long streamLength = -1;
-
     @Override
     public long getLength() throws IOException {
         if (streamLength >= 0) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java Sat Nov 23 17:19:36 2013
@@ -26,13 +26,13 @@ import org.apache.commons.imaging.common
  * A Huffman tree implemented as 1 array for high locality of reference.
  */
 class HuffmanTree {
+    private final List<Node> nodes = new ArrayList<Node>();
+    
     private final static class Node {
         boolean isEmpty = true;
         Object value = null;
     }
 
-    private final List<Node> nodes = new ArrayList<Node>();
-
     public final void insert(final String pattern, final Object value)
             throws HuffmanTreeException {
         int position = 0;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java Sat Nov 23 17:19:36 2013
@@ -27,7 +27,7 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.imaging.util.IoUtils;
 
-public class T4AndT6Compression {
+public final class T4AndT6Compression {
     private static final HuffmanTree whiteRunLengths = new HuffmanTree();
     private static final HuffmanTree blackRunLengths = new HuffmanTree();
     private static final HuffmanTree controlCodes = new HuffmanTree();
@@ -82,6 +82,9 @@ public class T4AndT6Compression {
         }
     }
 
+    private T4AndT6Compression() {
+    }
+
     private static void compress1DLine(final BitInputStreamFlexible inputStream,
             final BitArrayOutputStream outputStream, final int[] referenceLine, final int width)
             throws ImageWriteException {
@@ -178,7 +181,7 @@ public class T4AndT6Compression {
             try {
                 IoUtils.closeQuietly(canThrow, outputStream);
             } catch (final IOException ioException) {
-                // cannot happen
+                throw new ImageReadException("I/O error", ioException);
             }
         }
     }
@@ -266,7 +269,7 @@ public class T4AndT6Compression {
             try {
                 IoUtils.closeQuietly(canThrow, outputStream);
             } catch (final IOException ioException) {
-                // cannot happen
+                throw new ImageReadException("I/O error", ioException);
             }
         }
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4_T6_Tables.java Sat Nov 23 17:19:36 2013
@@ -19,26 +19,6 @@ package org.apache.commons.imaging.commo
 import org.apache.commons.imaging.common.BitArrayOutputStream;
 
 class T4_T6_Tables {
-    public static class Entry {
-        String bitString;
-        Integer value;
-
-        public Entry(final String bitString, final Integer value) {
-            this.bitString = bitString;
-            this.value = value;
-        }
-
-        public void writeBits(final BitArrayOutputStream outputStream) {
-            for (int i = 0; i < bitString.length(); i++) {
-                if (bitString.charAt(i) == '0') {
-                    outputStream.writeBit(0);
-                } else {
-                    outputStream.writeBit(1);
-                }
-            }
-        }
-    }
-
     public static final Entry[] whiteTerminatingCodes = {
             new Entry("00110101", Integer.valueOf(0)),
             new Entry("000111", Integer.valueOf(1)),
@@ -269,4 +249,24 @@ class T4_T6_Tables {
     public static final Entry VL1 = new Entry("010", Integer.valueOf(0));
     public static final Entry VL2 = new Entry("000010", Integer.valueOf(0));
     public static final Entry VL3 = new Entry("0000010", Integer.valueOf(0));
+    
+    public static class Entry {
+        String bitString;
+        Integer value;
+
+        public Entry(final String bitString, final Integer value) {
+            this.bitString = bitString;
+            this.value = value;
+        }
+
+        public void writeBits(final BitArrayOutputStream outputStream) {
+            for (int i = 0; i < bitString.length(); i++) {
+                if (bitString.charAt(i) == '0') {
+                    outputStream.writeBit(0);
+                } else {
+                    outputStream.writeBit(1);
+                }
+            }
+        }
+    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java Sat Nov 23 17:19:36 2013
@@ -25,6 +25,9 @@ public class MyBitInputStream extends In
     private final InputStream is;
     private final ByteOrder byteOrder;
     private boolean tiffLZWMode = false;
+    private long bytesRead = 0;
+    private int bitsInCache = 0;
+    private int bitCache = 0;
 
     public MyBitInputStream(final InputStream is, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
@@ -36,10 +39,6 @@ public class MyBitInputStream extends In
         return readBits(8);
     }
 
-    private long bytesRead = 0;
-    private int bitsInCache = 0;
-    private int bitCache = 0;
-
     public void setTiffLZWMode() {
         tiffLZWMode = true;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java Sat Nov 23 17:19:36 2013
@@ -24,6 +24,9 @@ import org.apache.commons.imaging.common
 public class MyBitOutputStream extends OutputStream {
     private final OutputStream os;
     private final ByteOrder byteOrder;
+    private int bitsInCache = 0;
+    private int bitCache = 0;
+    private int bytesWritten = 0;
 
     public MyBitOutputStream(final OutputStream os, final ByteOrder byteOrder) {
         this.byteOrder = byteOrder;
@@ -35,9 +38,6 @@ public class MyBitOutputStream extends O
         writeBits(value, 8);
     }
 
-    private int bitsInCache = 0;
-    private int bitCache = 0;
-
     // TODO: in and out streams CANNOT accurately read/write 32bits at a time,
     // as int will overflow. should have used a long
     public void writeBits(int value, final int SampleBits) throws IOException {
@@ -74,8 +74,6 @@ public class MyBitOutputStream extends O
 
     }
 
-    private int bytesWritten = 0;
-
     private void actualWrite(final int value) throws IOException {
         os.write(value);
         bytesWritten++;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java Sat Nov 23 17:19:36 2013
@@ -33,6 +33,7 @@ public class MyLzwCompressor {
     private final int clearCode;
     private final int eoiCode;
     private final Listener listener;
+    private final Map<ByteArray, Integer> map = new HashMap<ByteArray, Integer>();
 
     public MyLzwCompressor(final int initialCodeSize, final ByteOrder byteOrder,
             final boolean earlyLimit) {
@@ -57,8 +58,6 @@ public class MyLzwCompressor {
         InitializeStringTable();
     }
 
-    private final Map<ByteArray, Integer> map = new HashMap<ByteArray, Integer>();
-
     private final void InitializeStringTable() {
         codeSize = initialCodeSize;
 
@@ -218,14 +217,14 @@ public class MyLzwCompressor {
         return cleared;
     }
 
-    public static interface Listener {
-        public void dataCode(int code);
+    public interface Listener {
+        void dataCode(int code);
 
-        public void eoiCode(int code);
+        void eoiCode(int code);
 
-        public void clearCode(int code);
+        void clearCode(int code);
 
-        public void init(int clearCode, int eoiCode);
+        void init(int clearCode, int eoiCode);
     }
 
     public byte[] compress(final byte bytes[]) throws IOException {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java Sat Nov 23 17:19:36 2013
@@ -25,20 +25,21 @@ import org.apache.commons.imaging.common
 
 public final class MyLzwDecompressor {
     private static final int MAX_TABLE_SIZE = 1 << 12;
-
     private final byte[][] table;
     private int codeSize;
     private final int initialCodeSize;
     private int codes = -1;
-
     private final ByteOrder byteOrder;
-
     private final Listener listener;
+    private final int clearCode;
+    private final int eoiCode;
+    private int written = 0;
+    private boolean tiffLZWMode = false;
 
-    public static interface Listener {
-        public void code(int code);
+    public interface Listener {
+        void code(int code);
 
-        public void init(int clearCode, int eoiCode);
+        void init(int clearCode, int eoiCode);
     }
 
     public MyLzwDecompressor(final int initialCodeSize, final ByteOrder byteOrder) {
@@ -79,9 +80,6 @@ public final class MyLzwDecompressor {
         incrementCodeSize();
     }
 
-    private final int clearCode;
-    private final int eoiCode;
-
     private int getNextCode(final MyBitInputStream is) throws IOException {
         final int code = is.readBits(codeSize);
 
@@ -126,16 +124,12 @@ public final class MyLzwDecompressor {
         return result;
     }
 
-    private int written = 0;
-
     private void writeToResult(final OutputStream os, final byte bytes[])
             throws IOException {
         os.write(bytes);
         written += bytes.length;
     }
 
-    private boolean tiffLZWMode = false;
-
     public void setTiffLZWMode() {
         tiffLZWMode = true;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java Sat Nov 23 17:19:36 2013
@@ -55,6 +55,15 @@ import org.apache.commons.imaging.util.I
 import org.apache.commons.imaging.util.ParamMap;
 
 public class BmpImageParser extends ImageParser {
+    private static final String DEFAULT_EXTENSION = ".bmp";
+    private static final String ACCEPTED_EXTENSIONS[] = { DEFAULT_EXTENSION, };
+    private static final byte BMP_HEADER_SIGNATURE[] = { 0x42, 0x4d, };
+    private static final int BI_RGB = 0;
+    private static final int BI_RLE4 = 2;
+    private static final int BI_RLE8 = 1;
+    private static final int BI_BITFIELDS = 3;
+    private static final int BITMAP_FILE_HEADER_SIZE = 14;
+    private static final int BITMAP_INFO_HEADER_SIZE = 40;
 
     public BmpImageParser() {
         super.setByteOrder(ByteOrder.INTEL);
@@ -70,10 +79,6 @@ public class BmpImageParser extends Imag
         return DEFAULT_EXTENSION;
     }
 
-    private static final String DEFAULT_EXTENSION = ".bmp";
-
-    private static final String ACCEPTED_EXTENSIONS[] = { DEFAULT_EXTENSION, };
-
     @Override
     protected String[] getAcceptedExtensions() {
         return ACCEPTED_EXTENSIONS;
@@ -85,8 +90,6 @@ public class BmpImageParser extends Imag
         };
     }
 
-    private static final byte BMP_HEADER_SIGNATURE[] = { 0x42, 0x4d, };
-
     private BmpHeaderInfo readBmpHeaderInfo(final InputStream is,
             final FormatCompliance formatCompliance, final boolean verbose)
             throws ImageReadException, IOException {
@@ -258,11 +261,6 @@ public class BmpImageParser extends Imag
         return result;
     }
 
-    private static final int BI_RGB = 0;
-    private static final int BI_RLE4 = 2;
-    private static final int BI_RLE8 = 1;
-    private static final int BI_BITFIELDS = 3;
-
     private byte[] getRLEBytes(final InputStream is, final int RLESamplesPerByte)
             throws IOException {
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -414,7 +412,7 @@ public class BmpImageParser extends Imag
         if (verbose) {
             debugNumber("paletteLength", paletteLength, 4);
             System.out.println("ColorTable: "
-                    + ((colorTable == null) ? "null" : "" + colorTable.length));
+                    + ((colorTable == null) ? "null" : Integer.toString(colorTable.length)));
         }
 
         final int pixelCount = bhi.width * bhi.height;
@@ -533,7 +531,7 @@ public class BmpImageParser extends Imag
             params.remove(PARAM_KEY_VERBOSE);
         }
 
-        if (params.size() > 0) {
+        if (!params.isEmpty()) {
             final Object firstKey = params.keySet().iterator().next();
             throw new ImageReadException("Unknown parameter: " + firstKey);
         }
@@ -599,7 +597,7 @@ public class BmpImageParser extends Imag
             params.remove(PARAM_KEY_VERBOSE);
         }
 
-        if (params.size() > 0) {
+        if (!params.isEmpty()) {
             final Object firstKey = params.keySet().iterator().next();
             throw new ImageReadException("Unknown parameter: " + firstKey);
         }
@@ -733,7 +731,7 @@ public class BmpImageParser extends Imag
             params.remove(BUFFERED_IMAGE_FACTORY);
         }
 
-        if (params.size() > 0) {
+        if (!params.isEmpty()) {
             final Object firstKey = params.keySet().iterator().next();
             throw new ImageReadException("Unknown parameter: " + firstKey);
         }
@@ -766,9 +764,6 @@ public class BmpImageParser extends Imag
 
     }
 
-    private static final int BITMAP_FILE_HEADER_SIZE = 14;
-    private static final int BITMAP_INFO_HEADER_SIZE = 40;
-
     @Override
     public void writeImage(final BufferedImage src, final OutputStream os, Map<String,Object> params)
             throws ImageWriteException, IOException {
@@ -785,7 +780,7 @@ public class BmpImageParser extends Imag
             pixelDensity = (PixelDensity) params
                     .remove(PARAM_KEY_PIXEL_DENSITY);
         }
-        if (params.size() > 0) {
+        if (!params.isEmpty()) {
             final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java Sat Nov 23 17:19:36 2013
@@ -33,6 +33,8 @@ public class PixelParserBitFields extend
     private final int blueMask;
     private final int alphaMask;
 
+    private int bytecount = 0;
+    
     public PixelParserBitFields(final BmpHeaderInfo bhi, final byte ColorTable[],
             final byte ImageData[]) {
         super(bhi, ColorTable, ImageData);
@@ -66,8 +68,6 @@ public class PixelParserBitFields extend
         return (trailingZeroes - (8 - maskLength));
     }
 
-    private int bytecount = 0;
-
     @Override
     public int getNextRGB() throws ImageReadException, IOException {
         int data;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRgb.java Sat Nov 23 17:19:36 2013
@@ -22,18 +22,17 @@ import org.apache.commons.imaging.ImageR
 import org.apache.commons.imaging.formats.bmp.BmpHeaderInfo;
 
 public class PixelParserRgb extends PixelParserSimple {
+    private int bytecount = 0;
+    private int cached_bit_count = 0;
+    private int cached_byte = 0;
+    int pixelCount = 0;
+
     public PixelParserRgb(final BmpHeaderInfo bhi, final byte ColorTable[],
             final byte ImageData[]) {
         super(bhi, ColorTable, ImageData);
 
     }
 
-    private int bytecount = 0;
-    private int cached_bit_count = 0;
-    private int cached_byte = 0;
-
-    int pixelCount = 0;
-
     @Override
     public int getNextRGB() throws ImageReadException, IOException {
         pixelCount++;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/writers/BmpWriterRgb.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/writers/BmpWriterRgb.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/writers/BmpWriterRgb.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/writers/BmpWriterRgb.java Sat Nov 23 17:19:36 2013
@@ -43,6 +43,7 @@ public class BmpWriterRgb extends BmpWri
 
     @Override
     public void writePalette(final BinaryOutputStream bos) throws IOException {
+        // no palette
     }
 
     @Override



Mime
View raw message