commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1544910 - in /commons/proper/imaging/trunk: ./ src/main/java/org/apache/commons/imaging/common/ src/main/java/org/apache/commons/imaging/formats/gif/ src/main/java/org/apache/commons/imaging/formats/jpeg/ src/main/java/org/apache/commons/i...
Date Sun, 24 Nov 2013 04:46:23 GMT
Author: damjan
Date: Sun Nov 24 04:46:21 2013
New Revision: 1544910

URL: http://svn.apache.org/r1544910
Log:
Fix more PMD warnings.


Modified:
    commons/proper/imaging/trunk/pmd-ruleset.xml
    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/formats/gif/GifImageParser.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/segments/ComSegment.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/PngImageParser.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/ScanExpediter.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/scanlinefilters/ScanlineFilterUp.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.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/PpmFileInfo.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/psd/dataparsers/DataParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.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/TiffField.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.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/fieldtypes/FieldTypeAscii.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.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/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/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/IccProfileParser.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/Palette.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/palette/QuantizedPalette.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java

Modified: commons/proper/imaging/trunk/pmd-ruleset.xml
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/pmd-ruleset.xml?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/pmd-ruleset.xml (original)
+++ commons/proper/imaging/trunk/pmd-ruleset.xml Sun Nov 24 04:46:21 2013
@@ -49,12 +49,15 @@
     <exclude name="ConfusingTernary"/>
     <exclude name="EmptyMethodInAbstractClassShouldBeAbstract"/>
     <exclude name="GodClass"/>
+    <!-- PMD seems to want only break, not return -->
+    <exclude name="MissingBreakInSwitch"/>
     <exclude name="ReturnEmptyArrayRatherThanNull"/>
+    <exclude name="SimplifyBooleanReturns"/>
     <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)) -->
+    <!-- empty if statements are useful to skip actions taken by the else (if(s)) -->
     <exclude name="EmptyIfStmt"/>
   </rule>
   <rule ref="rulesets/java/finalizers.xml"/>

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=1544910&r1=1544909&r2=1544910&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 Sun Nov 24 04:46:21 2013
@@ -85,11 +85,12 @@ public class ImageMetadata implements II
         }
 
         public String toString(final String prefix) {
-            String result = keyword + ": " + text;
+            final String result = keyword + ": " + text;
             if (null != prefix) {
-                result = prefix + result;
+                return prefix + result;
+            } else {
+                return result;
             }
-            return result;
         }
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java Sun Nov 24 04:46:21 2013
@@ -295,9 +295,9 @@ public class GifImageParser extends Imag
                     }
 
                     // if (label == new String("ICCRGBG1"))
-                    {
+                    //{
                         // GIF's can have embedded ICC Profiles - who knew?
-                    }
+                    //}
 
                     if ((label != null) && (label.length > 0)) {
                         final GenericGifBlock block = readGenericGIFBlock(is,
@@ -384,8 +384,7 @@ public class GifImageParser extends Imag
 
         byte LocalColorTable[] = null;
         if (LocalColorTableFlag) {
-            LocalColorTable = readColorTable(is, SizeofLocalColorTable,
-                    formatCompliance);
+            LocalColorTable = readColorTable(is, SizeofLocalColorTable);
         }
 
         byte imageData[] = null;
@@ -431,8 +430,7 @@ public class GifImageParser extends Imag
         return 3 * simple_pow(2, ct_size + 1);
     }
 
-    private byte[] readColorTable(final InputStream is, final int ct_size,
-            final FormatCompliance formatCompliance) throws IOException {
+    private byte[] readColorTable(final InputStream is, final int ct_size) throws IOException {
         final int actual_size = convertColorTableSize(ct_size);
 
         final byte bytes[] = readBytes("block", is, actual_size,
@@ -470,7 +468,7 @@ public class GifImageParser extends Imag
             byte globalColorTable[] = null;
             if (ghi.globalColorTableFlag) {
                 globalColorTable = readColorTable(is,
-                        ghi.sizeOfGlobalColorTable, formatCompliance);
+                        ghi.sizeOfGlobalColorTable);
             }
 
             final List<GifBlock> blocks = readBlocks(ghi, is, stopBeforeImageData,
@@ -891,9 +889,10 @@ public class GifImageParser extends Imag
             bos.write(PixelAspectRatio);
         }
 
-        { // write Global Color Table.
+        //{
+            // write Global Color Table.
 
-        }
+        //}
 
         { // ALWAYS write GraphicControlExtension
             bos.write(EXTENSION_CODE);
@@ -1054,7 +1053,7 @@ public class GifImageParser extends Imag
             final GifHeaderInfo ghi = readHeader(is, formatCompliance);
 
             if (ghi.globalColorTableFlag) {
-                readColorTable(is, ghi.sizeOfGlobalColorTable, formatCompliance);
+                readColorTable(is, ghi.sizeOfGlobalColorTable);
             }
 
             final List<GifBlock> blocks = readBlocks(ghi, is, true, formatCompliance);
@@ -1105,7 +1104,7 @@ public class GifImageParser extends Imag
                             "utf-8");
                     result.add(xml);
                 } catch (final UnsupportedEncodingException e) {
-                    throw new ImageReadException("Invalid XMP Block in GIF.");
+                    throw new ImageReadException("Invalid XMP Block in GIF.", e);
                 }
             }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java Sun Nov 24 04:46:21 2013
@@ -149,10 +149,8 @@ public class JpegImageMetadata implement
                 try {
                     image = Imaging.getBufferedImage(jpegImageData.data);
                     imageSucceeded = true;
-                } catch (final ImagingException imagingException) {
-                    // NOPMD
-                } catch (final IOException ioException) {
-                    // NOPMD
+                } catch (final ImagingException imagingException) { // NOPMD
+                } catch (final IOException ioException) { // NOPMD
                 } finally {
                     // our JPEG reading is still a bit buggy -
                     // fall back to ImageIO on error

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java Sun Nov 24 04:46:21 2013
@@ -43,8 +43,7 @@ public class ComSegment extends GenericS
         String commentString = "";
         try {
             commentString = new String(segmentData, "UTF-8");
-        } catch (final UnsupportedEncodingException cannotHappen) {
-            // NOPMD
+        } catch (final UnsupportedEncodingException cannotHappen) { // NOPMD
         }
         return "COM (" + commentString + ")";
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java Sun Nov 24 04:46:21 2013
@@ -166,7 +166,7 @@ public class PcxWriter {
                 }
             }
             if (onlyBlackAndWhite) {
-                writeBlackAndWhitePCX(src, palette, bos);
+                writeBlackAndWhitePCX(src, bos);
             } else {
                 write16ColorPCX(src, palette, bos);
             }
@@ -253,7 +253,7 @@ public class PcxWriter {
     }
 
     private void writeBlackAndWhitePCX(final BufferedImage src,
-            final SimplePalette palette, final BinaryOutputStream bos)
+            final BinaryOutputStream bos)
             throws ImageWriteException, IOException {
         int bytesPerLine = (src.getWidth() + 7) / 8;
         if (bytesPerLine % 2 != 0) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java Sun Nov 24 04:46:21 2013
@@ -67,10 +67,6 @@ public class PngImageParser extends Imag
     private static final String DEFAULT_EXTENSION = ".png";
     private static final String ACCEPTED_EXTENSIONS[] = { DEFAULT_EXTENSION, };
 
-    public PngImageParser() {
-        // setDebug(true);
-    }
-
     @Override
     public String getName() {
         return "Png-Custom";

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java Sun Nov 24 04:46:21 2013
@@ -312,7 +312,7 @@ public class PngWriter {
         byte result = 8;
 
         final Object o = params.get(PngConstants.PARAM_KEY_PNG_BIT_DEPTH);
-        if (o != null && o instanceof Number) {
+        if (o instanceof Number) {
             final int value = ((Number) o).intValue();
             switch (value) {
             case 1:
@@ -511,12 +511,12 @@ public class PngWriter {
             writeChunkIHDR(os, imageHeader);
         }
 
-        {
+        //{
             // sRGB No Before PLTE and IDAT. If the sRGB chunk is present, the
             // iCCP chunk should not be present.
 
             // charles
-        }
+        //}
 
         Palette palette = null;
         if (colorType == PngConstants.COLOR_TYPE_INDEXED_COLOR) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java Sun Nov 24 04:46:21 2013
@@ -63,12 +63,8 @@ public abstract class ScanExpediter exte
         this.transparencyFilter = transparencyFilter;
     }
 
-    protected int getBitsToBytesRoundingUp(final int bits) {
-        int bytes = bits / 8;
-        if ((bits % 8 > 0)) {
-            bytes++;
-        }
-        return bytes;
+    protected final int getBitsToBytesRoundingUp(final int bits) {
+        return (bits + 7) / 8;
     }
 
     protected final int getPixelARGB(final int alpha, final int red, final int green, final int blue) {
@@ -192,7 +188,7 @@ public abstract class ScanExpediter exte
             break;
 
         case 2: // Up
-            filter = new ScanlineFilterUp(BytesPerPixel);
+            filter = new ScanlineFilterUp();
             break;
 
         case 3: // Average

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java Sun Nov 24 04:46:21 2013
@@ -43,20 +43,10 @@ public class ScanExpediterInterlaced ext
     }
 
     private void visit(final int x, final int y, final BufferedImage bi, final BitParser fBitParser,
-            final int color_type, final int pixel_index_in_scanline,
-            final PngChunkPlte fPNGChunkPLTE, final GammaCorrection fGammaCorrection)
+            final int pixel_index_in_scanline)
             throws ImageReadException, IOException {
-        final int rgb = getRGB(fBitParser,
-        // color_type,
-                pixel_index_in_scanline
-        // ,
-        // fPNGChunkPLTE, fGammaCorrection
-        );
-
+        final int rgb = getRGB(fBitParser, pixel_index_in_scanline);
         bi.setRGB(x, y, rgb);
-
-        // buffer.setElem(y * width +x , rgb);
-
     }
 
     @Override
@@ -88,9 +78,7 @@ public class ScanExpediterInterlaced ext
                             bitsPerPixel, bitDepth);
 
                     while (x < width) {
-                        visit(x, y, bi, fBitParser, colorType,
-                                pixel_index_in_scanline, pngChunkPLTE,
-                                gammaCorrection);
+                        visit(x, y, bi, fBitParser, pixel_index_in_scanline);
 
                         x = x + Col_Increment[pass - 1];
                         pixel_index_in_scanline++;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterUp.java Sun Nov 24 04:46:21 2013
@@ -21,10 +21,6 @@ import java.io.IOException;
 import org.apache.commons.imaging.ImageReadException;
 
 public class ScanlineFilterUp extends ScanlineFilter {
-
-    public ScanlineFilterUp(final int BytesPerPixel) {
-    }
-
     @Override
     public void unfilter(final byte src[], final byte dst[], final byte up[])
             throws ImageReadException, IOException {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java Sun Nov 24 04:46:21 2013
@@ -22,20 +22,17 @@ import java.io.IOException;
 import org.apache.commons.imaging.ImageReadException;
 
 public class TransparencyFilterTrueColor extends TransparencyFilter {
-    private final int transparent_red;
-    private final int transparent_green;
-    private final int transparent_blue;
     private final int transparent_color;
 
     public TransparencyFilterTrueColor(final byte bytes[]) throws IOException {
         super(bytes);
 
         final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
-        transparent_red = read2Bytes("transparent_red", is,
+        final int transparent_red = read2Bytes("transparent_red", is,
                 "tRNS: Missing transparent_color");
-        transparent_green = read2Bytes("transparent_green", is,
+        final int transparent_green = read2Bytes("transparent_green", is,
                 "tRNS: Missing transparent_color");
-        transparent_blue = read2Bytes("transparent_blue", is,
+        final int transparent_blue = read2Bytes("transparent_blue", is,
                 "tRNS: Missing transparent_color");
 
         transparent_color = ((0xff & transparent_red) << 16)

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java Sun Nov 24 04:46:21 2013
@@ -116,8 +116,4 @@ public abstract class FileInfo {
         // dump();
         // }
     }
-
-    public void dump() {
-
-    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java Sun Nov 24 04:46:21 2013
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.imaging.formats.pnm;
 
-public class PnmConstants {
+public final class PnmConstants {
     public static final byte PNM_PREFIX_BYTE = 0x50; // P
 
     public static final byte PBM_TEXT_CODE = 0x31; // Textual Bitmap
@@ -30,4 +30,7 @@ public class PnmConstants {
     public static final byte PNM_SEPARATOR = 0x20; // Space
     public static final byte PNM_NEWLINE = 0x0A; // "usually a newline"
                                                  // (http://netpbm.sourceforge.net/doc/pbm.html)
+    
+    private PnmConstants() {
+    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java Sun Nov 24 04:46:21 2013
@@ -130,7 +130,7 @@ public class PnmImageParser extends Imag
             boolean seenDepth = false;
             int maxVal = -1;
             boolean seenMaxVal = false;
-            String tupleType = "";
+            final StringBuilder tupleType = new StringBuilder();
             boolean seenTupleType = false;
             
             // Advance to next line
@@ -157,7 +157,7 @@ public class PnmImageParser extends Imag
                     maxVal = Integer.parseInt(tokenizer.nextToken());
                 } else if ("TUPLTYPE".equals(type)) {
                     seenTupleType = true;
-                    tupleType += tokenizer.nextToken();
+                    tupleType.append(tokenizer.nextToken());
                 } else if ("ENDHDR".equals(type)) {
                     break;
                 } else {
@@ -177,7 +177,7 @@ public class PnmImageParser extends Imag
                 throw new ImageReadException("PAM header has no TUPLTYPE");
             }
             
-            return new PamFileInfo(width, height, depth, maxVal, tupleType);
+            return new PamFileInfo(width, height, depth, maxVal, tupleType.toString());
         } else {
             throw new ImageReadException("PNM file has invalid prefix byte 2");
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java Sun Nov 24 04:46:21 2013
@@ -115,9 +115,4 @@ public class PpmFileInfo extends FileInf
 
         return rgb;
     }
-
-    @Override
-    public void dump() {
-        // System.out.println("count: " + count);
-    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java Sun Nov 24 04:46:21 2013
@@ -723,7 +723,6 @@ public class PsdImageParser extends Imag
             is = getInputStream(byteSource, PSD_SECTION_IMAGE_DATA);
             fDataReader.readData(is, result, imageContents, this);
 
-            fDataReader.dump();
             canThrow = true;
             // is.
             // ImageContents imageContents = readImageContents(is);
@@ -797,7 +796,7 @@ public class PsdImageParser extends Imag
             final String xml = new String(block.data, 0, block.data.length, "utf-8");
             return xml;
         } catch (final UnsupportedEncodingException e) {
-            throw new ImageReadException("Invalid JPEG XMP Segment.");
+            throw new ImageReadException("Invalid JPEG XMP Segment.", e);
         }
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java Sun Nov 24 04:46:21 2013
@@ -43,9 +43,4 @@ public abstract class DataParser {
             ImageContents imageContents);
 
     public abstract int getBasicChannelsCount();
-
-    public void dump() {
-
-    }
-
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java Sun Nov 24 04:46:21 2013
@@ -21,10 +21,6 @@ import org.apache.commons.imaging.format
 
 public class DataParserLab extends DataParser {
 
-    public DataParserLab() {
-
-    }
-
     @Override
     protected int getRGB(final int data[][][], final int x, final int y,
             final ImageContents imageContents) {
@@ -44,13 +40,4 @@ public class DataParserLab extends DataP
     public int getBasicChannelsCount() {
         return 3;
     }
-
-    @Override
-    public void dump() {
-        // for(int i=0;i<3;i++)
-        // {
-        // System.out.println("CIE: " + i + ": min: " + mins[i] + ", max: " +
-        // maxs[i]);
-        // }
-    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java Sun Nov 24 04:46:21 2013
@@ -35,8 +35,4 @@ public abstract class DataReader {
     public abstract void readData(InputStream is, BufferedImage bi,
             ImageContents imageContents, BinaryFileParser bfp)
             throws ImageReadException, IOException;
-
-    public void dump() {
-        dataParser.dump();
-    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java Sun Nov 24 04:46:21 2013
@@ -109,7 +109,7 @@ class RgbeInfo implements Closeable {
         String info = reader.readNextLine();
 
         while (info.length() != 0) {
-            final int equals = info.indexOf("=");
+            final int equals = info.indexOf('=');
 
             if (equals > 0) {
                 final String variable = info.substring(0, equals);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java Sun Nov 24 04:46:21 2013
@@ -81,19 +81,13 @@ public class TiffDirectory extends TiffE
         for (int i = 0; i < entries.size(); i++) {
             final TiffField entry = entries.get(i);
 
-            result.append("\t");
-            result.append("[" + entryOffset + "]: ");
-            result.append(entry.getTagInfo().name);
-            result.append(" (" + entry.getTag() + ", 0x"
-                    + Integer.toHexString(entry.getTag()) + ")");
-            result.append(", " + entry.getFieldType().getName());
-            result.append(", " + entry.getBytesLength());
-            result.append(": " + entry.getValueDescription());
-
-            result.append("\n");
+            result.append(String.format("\t[%d]: %s (%d, 0x%x), %s, %d: %s%n",
+                    entryOffset, entry.getTagInfo().name,
+                    entry.getTag(), entry.getTag(),
+                    entry.getFieldType().getName(), entry.getBytesLength(),
+                    entry.getValueDescription()));
 
             entryOffset += TiffConstants.TIFF_ENTRY_LENGTH;
-            // entry.fillInValue(byteSource);
         }
         return result.toString();
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffField.java Sun Nov 24 04:46:21 2013
@@ -53,7 +53,7 @@ public class TiffField {
     private final int sortHint;
     public static final String Attribute_Tag = "Tag";
     private static final Map<Object, List<TagInfo>> ALL_TAG_MAP = makeTagMap(
-            AllTagConstants.ALL_TAGS, true, "All");
+            AllTagConstants.ALL_TAGS);
 
     public TiffField(final int tag, final int directoryType, final FieldType fieldType,
             final long count, final long offset, final byte[] value,
@@ -172,8 +172,7 @@ public class TiffField {
         return new OversizeValueElement(getOffset(), value.length);
     }
 
-    private static TagInfo getTag(final int directoryType, final int tag,
-            final List<TagInfo> possibleMatches) {
+    private static TagInfo getTag(final int directoryType, final List<TagInfo> possibleMatches) {
         // Please keep this method in sync with TiffImageMetadata's findField()
 
         if (possibleMatches.size() < 1) {
@@ -309,7 +308,7 @@ public class TiffField {
             return TiffTagConstants.TIFF_TAG_UNKNOWN;
         }
 
-        final TagInfo result = getTag(directoryType, tag, possibleMatches);
+        final TagInfo result = getTag(directoryType, possibleMatches);
         return result;
     }
 
@@ -569,7 +568,7 @@ public class TiffField {
     }
 
     private static final Map<Object, List<TagInfo>> makeTagMap(
-            final List<TagInfo> tags, final boolean ignoreDuplicates, final String name) {
+            final List<TagInfo> tags) {
         // make sure to use the thread-safe version; this is shared state.
         final Map<Object, List<TagInfo>> map = new Hashtable<Object, List<TagInfo>>();
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageData.java Sun Nov 24 04:46:21 2013
@@ -170,8 +170,8 @@ public abstract class TiffImageData {
             try {
                 return byteSourceFile.getBlock(offset, length);
             } catch (final IOException ioex) {
+                return new byte[0];
             }
-            return new byte[0];
         }
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageMetadata.java Sun Nov 24 04:46:21 2013
@@ -551,9 +551,8 @@ public class TiffImageMetadata extends I
             // latitude: 8 degrees, 40 minutes, 42.2 seconds S
             // longitude: 115 degrees, 26 minutes, 21.8 seconds E
 
-            final StringBuilder result = new StringBuilder();
-            result.append("[GPS. ");
-            result.append("Latitude: " + latitudeDegrees.toDisplayString()
+            final StringBuilder result = new StringBuilder(88);
+            result.append("[GPS. Latitude: " + latitudeDegrees.toDisplayString()
                     + " degrees, " + latitudeMinutes.toDisplayString()
                     + " minutes, " + latitudeSeconds.toDisplayString()
                     + " seconds " + latitudeRef);
@@ -561,7 +560,7 @@ public class TiffImageMetadata extends I
                     + " degrees, " + longitudeMinutes.toDisplayString()
                     + " minutes, " + longitudeSeconds.toDisplayString()
                     + " seconds " + longitudeRef);
-            result.append("]");
+            result.append(']');
 
             return result.toString();
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java Sun Nov 24 04:46:21 2013
@@ -58,10 +58,6 @@ public class TiffImageParser extends Ima
     private static final String DEFAULT_EXTENSION = ".tif";
     private static final String ACCEPTED_EXTENSIONS[] = { ".tif", ".tiff", };
 
-    public TiffImageParser() {
-        // setDebug(true);
-    }
-
     @Override
     public String getName() {
         return "Tiff-Custom";
@@ -337,7 +333,7 @@ public class TiffImageParser extends Ima
             final String xml = new String(bytes, "utf-8");
             return xml;
         } catch (final UnsupportedEncodingException e) {
-            throw new ImageReadException("Invalid JPEG XMP Segment.");
+            throw new ImageReadException("Invalid JPEG XMP Segment.", e);
         }
     }
 
@@ -543,7 +539,7 @@ public class TiffImageParser extends Ima
             return null;
         }
 
-        final StringBuilder sb = new StringBuilder();
+        final StringBuilder sb = new StringBuilder(32);
         if (ix0 == null) {
             sb.append(" x0,");
         }
@@ -680,7 +676,6 @@ public class TiffImageParser extends Ima
             dataReader.readImageData(imageBuilder);
             result =  imageBuilder.getBufferedImage();
         }
-        photometricInterpreter.dumpstats();
         return result;     
     }
 
@@ -694,9 +689,8 @@ public class TiffImageParser extends Ima
         case 1:
             final boolean invert = photometricInterpretation == 0;
 
-            return new PhotometricInterpreterBiLevel(bitsPerPixel,
-                    samplesPerPixel, bitsPerSample, predictor, width, height,
-                    invert);
+            return new PhotometricInterpreterBiLevel(samplesPerPixel,
+                    bitsPerSample, predictor, width, height, invert);
         case 3: // Palette
         {
             final int colorMap[] = directory.findField(
@@ -722,24 +716,24 @@ public class TiffImageParser extends Ima
                     bitsPerSample, predictor, width, height);
         case 6: //
         {
-            final double yCbCrCoefficients[] = directory.findField(
-                    TiffTagConstants.TIFF_TAG_YCBCR_COEFFICIENTS, true)
-                    .getDoubleArrayValue();
-
-            final int yCbCrPositioning[] = directory.findField(
-                    TiffTagConstants.TIFF_TAG_YCBCR_POSITIONING, true)
-                    .getIntArrayValue();
-            final int yCbCrSubSampling[] = directory.findField(
-                    TiffTagConstants.TIFF_TAG_YCBCR_SUB_SAMPLING, true)
-                    .getIntArrayValue();
-
-            final double referenceBlackWhite[] = directory.findField(
-                    TiffTagConstants.TIFF_TAG_REFERENCE_BLACK_WHITE, true)
-                    .getDoubleArrayValue();
-
-            return new PhotometricInterpreterYCbCr(yCbCrCoefficients,
-                    yCbCrPositioning, yCbCrSubSampling, referenceBlackWhite,
-                    samplesPerPixel, bitsPerSample, predictor, width, height);
+//            final double yCbCrCoefficients[] = directory.findField(
+//                    TiffTagConstants.TIFF_TAG_YCBCR_COEFFICIENTS, true)
+//                    .getDoubleArrayValue();
+//
+//            final int yCbCrPositioning[] = directory.findField(
+//                    TiffTagConstants.TIFF_TAG_YCBCR_POSITIONING, true)
+//                    .getIntArrayValue();
+//            final int yCbCrSubSampling[] = directory.findField(
+//                    TiffTagConstants.TIFF_TAG_YCBCR_SUB_SAMPLING, true)
+//                    .getIntArrayValue();
+//
+//            final double referenceBlackWhite[] = directory.findField(
+//                    TiffTagConstants.TIFF_TAG_REFERENCE_BLACK_WHITE, true)
+//                    .getDoubleArrayValue();
+
+            return new PhotometricInterpreterYCbCr(samplesPerPixel,
+                    bitsPerSample, predictor, width,
+                    height);
         }
 
         case 8:
@@ -748,9 +742,9 @@ public class TiffImageParser extends Ima
 
         case 32844:
         case 32845: {
-            final boolean yonly = (photometricInterpretation == 32844);
+//            final boolean yonly = (photometricInterpretation == 32844);
             return new PhotometricInterpreterLogLuv(samplesPerPixel,
-                    bitsPerSample, predictor, width, height, yonly);
+                    bitsPerSample, predictor, width, height);
         }
 
         default:

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java Sun Nov 24 04:46:21 2013
@@ -45,14 +45,13 @@ public class TiffReader extends BinaryFi
         this.strict = strict;
     }
 
-    private TiffHeader readTiffHeader(final ByteSource byteSource,
-            final FormatCompliance formatCompliance) throws ImageReadException,
+    private TiffHeader readTiffHeader(final ByteSource byteSource) throws ImageReadException,
             IOException {
         InputStream is = null;
         boolean canThrow = false;
         try {
             is = byteSource.getInputStream();
-            final TiffHeader ret = readTiffHeader(is, formatCompliance);
+            final TiffHeader ret = readTiffHeader(is);
             canThrow = true;
             return ret;
         } finally {
@@ -70,8 +69,7 @@ public class TiffReader extends BinaryFi
         }
     }
 
-    private TiffHeader readTiffHeader(final InputStream is,
-            final FormatCompliance formatCompliance) throws ImageReadException,
+    private TiffHeader readTiffHeader(final InputStream is) throws ImageReadException,
             IOException {
         final int BYTE_ORDER_1 = readByte("BYTE_ORDER_1", is, "Not a Valid TIFF File");
         final int BYTE_ORDER_2 = readByte("BYTE_ORDER_2", is, "Not a Valid TIFF File");
@@ -103,7 +101,7 @@ public class TiffReader extends BinaryFi
     private void readDirectories(final ByteSource byteSource,
             final FormatCompliance formatCompliance, final Listener listener)
             throws ImageReadException, IOException {
-        final TiffHeader tiffHeader = readTiffHeader(byteSource, formatCompliance);
+        final TiffHeader tiffHeader = readTiffHeader(byteSource);
         if (!listener.setTiffHeader(tiffHeader)) {
             return;
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeAscii.java Sun Nov 24 04:46:21 2013
@@ -51,7 +51,7 @@ public class FieldTypeAscii extends Fiel
                     final String string = new String(bytes, nextStringPos, i
                             - nextStringPos, "UTF-8");
                     strings[stringsAdded++] = string;
-                } catch (final UnsupportedEncodingException unsupportedEncoding) {
+                } catch (final UnsupportedEncodingException unsupportedEncoding) { // NOPMD
                 }
                 nextStringPos = i + 1;
             }
@@ -62,7 +62,7 @@ public class FieldTypeAscii extends Fiel
                 final String string = new String(bytes, nextStringPos, bytes.length
                         - nextStringPos, "UTF-8");
                 strings[stringsAdded++] = string;
-            } catch (final UnsupportedEncodingException unsupportedEncoding) {
+            } catch (final UnsupportedEncodingException unsupportedEncoding) { // NOPMD
             }
         }
         if (strings.length == 1) {
@@ -84,7 +84,7 @@ public class FieldTypeAscii extends Fiel
             try {
                 bytes = ((String) o).getBytes("UTF-8");
             } catch (final UnsupportedEncodingException cannotHappen) {
-                throw new IllegalArgumentException("Your Java doesn't support UTF-8");
+                throw new IllegalArgumentException("Your Java doesn't support UTF-8", cannotHappen);
             }
             final byte result[] = new byte[bytes.length + 1];
             System.arraycopy(bytes, 0, result, 0, bytes.length);
@@ -98,7 +98,7 @@ public class FieldTypeAscii extends Fiel
                 try {
                     bytes = string.getBytes("UTF-8");
                 } catch (final UnsupportedEncodingException cannotHappen) {
-                    throw new IllegalArgumentException("Your Java doesn't support UTF-8");
+                    throw new IllegalArgumentException("Your Java doesn't support UTF-8", cannotHappen);
                 }
                 totalLength += (bytes.length + 1);
             }
@@ -109,7 +109,7 @@ public class FieldTypeAscii extends Fiel
                 try {
                     bytes = string.getBytes("UTF-8");
                 } catch (final UnsupportedEncodingException cannotHappen) {
-                    throw new IllegalArgumentException("Your Java doesn't support UTF-8");
+                    throw new IllegalArgumentException("Your Java doesn't support UTF-8", cannotHappen);
                 }
                 System.arraycopy(bytes, 0, result, position, bytes.length);
                 position += (bytes.length + 1);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java Sun Nov 24 04:46:21 2013
@@ -39,15 +39,4 @@ public abstract class PhotometricInterpr
 
     public abstract void interpretPixel(ImageBuilder imageBuilder,
             int samples[], int x, int y) throws ImageReadException, IOException;
-
-    /**
-     * @throws ImageReadException
-     *             may be thrown by sub-classes
-     * @throws IOException
-     *             may be thrown by sub-classes
-     */
-    public void dumpstats() throws ImageReadException, IOException {
-
-    }
-
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java Sun Nov 24 04:46:21 2013
@@ -26,10 +26,10 @@ public class PhotometricInterpreterBiLev
 
     // private final int bitsPerPixel;
 
-    public PhotometricInterpreterBiLevel(final int fBitsPerPixel,
-            final int fSamplesPerPixel, final int fBitsPerSample[], final int Predictor,
-            final int width, final int height, final boolean invert) {
-        super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
+    public PhotometricInterpreterBiLevel(final int fSamplesPerPixel,
+            final int fBitsPerSample[], final int predictor, final int width,
+            final int height, final boolean invert) {
+        super(fSamplesPerPixel, fBitsPerSample, predictor, width, height);
 
         this.invert = invert;
         // this.bitsPerPixel = fBitsPerPixel;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java Sun Nov 24 04:46:21 2013
@@ -29,10 +29,6 @@ public class PhotometricInterpreterCieLa
     }
 
     @Override
-    public void dumpstats() throws ImageReadException, IOException {
-    }
-
-    @Override
     public void interpretPixel(final ImageBuilder imageBuilder, final int samples[], final int x,
             final int y) throws ImageReadException, IOException {
         final int cieL = samples[0];

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java Sun Nov 24 04:46:21 2013
@@ -25,17 +25,12 @@ public class PhotometricInterpreterLogLu
     // private final boolean yOnly;
 
     public PhotometricInterpreterLogLuv(final int fSamplesPerPixel,
-            final int fBitsPerSample[], final int Predictor, final int width, final int height,
-            final boolean yonly) {
-        super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
+            final int fBitsPerSample[], final int predictor, final int width, final int height) {
+        super(fSamplesPerPixel, fBitsPerSample, predictor, width, height);
 
         // this.yOnly = yonly;
     }
 
-    @Override
-    public void dumpstats() throws ImageReadException, IOException {
-    }
-
     private float cube(final float f) {
         return f * f * f;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java Sun Nov 24 04:46:21 2013
@@ -23,14 +23,13 @@ import org.apache.commons.imaging.common
 
 public class PhotometricInterpreterYCbCr extends PhotometricInterpreter {
 
-    public PhotometricInterpreterYCbCr(final double[] fYCbCrCoefficients,
-            final int[] fYCbCrPositioning, final int[] fYCbCrSubSampling,
-            final double[] fReferenceBlackWhite, final int fSamplesPerPixel,
-            final int fBitsPerSample[], final int Predictor, final int width, final int height) {
-        super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
+    public PhotometricInterpreterYCbCr(final int fSamplesPerPixel,
+            final int fBitsPerSample[], final int predictor,
+            final int width, final int height) {
+        super(fSamplesPerPixel, fBitsPerSample, predictor, width, height);
     }
 
-    public int limit(final int value, final int min, final int max) {
+    public static int limit(final int value, final int min, final int max) {
         return Math.min(max, Math.max(min, value));
     }
 
@@ -51,7 +50,7 @@ public class PhotometricInterpreterYCbCr
      *            The Cr component set.
      * @return R The R component.
      */
-    public int convertYCbCrtoRGB(final int Y, final int Cb, final int Cr) {
+    public static int convertYCbCrtoRGB(final int Y, final int Cb, final int Cr) {
         final double r1 = (((1.164 * (Y - 16.0))) + (1.596 * (Cr - 128.0)));
         final double g1 = (((1.164 * (Y - 16.0))) - (0.813 * (Cr - 128.0)) - (0.392 * (Cb - 128.0)));
         final double b1 = (((1.164 * (Y - 16.0))) + (2.017 * (Cb - 128.0)));

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoAscii.java Sun Nov 24 04:46:21 2013
@@ -49,7 +49,7 @@ public class TagInfoAscii extends TagInf
                     final String string = new String(bytes, nextStringPos, i
                             - nextStringPos, "UTF-8");
                     strings[stringsAdded++] = string;
-                } catch (final UnsupportedEncodingException unsupportedEncoding) {
+                } catch (final UnsupportedEncodingException unsupportedEncoding) { // NOPMD
                 }
                 nextStringPos = i + 1;
             }
@@ -60,7 +60,7 @@ public class TagInfoAscii extends TagInf
                 final String string = new String(bytes, nextStringPos, bytes.length
                         - nextStringPos, "UTF-8");
                 strings[stringsAdded++] = string;
-            } catch (final UnsupportedEncodingException unsupportedEncoding) {
+            } catch (final UnsupportedEncodingException unsupportedEncoding) { // NOPMD
             }
         }
         return strings;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java Sun Nov 24 04:46:21 2013
@@ -156,7 +156,7 @@ public final class TagInfoGpsText extend
                 return new String(bytes, "US-ASCII");
             } catch (final UnsupportedEncodingException e) {
                 throw new ImageReadException(
-                        "GPS text field missing encoding prefix.");
+                        "GPS text field missing encoding prefix.", e);
             }
         }
 
@@ -185,7 +185,7 @@ public final class TagInfoGpsText extend
             // try ASCII, with NO prefix.
             return new String(bytes, "US-ASCII");
         } catch (final UnsupportedEncodingException e) {
-            throw new ImageReadException("Unknown GPS text encoding prefix.");
+            throw new ImageReadException("Unknown GPS text encoding prefix.", e);
         }
 
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java Sun Nov 24 04:46:21 2013
@@ -97,7 +97,7 @@ public class TiffOutputField implements 
         return separateValueItem;
     }
 
-    protected boolean isLocalValue() {
+    protected final boolean isLocalValue() {
         return bytes.length <= TIFF_ENTRY_MAX_VALUE_LENGTH;
     }
     
@@ -140,7 +140,8 @@ public class TiffOutputField implements 
         result.append(newline);
 
         result.append(prefix);
-        result.append("count: " + count);
+        result.append("count: ");
+        result.append(count);
         result.append(newline);
 
         result.append(prefix);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSet.java Sun Nov 24 04:46:21 2013
@@ -259,34 +259,33 @@ public final class TiffOutputSet impleme
             prefix = "";
         }
 
-        final StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder(39);
 
         result.append(prefix);
         result.append("TiffOutputSet {");
         result.append(newline);
 
         result.append(prefix);
-        result.append("byteOrder: " + byteOrder);
+        result.append("byteOrder: ");
+        result.append(byteOrder);
         result.append(newline);
 
         for (int i = 0; i < directories.size(); i++) {
             final TiffOutputDirectory directory = directories.get(i);
-            result.append(prefix);
-            result.append("\t" + "directory " + i + ": "
-                    + directory.description() + " (" + directory.type + ")");
-            result.append(newline);
+            result.append(String.format("%s\tdirectory %d: %s (%d)%n",
+                    prefix, i, directory.description(), directory.type));
 
             final List<TiffOutputField> fields = directory.getFields();
             for (int j = 0; j < fields.size(); j++) {
                 final TiffOutputField field = fields.get(j);
                 result.append(prefix);
-                result.append("\t\t" + "field " + i + ": " + field.tagInfo);
+                result.append("\t\tfield " + i + ": " + field.tagInfo);
                 result.append(newline);
             }
         }
-
         result.append(prefix);
-        result.append("}");
+
+        result.append('}');
         result.append(newline);
 
         return result.toString();

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java Sun Nov 24 04:46:21 2013
@@ -46,9 +46,6 @@ public class WbmpImageParser extends Ima
     private static final String DEFAULT_EXTENSION = ".wbmp";
     private static final String ACCEPTED_EXTENSIONS[] = { ".wbmp", };
 
-    public WbmpImageParser() {
-    }
-
     @Override
     public String getName() {
         return "Wireless Application Protocol Bitmap Format";

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java Sun Nov 24 04:46:21 2013
@@ -52,9 +52,6 @@ public class XbmImageParser extends Imag
     private static final String DEFAULT_EXTENSION = ".xbm";
     private static final String ACCEPTED_EXTENSIONS[] = { ".xbm", };
 
-    public XbmImageParser() {
-    }
-
     @Override
     public String getName() {
         return "X BitMap";

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java Sun Nov 24 04:46:21 2013
@@ -66,49 +66,48 @@ public class XpmImageParser extends Imag
         'U', 'Y', 'T', 'R', 'E', 'W', 'Q', '!', '~', '^', '/', '(', ')',
         '_', '`', '\'', ']', '[', '{', '}', '|', };
 
-    public XpmImageParser() {
-    }
-
-    private synchronized static void loadColorNames() throws ImageReadException {
-        if (colorNames != null) {
-            return;
-        }
-
-        try {
-            final InputStream rgbTxtStream =
-                    XpmImageParser.class.getResourceAsStream("rgb.txt");
-            if (rgbTxtStream == null) {
-                throw new ImageReadException("Couldn't find rgb.txt in our resources");
-            }
-            final Map<String, Integer> colors = new HashMap<String, Integer>();
-            BufferedReader reader = null;
-            boolean canThrow = false;
+    private static void loadColorNames() throws ImageReadException {
+        synchronized (XpmImageParser.class) {
+            if (colorNames != null) {
+                return;
+            }
+    
             try {
-                reader = new BufferedReader(new InputStreamReader(rgbTxtStream,
-                        "US-ASCII"));
-                String line;
-                while ((line = reader.readLine()) != null) {
-                    if (line.charAt(0) == '!') {
-                        continue;
-                    }
-                    try {
-                        final int red = Integer.parseInt(line.substring(0, 3).trim());
-                        final int green = Integer.parseInt(line.substring(4, 7).trim());
-                        final int blue = Integer.parseInt(line.substring(8, 11).trim());
-                        final String colorName = line.substring(11).trim();
-                        colors.put(colorName, 0xff000000 | (red << 16)
-                                | (green << 8) | blue);
-                    } catch (final NumberFormatException nfe) {
-                        throw new ImageReadException("Couldn't parse color in rgb.txt", nfe);
+                final InputStream rgbTxtStream =
+                        XpmImageParser.class.getResourceAsStream("rgb.txt");
+                if (rgbTxtStream == null) {
+                    throw new ImageReadException("Couldn't find rgb.txt in our resources");
+                }
+                final Map<String, Integer> colors = new HashMap<String, Integer>();
+                BufferedReader reader = null;
+                boolean canThrow = false;
+                try {
+                    reader = new BufferedReader(new InputStreamReader(rgbTxtStream,
+                            "US-ASCII"));
+                    String line;
+                    while ((line = reader.readLine()) != null) {
+                        if (line.charAt(0) == '!') {
+                            continue;
+                        }
+                        try {
+                            final int red = Integer.parseInt(line.substring(0, 3).trim());
+                            final int green = Integer.parseInt(line.substring(4, 7).trim());
+                            final int blue = Integer.parseInt(line.substring(8, 11).trim());
+                            final String colorName = line.substring(11).trim();
+                            colors.put(colorName, 0xff000000 | (red << 16)
+                                    | (green << 8) | blue);
+                        } catch (final NumberFormatException nfe) {
+                            throw new ImageReadException("Couldn't parse color in rgb.txt", nfe);
+                        }
                     }
+                    canThrow = true;
+                } finally {
+                    IoUtils.closeQuietly(canThrow, reader);
                 }
-                canThrow = true;
-            } finally {
-                IoUtils.closeQuietly(canThrow, reader);
-            }
-            colorNames = colors;
-        } catch (final IOException ioException) {
-            throw new ImageReadException("Could not parse rgb.txt", ioException);
+                colorNames = colors;
+            } catch (final IOException ioException) {
+                throw new ImageReadException("Could not parse rgb.txt", ioException);
+            }
         }
     }
 
@@ -679,7 +678,7 @@ public class XpmImageParser extends Imag
         SimplePalette palette = null;
         int maxColors = writePalette.length;
         int charsPerPixel = 1;
-        for (; palette == null;) {
+        while (palette == null) {
             palette = paletteFactory.makeExactRgbPaletteSimple(src,
                     hasTransparency ? maxColors - 1 : maxColors);
             if (palette == null) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java Sun Nov 24 04:46:21 2013
@@ -265,7 +265,7 @@ public class IccProfileParser extends Bi
 
             {
                 // read stream to end, filling cache.
-                while (is.read() >= 0) { /* do nothing */
+                while (is.read() >= 0) { // NOPMD we're doing nothing with the data
                 }
             }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java Sun Nov 24 04:46:21 2013
@@ -44,8 +44,7 @@ class ColorSpaceSubset {
         rgb = -1;
     }
 
-    ColorSpaceSubset(final int total, final int precision, final int mins[], final int maxs[],
-            final int table[]) {
+    ColorSpaceSubset(final int total, final int precision, final int mins[], final int maxs[]) {
         this.total = total;
         this.precision = precision;
         this.mins = mins;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java Sun Nov 24 04:46:21 2013
@@ -17,6 +17,7 @@
 package org.apache.commons.imaging.palette;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.util.Debug;
 
 /**
  * Color palette.
@@ -45,6 +46,9 @@ public abstract class Palette {
     public abstract int length();
 
     public void dump() {
+        for (int i = 0; i < length(); i++) {
+            Debug.debug("\t" + "palette[" + i + "]", getEntry(i) + " (0x"
+                    + Integer.toHexString(getEntry(i)) + ")");
+        }
     }
-
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java Sun Nov 24 04:46:21 2013
@@ -125,9 +125,8 @@ public class PaletteFactory {
         return sum;
     }
 
-    private DivisionCandidate finishDivision(final int table[],
-            final ColorSpaceSubset subset, final int component, final int precision, final int sum,
-            final int slice) {
+    private DivisionCandidate finishDivision(final ColorSpaceSubset subset,
+            final int component, final int precision, final int sum, final int slice) {
         if (debug) {
             subset.dump("trying (" + component + "): ");
         }
@@ -167,11 +166,11 @@ public class PaletteFactory {
         }
 
         final ColorSpaceSubset first = new ColorSpaceSubset(sum, precision,
-                subset.mins, slice_maxs, table);
+                subset.mins, slice_maxs);
         final ColorSpaceSubset second = new ColorSpaceSubset(total - sum, precision,
-                slice_mins, subset.maxs, table);
+                slice_mins, subset.maxs);
 
-        return new DivisionCandidate(subset, first, second);
+        return new DivisionCandidate(first, second);
 
     }
 
@@ -210,10 +209,10 @@ public class PaletteFactory {
         sum2 = sum1 - last;
         slice2 = slice1 - 1;
 
-        final DivisionCandidate dc1 = finishDivision(table, subset, component,
-                precision, sum1, slice1);
-        final DivisionCandidate dc2 = finishDivision(table, subset, component,
-                precision, sum2, slice2);
+        final DivisionCandidate dc1 = finishDivision(subset, component, precision,
+                sum1, slice1);
+        final DivisionCandidate dc2 = finishDivision(subset, component, precision,
+                sum2, slice2);
 
         final List<DivisionCandidate> result = new ArrayList<DivisionCandidate>();
 
@@ -266,8 +265,7 @@ public class PaletteFactory {
         // private final ColorSpaceSubset src;
         private final ColorSpaceSubset dst_a, dst_b;
 
-        public DivisionCandidate(final ColorSpaceSubset src, final ColorSpaceSubset dst_a,
-                final ColorSpaceSubset dst_b) {
+        public DivisionCandidate(final ColorSpaceSubset dst_a, final ColorSpaceSubset dst_b) {
             // this.src = src;
             this.dst_a = dst_a;
             this.dst_b = dst_b;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/QuantizedPalette.java Sun Nov 24 04:46:21 2013
@@ -17,7 +17,6 @@
 package org.apache.commons.imaging.palette;
 
 import java.util.List;
-
 import org.apache.commons.imaging.ImageWriteException;
 
 public class QuantizedPalette extends Palette {
@@ -60,14 +59,6 @@ public class QuantizedPalette extends Pa
     }
 
     @Override
-    public void dump() {
-        // System.out.println("ColorSpaceSubset.compares: "
-        // + ColorSpaceSubset.compares);
-        // System.out.println("converted: " + converted);
-        // System.out.println("avg. distance: " + (distance / converted));
-    }
-
-    @Override
     public int getEntry(final int index) {
         final ColorSpaceSubset subset = subsets.get(index);
         return subset.rgb;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/SimplePalette.java Sun Nov 24 04:46:21 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.imaging.palette;
 
-import org.apache.commons.imaging.util.Debug;
-
 public class SimplePalette extends Palette {
     private final int palette[];
 
@@ -46,14 +44,6 @@ public class SimplePalette extends Palet
     }
 
     @Override
-    public void dump() {
-        for (int i = 0; i < palette.length; i++) {
-            Debug.debug("\t" + "palette[" + i + "]", palette[i] + " (0x"
-                    + Integer.toHexString(palette[i]) + ")");
-        }
-    }
-
-    @Override
     public int length() {
         return palette.length;
     }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java?rev=1544910&r1=1544909&r2=1544910&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java Sun Nov 24 04:46:21 2013
@@ -121,7 +121,7 @@ public final class Debug {
                         + Integer.toHexString(b) + ")" + newline);
             }
             if (v.length > max) {
-                result.append("\t" + "..." + newline);
+                result.append("\t..." + newline);
             }
 
             result.append(newline);
@@ -264,20 +264,25 @@ public final class Debug {
         final char c3 = (char) b3;
         final char c4 = (char) b4;
         // return new String(new char[] { c1, c2, c3, c4 });
-        final StringBuilder fStringBuffer = new StringBuilder();
+        final StringBuilder fStringBuffer = new StringBuilder(31);
         fStringBuffer.append(new String(new char[] { c1, c2, c3, c4 }));
-        fStringBuffer.append(" bytequad: " + bytequad);
-        fStringBuffer.append(" b1: " + b1);
-        fStringBuffer.append(" b2: " + b2);
-        fStringBuffer.append(" b3: " + b3);
-        fStringBuffer.append(" b4: " + b4);
+        fStringBuffer.append(" bytequad: ");
+        fStringBuffer.append(bytequad);
+        fStringBuffer.append(" b1: ");
+        fStringBuffer.append(b1);
+        fStringBuffer.append(" b2: ");
+        fStringBuffer.append(b2);
+        fStringBuffer.append(" b3: ");
+        fStringBuffer.append(b3);
+        fStringBuffer.append(" b4: ");
+        fStringBuffer.append(b4);
 
         return fStringBuffer.toString();
     }
 
     public static String getDebug(final String message, final ICC_Profile value) {
 
-        final StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder(37);
 
         result.append(getDebug("ICC_Profile " + message + ": "
                 + ((value == null) ? "null" : value.toString()))
@@ -592,7 +597,7 @@ public final class Debug {
     }
 
     public static String getDebug(final Throwable e, final int max) {
-        final StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder(35);
 
         final SimpleDateFormat timestamp = new SimpleDateFormat(
                 "yyyy-MM-dd kk:mm:ss:SSS", Locale.ENGLISH);
@@ -824,4 +829,6 @@ public final class Debug {
         // }
     }
 
+    private Debug() {
+    }
 }



Mime
View raw message