commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1544840 [3/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
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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -291,16 +291,16 @@ public class TiffReader extends BinaryFi
         }
     }
 
-    public static interface Listener {
-        public boolean setTiffHeader(TiffHeader tiffHeader);
+    public interface Listener {
+        boolean setTiffHeader(TiffHeader tiffHeader);
 
-        public boolean addDirectory(TiffDirectory directory);
+        boolean addDirectory(TiffDirectory directory);
 
-        public boolean addField(TiffField field);
+        boolean addField(TiffField field);
 
-        public boolean readImageData();
+        boolean readImageData();
 
-        public boolean readOffsetDirectories();
+        boolean readOffsetDirectories();
     }
 
     private static class Collector implements Listener {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TagConstantsUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TagConstantsUtils.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TagConstantsUtils.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TagConstantsUtils.java Sat Nov 23 17:19:36 2013
@@ -22,7 +22,7 @@ import java.util.List;
 import org.apache.commons.imaging.common.BinaryConstant;
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
 
-public class TagConstantsUtils implements TiffDirectoryConstants {
+public final class TagConstantsUtils implements TiffDirectoryConstants {
     private static final TiffDirectoryType[] tiffDirectoryTypes = TiffDirectoryType
             .values();
 
@@ -61,4 +61,6 @@ public class TagConstantsUtils implement
                 (byte) 0xC9, end });
     }
 
+    private TagConstantsUtils() {
+    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java Sat Nov 23 17:19:36 2013
@@ -36,7 +36,7 @@ public final class DataReaderStrips exte
     private final int compression;
     private final int rowsPerStrip;
     private final ByteOrder byteOrder;
-
+    private int x = 0, y = 0;
     private final TiffImageData.Strips imageData;
 
     public DataReaderStrips(final TiffDirectory directory,
@@ -200,8 +200,6 @@ public final class DataReaderStrips exte
         }
     }
 
-    private int x = 0, y = 0;
-
     @Override
     public void readImageData(final ImageBuilder imageBuilder)
             throws ImageReadException, IOException {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldType.java Sat Nov 23 17:19:36 2013
@@ -46,37 +46,6 @@ public abstract class FieldType {
     private final int type;
     private final String name;
     private final int elementSize;
-
-    protected FieldType(final int type, final String name, final int elementSize) {
-        this.type = type;
-        this.name = name;
-        this.elementSize = elementSize;
-    }
-    
-    
-    public int getType() {
-        return type;
-    }
-    
-    public String getName() {
-        return name;
-    }
-    
-    public int getSize() {
-        return elementSize;
-    }
-    
-    public static FieldType getFieldType(final int type) throws ImageReadException {
-        for (final FieldType fieldType : ANY) {
-            if (fieldType.getType() == type) {
-                return fieldType;
-            }
-        }
-        throw new ImageReadException("Field type " + type + " is unsupported");
-    }
-    
-    public abstract Object getValue(final TiffField entry);
-    public abstract byte[] writeData(final Object o, final ByteOrder byteOrder) throws ImageWriteException;
     
     public static final List<FieldType> ANY =
             Collections.unmodifiableList(Arrays.asList(
@@ -117,4 +86,35 @@ public abstract class FieldType {
     public static final List<FieldType> ASCII_OR_BYTE =
             Collections.unmodifiableList(Arrays.asList(
                     ASCII, BYTE));
+
+    protected FieldType(final int type, final String name, final int elementSize) {
+        this.type = type;
+        this.name = name;
+        this.elementSize = elementSize;
+    }
+    
+    
+    public int getType() {
+        return type;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public int getSize() {
+        return elementSize;
+    }
+    
+    public static FieldType getFieldType(final int type) throws ImageReadException {
+        for (final FieldType fieldType : ANY) {
+            if (fieldType.getType() == type) {
+                return fieldType;
+            }
+        }
+        throw new ImageReadException("Field type " + type + " is unsupported");
+    }
+    
+    public abstract Object getValue(final TiffField entry);
+    public abstract byte[] writeData(final Object o, final ByteOrder byteOrder) throws ImageWriteException;
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfo.java Sat Nov 23 17:19:36 2013
@@ -29,8 +29,14 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
 import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
 
-public abstract class TagInfo {
+public class TagInfo {
     public static final int LENGTH_UNKNOWN = -1;
+    public final String name;
+    public final int tag;
+    public final List<FieldType> dataTypes;
+    public final int length;
+    public final TiffDirectoryType directoryType;
+    private final boolean isOffset;
 
     public TagInfo(final String name, final int tag, final FieldType dataType, final int length,
             final TiffDirectoryType exifDirectory) {
@@ -53,13 +59,6 @@ public abstract class TagInfo {
                 TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
     }
 
-    public final String name;
-    public final int tag;
-    public final List<FieldType> dataTypes;
-    public final int length;
-    public final TiffDirectoryType directoryType;
-    private final boolean isOffset;
-
     public TagInfo(final String name, final int tag, final List<FieldType> dataTypes, final int length,
             final TiffDirectoryType exifDirectory) {
         this(name, tag, dataTypes, length, exifDirectory, false);

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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -34,26 +34,6 @@ import org.apache.commons.imaging.util.D
  * the non-null-terminated text in an unknown byte order.  
  */
 public final class TagInfoGpsText extends TagInfo {
-    public TagInfoGpsText(final String name, final int tag, final int length,
-            final TiffDirectoryType exifDirectory) {
-        super(name, tag, FieldType.UNDEFINED, length, exifDirectory);
-    }
-
-    @Override
-    public boolean isText() {
-        return true;
-    }
-
-    private static final class TextEncoding {
-        public final byte prefix[];
-        public final String encodingName;
-
-        public TextEncoding(final byte[] prefix, final String encodingName) {
-            this.prefix = prefix;
-            this.encodingName = encodingName;
-        }
-    }
-
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_ASCII = new TextEncoding(
             new byte[] { 0x41, 0x53, 0x43, 0x49, 0x49, 0x00, 0x00, 0x00, },
             "US-ASCII"); // ITU-T T.50 IA5
@@ -78,6 +58,26 @@ public final class TagInfoGpsText extend
             TEXT_ENCODING_UNDEFINED, //
     };
 
+    public TagInfoGpsText(final String name, final int tag, final int length,
+            final TiffDirectoryType exifDirectory) {
+        super(name, tag, FieldType.UNDEFINED, length, exifDirectory);
+    }
+
+    @Override
+    public boolean isText() {
+        return true;
+    }
+
+    private static final class TextEncoding {
+        public final byte prefix[];
+        public final String encodingName;
+
+        public TextEncoding(final byte[] prefix, final String encodingName) {
+            this.prefix = prefix;
+            this.encodingName = encodingName;
+        }
+    }
+
     @Override
     public byte[] encodeValue(final FieldType fieldType, final Object value, final ByteOrder byteOrder)
             throws ImageWriteException {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java Sat Nov 23 17:19:36 2013
@@ -63,7 +63,7 @@ public abstract class TiffImageWriterBas
             throws ImageWriteException {
         final List<TiffOutputDirectory> directories = outputSet.getDirectories();
 
-        if (1 > directories.size()) { 
+        if (directories.isEmpty()) { 
             throw new ImageWriteException("No directories.");
         }
 
@@ -157,7 +157,7 @@ public abstract class TiffImageWriterBas
             // directory.
         }
 
-        if (directoryIndices.size() < 1) {
+        if (directoryIndices.isEmpty()) {
             throw new ImageWriteException("Missing root directory.");
         }
 
@@ -288,7 +288,7 @@ public abstract class TiffImageWriterBas
         final HashMap<String,Object> rawParams = new HashMap<String,Object>(params);
         params.remove(PARAM_KEY_T4_OPTIONS);
         params.remove(PARAM_KEY_T6_OPTIONS);
-        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/tiff/write/TiffImageWriterLossless.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java Sat Nov 23 17:19:36 2013
@@ -43,6 +43,16 @@ import org.apache.commons.imaging.format
 
 public class TiffImageWriterLossless extends TiffImageWriterBase {
     private final byte exifBytes[];
+    private static final Comparator<TiffElement> ELEMENT_SIZE_COMPARATOR = new Comparator<TiffElement>() {
+        public int compare(final TiffElement e1, final TiffElement e2) {
+            return e1.length - e2.length;
+        }
+    };
+    private static final Comparator<TiffOutputItem> ITEM_SIZE_COMPARATOR = new Comparator<TiffOutputItem>() {
+        public int compare(final TiffOutputItem e1, final TiffOutputItem e2) {
+            return e1.getItemLength() - e2.getItemLength();
+        }
+    };
 
     public TiffImageWriterLossless(final byte exifBytes[]) {
         this.exifBytes = exifBytes;
@@ -152,7 +162,7 @@ public class TiffImageWriterLossless ext
         }
         final List<TiffElement> analysis = analyzeOldTiff(frozenFields);
         final int oldLength = exifBytes.length;
-        if (analysis.size() < 1) {
+        if (analysis.isEmpty()) {
             throw new ImageWriteException("Couldn't analyze old tiff data.");
         } else if (analysis.size() == 1) {
             final TiffElement onlyElement = analysis.get(0);
@@ -191,18 +201,6 @@ public class TiffImageWriterLossless ext
 
     }
 
-    private static final Comparator<TiffElement> ELEMENT_SIZE_COMPARATOR = new Comparator<TiffElement>() {
-        public int compare(final TiffElement e1, final TiffElement e2) {
-            return e1.length - e2.length;
-        }
-    };
-
-    private static final Comparator<TiffOutputItem> ITEM_SIZE_COMPARATOR = new Comparator<TiffOutputItem>() {
-        public int compare(final TiffOutputItem e1, final TiffOutputItem e2) {
-            return e1.getItemLength() - e2.getItemLength();
-        }
-    };
-
     private long updateOffsetsStep(final List<TiffElement> analysis,
             final List<TiffOutputItem> outputItems) {
         // items we cannot fit into a gap, we shall append to tail.
@@ -216,7 +214,7 @@ public class TiffImageWriterLossless ext
         Collections.reverse(unusedElements);
         // any items that represent a gap at the end of the exif segment, can be
         // discarded.
-        while (unusedElements.size() > 0) {
+        while (!unusedElements.isEmpty()) {
             final TiffElement element = unusedElements.get(0);
             final long elementEnd = element.offset + element.length;
             if (elementEnd == overflowIndex) {
@@ -237,7 +235,7 @@ public class TiffImageWriterLossless ext
         Collections.sort(unplacedItems, ITEM_SIZE_COMPARATOR);
         Collections.reverse(unplacedItems);
 
-        while (unplacedItems.size() > 0) {
+        while (!unplacedItems.isEmpty()) {
             // pop off largest unplaced item.
             final TiffOutputItem outputItem = unplacedItems.remove(0);
             final int outputItemLength = outputItem.getItemLength();

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java Sat Nov 23 17:19:36 2013
@@ -27,6 +27,7 @@ import org.apache.commons.imaging.common
 public class TiffImageWriterLossy extends TiffImageWriterBase {
 
     public TiffImageWriterLossy() {
+        // with default byte order
     }
 
     public TiffImageWriterLossy(final ByteOrder byteOrder) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java Sat Nov 23 17:19:36 2013
@@ -73,6 +73,8 @@ public final class TiffOutputDirectory e
             }
         }
     };
+    private JpegImageData jpegImageData = null;
+    private TiffImageData tiffImageData = null;
 
     public void setNextDirectory(final TiffOutputDirectory nextDirectory) {
         this.nextDirectory = nextDirectory;
@@ -487,8 +489,6 @@ public final class TiffOutputDirectory e
         }
     }
 
-    private JpegImageData jpegImageData = null;
-
     public void setJpegImageData(final JpegImageData rawJpegImageData) {
         this.jpegImageData = rawJpegImageData;
     }
@@ -497,8 +497,6 @@ public final class TiffOutputDirectory e
         return jpegImageData;
     }
 
-    private TiffImageData tiffImageData = null;
-
     public void setTiffImageData(final TiffImageData rawTiffImageData) {
         this.tiffImageData = rawTiffImageData;
     }

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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -31,10 +31,10 @@ public class TiffOutputField implements 
     public final TagInfo tagInfo;
     public final FieldType fieldType;
     public final int count;
-
     private byte bytes[];
-
     private final TiffOutputItem.Value separateValueItem;
+    private int sortHint = -1;
+    private static final String newline = System.getProperty("line.separator");
 
     public TiffOutputField(final TagInfo tagInfo, final FieldType tagtype, final int count,
             final byte bytes[]) {
@@ -58,8 +58,6 @@ public class TiffOutputField implements 
         }
     }
 
-    private int sortHint = -1;
-
     protected static final TiffOutputField createOffsetField(final TagInfo tagInfo,
             final ByteOrder byteOrder) throws ImageWriteException {
         return new TiffOutputField(tagInfo, FieldType.LONG, 1,
@@ -126,8 +124,6 @@ public class TiffOutputField implements 
         // + tagInfo.getDescription());
     }
 
-    private 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/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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -30,6 +30,7 @@ import org.apache.commons.imaging.util.D
 public final class TiffOutputSet implements TiffConstants {
     public final ByteOrder byteOrder;
     private final List<TiffOutputDirectory> directories = new ArrayList<TiffOutputDirectory>();
+    private static final String newline = System.getProperty("line.separator");
 
     public TiffOutputSet() {
         this(TiffConstants.DEFAULT_TIFF_BYTE_ORDER);
@@ -248,8 +249,6 @@ public final class TiffOutputSet impleme
         return result;
     }
 
-    private 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/formats/tiff/write/TiffOutputSummary.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputSummary.java Sat Nov 23 17:19:36 2013
@@ -29,7 +29,9 @@ class TiffOutputSummary implements TiffC
     public final ByteOrder byteOrder;
     public final TiffOutputDirectory rootDirectory;
     public final Map<Integer, TiffOutputDirectory> directoryTypeMap;
-
+    private final List<OffsetItem> offsetItems = new ArrayList<OffsetItem>();
+    private final List<ImageDataOffsets> imageDataItems = new ArrayList<ImageDataOffsets>();
+    
     public TiffOutputSummary(final ByteOrder byteOrder,
             final TiffOutputDirectory rootDirectory,
             final Map<Integer, TiffOutputDirectory> directoryTypeMap) {
@@ -50,8 +52,6 @@ class TiffOutputSummary implements TiffC
         }
     }
 
-    private final List<OffsetItem> offsetItems = new ArrayList<OffsetItem>();
-
     public void add(final TiffOutputItem item,
             final TiffOutputField itemOffsetField) {
         offsetItems.add(new OffsetItem(item, itemOffsetField));
@@ -79,8 +79,6 @@ class TiffOutputSummary implements TiffC
         }
     }
 
-    private final List<ImageDataOffsets> imageDataItems = new ArrayList<ImageDataOffsets>();
-
     public void addTiffImageData(final ImageDataOffsets imageDataInfo) {
         imageDataItems.add(imageDataInfo);
     }

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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -43,6 +43,9 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.util.IoUtils;
 
 public class WbmpImageParser extends ImageParser {
+    private static final String DEFAULT_EXTENSION = ".wbmp";
+    private static final String ACCEPTED_EXTENSIONS[] = { ".wbmp", };
+
     public WbmpImageParser() {
     }
 
@@ -56,9 +59,6 @@ public class WbmpImageParser extends Ima
         return DEFAULT_EXTENSION;
     }
 
-    private static final String DEFAULT_EXTENSION = ".wbmp";
-    private static final String ACCEPTED_EXTENSIONS[] = { ".wbmp", };
-
     @Override
     protected String[] getAcceptedExtensions() {
         return ACCEPTED_EXTENSIONS;
@@ -247,7 +247,7 @@ public class WbmpImageParser extends Ima
             params.remove(PARAM_KEY_FORMAT);
         }
 
-        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/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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -49,6 +49,9 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.util.IoUtils;
 
 public class XbmImageParser extends ImageParser {
+    private static final String DEFAULT_EXTENSION = ".xbm";
+    private static final String ACCEPTED_EXTENSIONS[] = { ".xbm", };
+
     public XbmImageParser() {
     }
 
@@ -62,9 +65,6 @@ public class XbmImageParser extends Imag
         return DEFAULT_EXTENSION;
     }
 
-    private static final String DEFAULT_EXTENSION = ".xbm";
-    private static final String ACCEPTED_EXTENSIONS[] = { ".xbm", };
-
     @Override
     protected String[] getAcceptedExtensions() {
         return ACCEPTED_EXTENSIONS;
@@ -193,7 +193,7 @@ public class XbmImageParser extends Imag
             throws ImageReadException, IOException {
         String token;
         token = cParser.nextToken();
-        if (token == null || !token.equals("static")) {
+        if (!"static".equals(token)) {
             throw new ImageReadException(
                     "Parsing XBM file failed, no 'static' token");
         }
@@ -203,10 +203,10 @@ public class XbmImageParser extends Imag
                     "Parsing XBM file failed, no 'unsigned' "
                             + "or 'char' token");
         }
-        if (token.equals("unsigned")) {
+        if ("unsigned".equals(token)) {
             token = cParser.nextToken();
         }
-        if (token == null || !token.equals("char")) {
+        if (!"char".equals(token)) {
             throw new ImageReadException(
                     "Parsing XBM file failed, no 'char' token");
         }
@@ -229,22 +229,22 @@ public class XbmImageParser extends Imag
             }
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("[")) {
+        if (!"[".equals(token)) {
             throw new ImageReadException(
                     "Parsing XBM file failed, no '[' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("]")) {
+        if (!"]".equals(token)) {
             throw new ImageReadException(
                     "Parsing XBM file failed, no ']' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("=")) {
+        if (!"=".equals(token)) {
             throw new ImageReadException(
                     "Parsing XBM file failed, no '=' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("{")) {
+        if (!"{".equals(token)) {
             throw new ImageReadException(
                     "Parsing XBM file failed, no '{' token");
         }
@@ -275,8 +275,8 @@ public class XbmImageParser extends Imag
                 throw new ImageReadException("Parsing XBM file failed, "
                         + "premature end of file");
             }
-            if (!token.equals(",")
-                    && (i < (imageData.length - 1) || !token.equals("}"))) {
+            if (!",".equals(token)
+                    && (i < (imageData.length - 1) || !"}".equals(token))) {
                 throw new ImageReadException("Parsing XBM file failed, "
                         + "punctuation error");
             }
@@ -344,7 +344,7 @@ public class XbmImageParser extends Imag
             params.remove(PARAM_KEY_FORMAT);
         }
 
-        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/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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -54,7 +54,17 @@ import org.apache.commons.imaging.palett
 import org.apache.commons.imaging.util.IoUtils;
 
 public class XpmImageParser extends ImageParser {
+    private static final String DEFAULT_EXTENSION = ".xpm";
+    private static final String ACCEPTED_EXTENSIONS[] = { ".xpm", };
     private static Map<String, Integer> colorNames = null;
+    private static final char writePalette[] = { ' ', '.', 'X', 'o', 'O', '+',
+        '@', '#', '$', '%', '&', '*', '=', '-', ';', ':', '>', ',', '<',
+        '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'q', 'w', 'e',
+        'r', 't', 'y', 'u', 'i', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j',
+        'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'M', 'N', 'B', 'V',
+        'C', 'Z', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'P', 'I',
+        'U', 'Y', 'T', 'R', 'E', 'W', 'Q', '!', '~', '^', '/', '(', ')',
+        '_', '`', '\'', ']', '[', '{', '}', '|', };
 
     public XpmImageParser() {
     }
@@ -78,7 +88,7 @@ public class XpmImageParser extends Imag
                         "US-ASCII"));
                 String line;
                 while ((line = reader.readLine()) != null) {
-                    if (line.startsWith("!")) {
+                    if (line.charAt(0) == '!') {
                         continue;
                     }
                     try {
@@ -112,9 +122,6 @@ public class XpmImageParser extends Imag
         return DEFAULT_EXTENSION;
     }
 
-    private static final String DEFAULT_EXTENSION = ".xpm";
-    private static final String ACCEPTED_EXTENSIONS[] = { ".xpm", };
-
     @Override
     protected String[] getAcceptedExtensions() {
         return ACCEPTED_EXTENSIONS;
@@ -258,7 +265,7 @@ public class XpmImageParser extends Imag
             final StringBuilder firstComment = new StringBuilder();
             final ByteArrayOutputStream preprocessedFile = BasicCParser.preprocess(
                     is, firstComment, null);
-            if (!firstComment.toString().trim().equals("XPM")) {
+            if (!"XPM".equals(firstComment.toString().trim())) {
                 throw new ImageReadException("Parsing XPM file failed, "
                         + "signature isn't '/* XPM */'");
             }
@@ -287,9 +294,9 @@ public class XpmImageParser extends Imag
                 .nextToken()) {
             BasicCParser.unescapeString(stringBuilder, token);
         }
-        if (token.equals(",")) {
+        if (",".equals(token)) {
             return true;
-        } else if (token.equals("}")) {
+        } else if ("}".equals(token)) {
             return false;
         } else {
             throw new ImageReadException("Parsing XPM file failed, "
@@ -317,7 +324,7 @@ public class XpmImageParser extends Imag
                 yHotSpot = Integer.parseInt(tokens[5]);
             }
             if (tokens.length == 5 || tokens.length == 7) {
-                if (tokens[tokens.length - 1].equals("XPMEXT")) {
+                if ("XPMEXT".equals(tokens[tokens.length - 1])) {
                     xpmExt = true;
                 } else {
                     throw new ImageReadException("Parsing XPM file failed, "
@@ -358,7 +365,7 @@ public class XpmImageParser extends Imag
         } else if (color.charAt(0) == '%') {
             throw new ImageReadException("HSV colors are not implemented "
                     + "even in the XPM specification!");
-        } else if (color.equals("None")) {
+        } else if ("None".equals(color)) {
             return 0x00000000;
         } else {
             loadColorNames();
@@ -370,19 +377,19 @@ public class XpmImageParser extends Imag
     }
     
     private void populatePaletteEntry(final PaletteEntry paletteEntry, final String key, final String color) throws ImageReadException {
-        if (key.equals("m")) {
+        if ("m".equals(key)) {
             paletteEntry.monoArgb = parseColor(color);
             paletteEntry.haveMono = true;
-        } else if (key.equals("g4")) {
+        } else if ("g4".equals(key)) {
             paletteEntry.gray4LevelArgb = parseColor(color);
             paletteEntry.haveGray4Level = true;
-        } else if (key.equals("g")) {
+        } else if ("g".equals(key)) {
             paletteEntry.grayArgb = parseColor(color);
             paletteEntry.haveGray = true;
-        } else if (key.equals("s")) {
+        } else if ("s".equals(key)) {
             paletteEntry.colorArgb = parseColor(color);
             paletteEntry.haveColor = true;
-        } else if (key.equals("c")) {
+        } else if ("c".equals(key)) {
             paletteEntry.colorArgb = parseColor(color);
             paletteEntry.haveColor = true;
         }
@@ -409,9 +416,9 @@ public class XpmImageParser extends Imag
                 final String token = tokens[j];
                 boolean isKey = false;
                 if (previousKeyIndex < (j - 1) && 
-                    token.equals("m") || token.equals("g4") ||
-                    token.equals("g") || token.equals("c") ||
-                    token.equals("s")) {
+                    "m".equals(token) || "g4".equals(token) ||
+                    "g".equals(token) || "c".equals(token) ||
+                    "s".equals(token)) {
                     isKey = true;
                 }
                 if (isKey) {
@@ -447,17 +454,17 @@ public class XpmImageParser extends Imag
         String name;
         String token;
         token = cParser.nextToken();
-        if (token == null || !token.equals("static")) {
+        if (!"static".equals(token)) {
             throw new ImageReadException(
                     "Parsing XPM file failed, no 'static' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("char")) {
+        if (!"char".equals(token)) {
             throw new ImageReadException(
                     "Parsing XPM file failed, no 'char' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("*")) {
+        if (!"*".equals(token)) {
             throw new ImageReadException(
                     "Parsing XPM file failed, no '*' token");
         }
@@ -480,22 +487,22 @@ public class XpmImageParser extends Imag
             }
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("[")) {
+        if (!"[".equals(token)) {
             throw new ImageReadException(
                     "Parsing XPM file failed, no '[' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("]")) {
+        if (!"]".equals(token)) {
             throw new ImageReadException(
                     "Parsing XPM file failed, no ']' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("=")) {
+        if (!"=".equals(token)) {
             throw new ImageReadException(
                     "Parsing XPM file failed, no '=' token");
         }
         token = cParser.nextToken();
-        if (token == null || !token.equals("{")) {
+        if (!"{".equals(token)) {
             throw new ImageReadException(
                     "Parsing XPM file failed, no '{' token");
         }
@@ -587,7 +594,7 @@ public class XpmImageParser extends Imag
         }
 
         final String token = cParser.nextToken();
-        if (!token.equals(";")) {
+        if (!";".equals(token)) {
             throw new ImageReadException("Last token wasn't ';'");
         }
 
@@ -659,7 +666,7 @@ public class XpmImageParser extends Imag
             params.remove(PARAM_KEY_FORMAT);
         }
 
-        if (params.size() > 0) {
+        if (!params.isEmpty()) {
             final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
         }
@@ -730,15 +737,6 @@ public class XpmImageParser extends Imag
         os.write(line.getBytes("US-ASCII"));
     }
 
-    private static final char writePalette[] = { ' ', '.', 'X', 'o', 'O', '+',
-            '@', '#', '$', '%', '&', '*', '=', '-', ';', ':', '>', ',', '<',
-            '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'q', 'w', 'e',
-            'r', 't', 'y', 'u', 'i', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j',
-            'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'M', 'N', 'B', 'V',
-            'C', 'Z', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'P', 'I',
-            'U', 'Y', 'T', 'R', 'E', 'W', 'Q', '!', '~', '^', '/', '(', ')',
-            '_', '`', '\'', ']', '[', '{', '}', '|', };
-
     /**
      * Extracts embedded XML metadata as XML string.
      * <p>

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java Sat Nov 23 17:19:36 2013
@@ -16,9 +16,12 @@
  */
 package org.apache.commons.imaging.icc;
 
-public class IccConstants {
+public final class IccConstants {
     public final static int IEC = (((0xff & 'I') << 24) | ((0xff & 'E') << 16)
             | ((0xff & 'C') << 8) | ((0xff & ' ') << 0));
     public final static int sRGB = (((0xff & 's') << 24) | ((0xff & 'R') << 16)
             | ((0xff & 'G') << 8) | ((0xff & 'B') << 0));
+    
+    private IccConstants() {
+    }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java Sat Nov 23 17:19:36 2013
@@ -32,6 +32,9 @@ public class IccTag {
     public final int signature;
     public final int offset, length;
     public final IccTagType fIccTagType;
+    public byte data[] = null;
+    private IccTagDataType itdt = null;
+    private int data_type_signature;
 
     // public final byte data[];
 
@@ -42,10 +45,6 @@ public class IccTag {
         this.fIccTagType = fIccTagType;
     }
 
-    public byte data[] = null;
-    private IccTagDataType itdt = null;
-    private int data_type_signature;
-
     public void setData(final byte bytes[]) throws IOException {
         data = bytes;
 

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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -25,6 +25,9 @@ class ColorSpaceSubset {
     final int precision_mask;
     final int total;
     int rgb; // median
+    // the index in the palette.
+    private int index;
+    public static final RgbComparator rgbComparator = new RgbComparator();
 
     ColorSpaceSubset(final int total, final int precision) {
         this.total = total;
@@ -152,9 +155,6 @@ class ColorSpaceSubset {
         rgb = (int) (((redsum & 0xff) << 16) | ((greensum & 0xff) << 8) | ((bluesum & 0xff) << 0));
     }
 
-    // the index in the palette.
-    private int index;
-    
     public final int getIndex() {
         return index;
     }
@@ -170,6 +170,4 @@ class ColorSpaceSubset {
             return c1.rgb - c2.rgb;
         }
     }
-    
-    public static final RgbComparator rgbComparator = new RgbComparator();
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Dithering.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Dithering.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Dithering.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Dithering.java Sat Nov 23 17:19:36 2013
@@ -23,7 +23,10 @@ import org.apache.commons.imaging.ImageW
 /**
  * Dithering algorithms to use when quantizing an image to paletted form.
  */
-public class Dithering {
+public final class Dithering {
+    private Dithering() {
+    }
+    
     /**
      * Changes the given image to only use colors from the given palette,
      * applying Floyd-Steinberg dithering in the process. Ensure that

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java Sat Nov 23 17:19:36 2013
@@ -89,9 +89,9 @@ public class MedianCutLongestAxisImpleme
 
             if (new_count < count_half) {
                 old_count = new_count;
-                continue;
+            } else {
+                break;
             }
-            break;
         }
 
         if (median_index == color_group.color_counts.size() - 1) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java Sat Nov 23 17:19:36 2013
@@ -63,9 +63,9 @@ public class MedianCutMostPopulatedBoxes
     
                 if (new_count < count_half) {
                     old_count = new_count;
-                    continue;
+                } else {
+                    break;
                 }
-                break;
             }
             if (median_index == colorGroup.color_counts.size() - 1) {
                 median_index--;
@@ -82,7 +82,7 @@ public class MedianCutMostPopulatedBoxes
             final List<ColorCount> upperColors = new ArrayList<ColorCount>(
                     colorGroup.color_counts.subList(median_index + 1,
                             colorGroup.color_counts.size()));
-            if (lowerColors.size() == 0 || upperColors.size() == 0) {
+            if (lowerColors.isEmpty() || upperColors.isEmpty()) {
                 continue;
             }
             final ColorGroup lowerGroup = new ColorGroup(lowerColors, ignoreAlpha);

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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -33,7 +33,8 @@ import org.apache.commons.imaging.ImageW
  */
 public class PaletteFactory {
     private static final boolean debug = false;
-
+    public static final int components = 3; // in bits
+    
     /**
      * Builds an exact complete opaque palette containing all the colors in {@code src},
      * using an algorithm that is faster than {@linkplain #makeExactRgbPaletteSimple} for large images
@@ -261,8 +262,6 @@ public class PaletteFactory {
         return best_v;
     }
 
-    public static final int components = 3; // in bits
-
     private static class DivisionCandidate {
         // private final ColorSpaceSubset src;
         private final ColorSpaceSubset dst_a, dst_b;

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=1544840&r1=1544839&r2=1544840&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 Sat Nov 23 17:19:36 2013
@@ -27,11 +27,15 @@ import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 public final class Debug {
 
     private static final boolean DEBUG = false;
+    // public static String newline = System.getProperty("line.separator");
+    public static final String newline = "\r\n";
+    private static long counter = 0;
 
     public static void debug(final String message) {
         if (DEBUG) {
@@ -141,9 +145,7 @@ public final class Debug {
         return result.toString();
     }
 
-    private static long counter = 0;
-
-    public static String getDebug(final String message, final java.util.List<?> v) {
+    public static String getDebug(final String message, final List<?> v) {
         final StringBuilder result = new StringBuilder();
 
         final String suffix = " [" + counter++ + "]";
@@ -189,9 +191,6 @@ public final class Debug {
         return compare(prefix, a, b, null, null);
     }
 
-    // public static String newline = System.getProperty("line.separator");
-    public static final String newline = "\r\n";
-
     private static void log(final StringBuilder buffer, final String s) {
         Debug.debug(s);
         if (buffer != null) {
@@ -309,12 +308,12 @@ public final class Debug {
     }
 
     public static String getDebug(final String message, final Date value) {
-        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
         return getDebug(message, (value == null) ? "null" : df.format(value));
     }
 
     public static String getDebug(final String message, final Calendar value) {
-        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
         return getDebug(message,
                 (value == null) ? "null" : df.format(value.getTime()));
     }
@@ -330,8 +329,8 @@ public final class Debug {
             debug(message, (int[]) value);
         } else if (value instanceof String) {
             debug(message, (String) value);
-        } else if (value instanceof java.util.List) {
-            debug(message, (java.util.List<?>) value);
+        } else if (value instanceof List) {
+            debug(message, (List<?>) value);
         } else if (value instanceof Map) {
             debug(message, (Map<?, ?>) value);
         // } else if (value instanceof Object) {
@@ -390,8 +389,8 @@ public final class Debug {
             return getDebug(message, (char[]) value);
         } else if (value instanceof int[]) {
             return getDebug(message, (int[]) value);
-        } else if (value instanceof java.util.List) {
-            return getDebug(message, (java.util.List<?>) value);
+        } else if (value instanceof List) {
+            return getDebug(message, (List<?>) value);
         } else {
             return getDebug(message, value.toString());
         }
@@ -490,12 +489,12 @@ public final class Debug {
     }
 
     public static void debug(final String message, final Calendar value) {
-        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
         debug(message, (value == null) ? "null" : df.format(value.getTime()));
     }
 
     public static void debug(final String message, final Date value) {
-        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+        final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
         debug(message, (value == null) ? "null" : df.format(value));
     }
 
@@ -537,7 +536,7 @@ public final class Debug {
         debug(getDebug(message, v, max));
     }
 
-    public static void debug(final String message, final java.util.List<?> v) {
+    public static void debug(final String message, final List<?> v) {
         final String suffix = " [" + counter++ + "]";
 
         debug(message + " (" + v.size() + ")" + suffix);
@@ -596,7 +595,7 @@ public final class Debug {
         final StringBuilder result = new StringBuilder();
 
         final SimpleDateFormat timestamp = new SimpleDateFormat(
-                "yyyy-MM-dd kk:mm:ss:SSS");
+                "yyyy-MM-dd kk:mm:ss:SSS", Locale.ENGLISH);
         final String datetime = timestamp.format(new Date()).toLowerCase();
 
         result.append(newline);
@@ -692,8 +691,8 @@ public final class Debug {
             final double aspect_ratio = ((double) r.width) / ((double) r.height);
             final double aspect_ratio2 = 1.0 / aspect_ratio;
 
-            s_ar1 = "" + aspect_ratio;
-            s_ar2 = "" + aspect_ratio2;
+            s_ar1 = Double.toString(aspect_ratio);
+            s_ar2 = Double.toString(aspect_ratio2);
 
             if (s_ar1.length() > 7) {
                 s_ar1 = s_ar1.substring(0, 7);
@@ -720,8 +719,8 @@ public final class Debug {
             final double aspect_ratio = ((double) r.width) / ((double) r.height);
             final double aspect_ratio2 = 1.0 / aspect_ratio;
 
-            s_ar1 = "" + aspect_ratio;
-            s_ar2 = "" + aspect_ratio2;
+            s_ar1 = Double.toString(aspect_ratio);
+            s_ar2 = Double.toString(aspect_ratio2);
 
             if (s_ar1.length() > 7) {
                 s_ar1 = s_ar1.substring(0, 7);
@@ -790,14 +789,14 @@ public final class Debug {
             for (int i = 0; i < array.length; i++) {
                 debug(prefix + "\t" + i + ": ", array[i]);
             }
-        } else if (value instanceof java.util.List) {
-            final java.util.List<?> list = (java.util.List<?>) value;
+        } else if (value instanceof List) {
+            final List<?> list = (List<?>) value;
             debug(prefix, "list");
             for (int i = 0; i < list.size(); i++) {
                 dump(prefix + "\t" + "list: " + i + ": ", list.get(i));
             }
         } else if (value instanceof Map) {
-            final java.util.Map<?,?> map = (java.util.Map<?,?>) value;
+            final Map<?,?> map = (Map<?,?>) value;
             debug(prefix, "map");
             for (final Map.Entry<?,?> entry : map.entrySet()) {
                 dump(prefix + "\t" + "map: " + entry.getKey() + " -> ", entry.getValue());

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/IoUtils.java Sat Nov 23 17:19:36 2013
@@ -31,7 +31,7 @@ import java.nio.channels.FileChannel;
 
 import org.apache.commons.imaging.ImagingConstants;
 
-public class IoUtils implements ImagingConstants {
+public final class IoUtils implements ImagingConstants {
     public static void closeQuietly(final boolean mayThrow, final Closeable... closeables)
             throws IOException {
         IOException firstException = null;
@@ -51,7 +51,7 @@ public class IoUtils implements ImagingC
         }
     }
     
-    public static final boolean copyFileNio(final File src, final File dst)
+    public static boolean copyFileNio(final File src, final File dst)
             throws IOException {
         FileChannel srcChannel = null, dstChannel = null;
         boolean canThrow = false;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/ParamMap.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/ParamMap.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/ParamMap.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/ParamMap.java Sat Nov 23 17:19:36 2013
@@ -19,13 +19,15 @@ package org.apache.commons.imaging.util;
 
 import java.util.Map;
 
-public class ParamMap {
-
+public final class ParamMap {
+    private ParamMap() {
+    }
+    
     public static boolean getParamBoolean(final Map<String,Object> params, final Object key,
             final boolean default_value) {
         boolean result = default_value;
         final Object o = params == null ? null : params.get(key);
-        if (o != null && o instanceof Boolean) {
+        if (o instanceof Boolean) {
             result = ((Boolean) o).booleanValue();
         }
         return result;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java?rev=1544840&r1=1544839&r2=1544840&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/UnicodeUtils.java Sat Nov 23 17:19:36 2013
@@ -19,14 +19,14 @@ package org.apache.commons.imaging.util;
 
 import java.io.UnsupportedEncodingException;
 
-public abstract class UnicodeUtils {
+public final class UnicodeUtils {
     /**
      * This class should never be instantiated.
      */
     private UnicodeUtils() {
     }
 
-    public static final boolean isValidISO_8859_1(final String s) {
+    public static boolean isValidISO_8859_1(final String s) {
         try {
             final String roundtrip = new String(s.getBytes("ISO-8859-1"),
                     "ISO-8859-1");



Mime
View raw message