commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1417043 [21/21] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/ main/java/org/apache/commons/imaging/color/ main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/bytesource/ ...
Date Tue, 04 Dec 2012 17:24:32 GMT
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
Tue Dec  4 17:23:16 2012
@@ -32,31 +32,31 @@ import org.apache.commons.imaging.util.D
 public class TiffRoundtripTest extends TiffBaseTest {
 
     public void test() throws Exception {
-        List<File> images = getTiffImages();
+        final List<File> images = getTiffImages();
         for (int i = 0; i < images.size(); i++) {
             if (i % 10 == 0) {
                 Debug.purgeMemory();
             }
 
-            File imageFile = images.get(i);
+            final File imageFile = images.get(i);
             Debug.debug("imageFile", imageFile);
 
-            IImageMetadata metadata = Imaging.getMetadata(imageFile);
+            final IImageMetadata metadata = Imaging.getMetadata(imageFile);
             assertNotNull(metadata);
 
-            ImageInfo imageInfo = Imaging.getImageInfo(imageFile);
+            final ImageInfo imageInfo = Imaging.getImageInfo(imageFile);
             assertNotNull(imageInfo);
 
             BufferedImage image = Imaging.getBufferedImage(imageFile);
             assertNotNull(image);
 
-            File tempFile = createTempFile(imageFile.getName() + ".", ".tif");
-            Map<String,Object> params = new HashMap<String,Object>();
+            final File tempFile = createTempFile(imageFile.getName() + ".", ".tif");
+            final Map<String,Object> params = new HashMap<String,Object>();
             Imaging.writeImage(image, tempFile, ImageFormat.IMAGE_FORMAT_TIFF,
                     params);
             image = null;
 
-            BufferedImage image2 = Imaging.getBufferedImage(tempFile);
+            final BufferedImage image2 = Imaging.getBufferedImage(tempFile);
             assertNotNull(image2);
         }
     }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffTagIntegrityTest.java
Tue Dec  4 17:23:16 2012
@@ -74,11 +74,11 @@ public class TiffTagIntegrityTest extend
         verifyFields(WangTagConstants.class, WangTagConstants.ALL_WANG_TAGS);
     }
 
-    private void verifyFields(Class<?> cls, List<TagInfo> tags) {
-        Field[] fields = cls.getFields();
+    private void verifyFields(final Class<?> cls, final List<TagInfo> tags) {
+        final Field[] fields = cls.getFields();
         int tagCount = 0;
         int foundCount = 0;
-        for (Field field : fields) {
+        for (final Field field : fields) {
             field.setAccessible(true);
             if (!(field.getType().isInstance(TagInfo.class))) {
                 continue;
@@ -87,13 +87,13 @@ public class TiffTagIntegrityTest extend
             TagInfo src = null;
             try {
                 src = (TagInfo) field.get(null);
-            } catch (IllegalAccessException illegalAccess) {
+            } catch (final IllegalAccessException illegalAccess) {
             }
             if (src == null) {
                 continue;
             }
             for (int i = 0; i < tags.size(); i++) {
-                TagInfo tagInfo = tags.get(i);
+                final TagInfo tagInfo = tags.get(i);
                 if (tagInfo.tag == src.tag) {
                     ++foundCount;
                     break;

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpBaseTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpBaseTest.java
Tue Dec  4 17:23:16 2012
@@ -23,12 +23,12 @@ import org.apache.commons.imaging.ImageR
 import org.apache.commons.imaging.ImagingTest;
 
 public abstract class WbmpBaseTest extends ImagingTest {
-    private static boolean isWbmp(File file) {
+    private static boolean isWbmp(final File file) {
         return file.getName().toLowerCase().endsWith(".wbmp");
     }
 
     private static final ImageFilter IMAGE_FILTER = new ImageFilter() {
-        public boolean accept(File file) throws IOException, ImageReadException {
+        public boolean accept(final File file) throws IOException, ImageReadException {
             return isWbmp(file);
         }
     };

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
Tue Dec  4 17:23:16 2012
@@ -31,23 +31,23 @@ public class WbmpReadTest extends WbmpBa
     public void test() throws Exception {
         Debug.debug("start");
 
-        List<File> images = getWbmpImages();
+        final List<File> images = getWbmpImages();
         for (int i = 0; i < images.size(); i++) {
             if (i % 10 == 0) {
                 Debug.purgeMemory();
             }
 
-            File imageFile = images.get(i);
+            final File imageFile = images.get(i);
             Debug.debug("imageFile", imageFile);
 
-            IImageMetadata metadata = Imaging.getMetadata(imageFile);
+            final IImageMetadata metadata = Imaging.getMetadata(imageFile);
             // assertNotNull(metadata);
 
-            Map<String,Object> params = new HashMap<String,Object>();
-            ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
+            final Map<String,Object> params = new HashMap<String,Object>();
+            final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 
-            BufferedImage image = Imaging.getBufferedImage(imageFile);
+            final BufferedImage image = Imaging.getBufferedImage(imageFile);
             assertNotNull(image);
         }
     }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmBaseTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmBaseTest.java
Tue Dec  4 17:23:16 2012
@@ -24,12 +24,12 @@ import org.apache.commons.imaging.Imagin
 
 public abstract class XbmBaseTest extends ImagingTest {
 
-    private static boolean isXbm(File file) {
+    private static boolean isXbm(final File file) {
         return file.getName().toLowerCase().endsWith(".xbm");
     }
 
     private static final ImageFilter IMAGE_FILTER = new ImageFilter() {
-        public boolean accept(File file) throws IOException, ImageReadException {
+        public boolean accept(final File file) throws IOException, ImageReadException {
             return isXbm(file);
         }
     };

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
Tue Dec  4 17:23:16 2012
@@ -31,23 +31,23 @@ public class XbmReadTest extends XbmBase
     public void test() throws Exception {
         Debug.debug("start");
 
-        List<File> images = getXbmImages();
+        final List<File> images = getXbmImages();
         for (int i = 0; i < images.size(); i++) {
             if (i % 10 == 0) {
                 Debug.purgeMemory();
             }
 
-            File imageFile = images.get(i);
+            final File imageFile = images.get(i);
             Debug.debug("imageFile", imageFile);
 
-            IImageMetadata metadata = Imaging.getMetadata(imageFile);
+            final IImageMetadata metadata = Imaging.getMetadata(imageFile);
             // assertNotNull(metadata);
 
-            Map<String,Object> params = new HashMap<String,Object>();
-            ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
+            final Map<String,Object> params = new HashMap<String,Object>();
+            final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 
-            BufferedImage image = Imaging.getBufferedImage(imageFile);
+            final BufferedImage image = Imaging.getBufferedImage(imageFile);
             assertNotNull(image);
         }
     }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpDumpTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpDumpTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpDumpTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpDumpTest.java
Tue Dec  4 17:23:16 2012
@@ -27,13 +27,13 @@ import org.apache.commons.imaging.util.D
 public class XmpDumpTest extends ImagingTest {
 
     public void test() throws Exception {
-        List<File> images = getTestImages();
+        final List<File> images = getTestImages();
         for (int i = 0; i < images.size(); i++) {
             if (i % 10 == 0) {
                 Debug.purgeMemory();
             }
 
-            File imageFile = images.get(i);
+            final File imageFile = images.get(i);
 
             if (imageFile.getName().toLowerCase().endsWith(".png")
                     && isInvalidPNGTestFile(imageFile)) {
@@ -43,7 +43,7 @@ public class XmpDumpTest extends Imaging
             Debug.debug("imageFile", imageFile);
             Debug.debug();
 
-            String xmpXml = Imaging.getXmpXml(imageFile);
+            final String xmpXml = Imaging.getXmpXml(imageFile);
             if (null == xmpXml) {
                 continue;
             }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java
Tue Dec  4 17:23:16 2012
@@ -31,13 +31,13 @@ import org.apache.commons.imaging.util.D
 public class XmpUpdateTest extends ImagingTest {
 
     public void test() throws Exception {
-        List<File> images = getTestImages();
+        final List<File> images = getTestImages();
         for (int i = 0; i < images.size(); i++) {
             if (i % 10 == 0) {
                 Debug.purgeMemory();
             }
 
-            File imageFile = images.get(i);
+            final File imageFile = images.get(i);
 
             if (imageFile.getName().toLowerCase().endsWith(".png")
                     && isInvalidPNGTestFile(imageFile)) {
@@ -47,7 +47,7 @@ public class XmpUpdateTest extends Imagi
             Debug.debug("imageFile", imageFile);
             Debug.debug();
 
-            ImageFormat imageFormat = Imaging.guessFormat(imageFile);
+            final ImageFormat imageFormat = Imaging.guessFormat(imageFile);
 
             String xmpXml = Imaging.getXmpXml(imageFile);
             if (null == xmpXml
@@ -76,17 +76,17 @@ public class XmpUpdateTest extends Imagi
                 continue;
             }
 
-            File tempFile = this.createTempFile(imageFile.getName() + ".", "."
+            final File tempFile = this.createTempFile(imageFile.getName() + ".", "."
                     + imageFormat.getExtension());
-            BufferedImage image = Imaging.getBufferedImage(imageFile);
+            final BufferedImage image = Imaging.getBufferedImage(imageFile);
 
             // ----
 
-            Map<String,Object> params = new HashMap<String,Object>();
+            final Map<String,Object> params = new HashMap<String,Object>();
             params.put(PARAM_KEY_XMP_XML, xmpXml);
             Imaging.writeImage(image, tempFile, imageFormat, params);
 
-            String xmpXmlOut = Imaging.getXmpXml(tempFile);
+            final String xmpXmlOut = Imaging.getXmpXml(tempFile);
 
             assertNotNull(xmpXmlOut);
 

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmBaseTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmBaseTest.java
Tue Dec  4 17:23:16 2012
@@ -24,12 +24,12 @@ import org.apache.commons.imaging.Imagin
 
 public abstract class XpmBaseTest extends ImagingTest {
 
-    private static boolean isXpm(File file) {
+    private static boolean isXpm(final File file) {
         return file.getName().toLowerCase().endsWith(".xpm");
     }
 
     private static final ImageFilter IMAGE_FILTER = new ImageFilter() {
-        public boolean accept(File file) throws IOException, ImageReadException {
+        public boolean accept(final File file) throws IOException, ImageReadException {
             return isXpm(file);
         }
     };

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java
Tue Dec  4 17:23:16 2012
@@ -31,23 +31,23 @@ public class XpmReadTest extends XpmBase
     public void test() throws Exception {
         Debug.debug("start");
 
-        List<File> images = getXpmImages();
+        final List<File> images = getXpmImages();
         for (int i = 0; i < images.size(); i++) {
             if (i % 10 == 0) {
                 Debug.purgeMemory();
             }
 
-            File imageFile = images.get(i);
+            final File imageFile = images.get(i);
             Debug.debug("imageFile", imageFile);
 
-            IImageMetadata metadata = Imaging.getMetadata(imageFile);
+            final IImageMetadata metadata = Imaging.getMetadata(imageFile);
             // assertNotNull(metadata);
 
-            Map<String,Object> params = new HashMap<String,Object>();
-            ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
+            final Map<String,Object> params = new HashMap<String,Object>();
+            final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
             assertNotNull(imageInfo);
 
-            BufferedImage image = Imaging.getBufferedImage(imageFile);
+            final BufferedImage image = Imaging.getBufferedImage(imageFile);
             assertNotNull(image);
         }
     }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
Tue Dec  4 17:23:16 2012
@@ -50,8 +50,8 @@ public class RoundtripTest extends Imagi
         public final boolean identicalSecondWrite;
         public final boolean preservesResolution;
 
-        public FormatInfo(ImageFormat format, boolean canRead,
-                boolean canWrite, int colorSupport,
+        public FormatInfo(final ImageFormat format, final boolean canRead,
+                final boolean canWrite, final int colorSupport,
                 final boolean identicalSecondWrite,
                 final boolean preservesResolution) {
             this.canRead = canRead;
@@ -102,41 +102,41 @@ public class RoundtripTest extends Imagi
                     COLOR_FULL_RGB, false, false), //
     };
 
-    private BufferedImage createArgbBitmapImage(int width, int height) {
-        BufferedImage result = new BufferedImage(width, height,
+    private BufferedImage createArgbBitmapImage(final int width, final int height) {
+        final BufferedImage result = new BufferedImage(width, height,
                 BufferedImage.TYPE_INT_ARGB);
         for (int x = 0; x < width; x++) {
             for (int y = 0; y < height; y++) {
                 // alternating black and white.
-                int modulator = y + 2; // make sure lines vary.
-                int argb = (x + y) % modulator == 0 ? 0xff000000 : 0xffffffff;
+                final int modulator = y + 2; // make sure lines vary.
+                final int argb = (x + y) % modulator == 0 ? 0xff000000 : 0xffffffff;
                 result.setRGB(x, y, argb);
             }
         }
         return result;
     }
 
-    private BufferedImage createBitmapBitmapImage(int width, int height) {
-        BufferedImage result = new BufferedImage(width, height,
+    private BufferedImage createBitmapBitmapImage(final int width, final int height) {
+        final BufferedImage result = new BufferedImage(width, height,
                 BufferedImage.TYPE_BYTE_BINARY);
         for (int x = 0; x < width; x++) {
             for (int y = 0; y < height; y++) {
                 // alternating black and white.
-                int modulator = y + 2; // make sure lines vary.
-                int argb = (x + y) % modulator == 0 ? 0xff000000 : 0xffffffff;
+                final int modulator = y + 2; // make sure lines vary.
+                final int argb = (x + y) % modulator == 0 ? 0xff000000 : 0xffffffff;
                 result.setRGB(x, y, argb);
             }
         }
         return result;
     }
 
-    private BufferedImage createArgbGrayscaleImage(int width, int height) {
-        BufferedImage result = new BufferedImage(width, height,
+    private BufferedImage createArgbGrayscaleImage(final int width, final int height) {
+        final BufferedImage result = new BufferedImage(width, height,
                 BufferedImage.TYPE_INT_ARGB);
         for (int x = 0; x < width; x++) {
             for (int y = 0; y < height; y++) {
-                int value = (256 * (x + y)) / (width + height);
-                int argb = (0xff << 24) | (value << 16) | (value << 8)
+                final int value = (256 * (x + y)) / (width + height);
+                final int argb = (0xff << 24) | (value << 16) | (value <<
8)
                         | (value << 0);
 
                 result.setRGB(x, y, argb);
@@ -145,13 +145,13 @@ public class RoundtripTest extends Imagi
         return result;
     }
 
-    private BufferedImage createGrayscaleGrayscaleImage(int width, int height) {
-        BufferedImage result = new BufferedImage(width, height,
+    private BufferedImage createGrayscaleGrayscaleImage(final int width, final int height)
{
+        final BufferedImage result = new BufferedImage(width, height,
                 BufferedImage.TYPE_BYTE_GRAY);
         for (int x = 0; x < width; x++) {
             for (int y = 0; y < height; y++) {
-                int value = (256 * (x + y)) / (width + height);
-                int argb = (0xff << 24) | (value << 16) | (value << 8)
+                final int value = (256 * (x + y)) / (width + height);
+                final int argb = (0xff << 24) | (value << 16) | (value <<
8)
                         | (value << 0);
 
                 result.setRGB(x, y, argb);
@@ -160,30 +160,30 @@ public class RoundtripTest extends Imagi
         return result;
     }
 
-    private BufferedImage createLimitedColorImage(int width, int height) {
-        int colors[] = { 0xffffffff, 0xff000000, 0xfff00000, 0xff0000ff,
+    private BufferedImage createLimitedColorImage(final int width, final int height) {
+        final int colors[] = { 0xffffffff, 0xff000000, 0xfff00000, 0xff0000ff,
                 0xff123456, 0xfffefeff, 0xff7f817f, };
 
-        BufferedImage result = new BufferedImage(width, height,
+        final BufferedImage result = new BufferedImage(width, height,
                 BufferedImage.TYPE_INT_ARGB);
         for (int x = 0; x < width; x++) {
             for (int y = 0; y < height; y++) {
-                int argb = colors[(x + y) % colors.length];
+                final int argb = colors[(x + y) % colors.length];
                 result.setRGB(x, y, argb);
             }
         }
         return result;
     }
 
-    private BufferedImage createFullColorImage(int width, int height) {
-        BufferedImage result = new BufferedImage(width, height,
+    private BufferedImage createFullColorImage(final int width, final int height) {
+        final BufferedImage result = new BufferedImage(width, height,
                 BufferedImage.TYPE_INT_ARGB);
         for (int x = 0; x < width; x++) {
             for (int y = 0; y < height; y++) {
-                int red = (x * 255) / width;
-                int green = (y * 255) / height;
-                int blue = ((x + y) * 255) / (width + height);
-                int argb = (0xff << 24) | (red << 16) | (green << 8)
+                final int red = (x * 255) / width;
+                final int green = (y * 255) / height;
+                final int blue = ((x + y) * 255) / (width + height);
+                final int argb = (0xff << 24) | (red << 16) | (green <<
8)
                         | (blue << 0);
                 result.setRGB(x, y, argb);
             }
@@ -191,7 +191,7 @@ public class RoundtripTest extends Imagi
         return result;
     }
 
-    private void compareImagesExact(BufferedImage a, BufferedImage b) {
+    private void compareImagesExact(final BufferedImage a, final BufferedImage b) {
         compareImages(a, b, 0);
     }
 
@@ -200,14 +200,14 @@ public class RoundtripTest extends Imagi
     // compareImages(a, b, 3); // one bit of rounding error for each channel
     // }
 
-    private void compareImages(BufferedImage a, BufferedImage b, int tolerance) {
+    private void compareImages(final BufferedImage a, final BufferedImage b, final int tolerance)
{
         assertEquals(a.getWidth(), b.getWidth());
         assertEquals(a.getHeight(), b.getHeight());
 
         for (int x = 0; x < a.getWidth(); x++) {
             for (int y = 0; y < a.getHeight(); y++) {
-                int a_argb = a.getRGB(x, y);
-                int b_argb = b.getRGB(x, y);
+                final int a_argb = a.getRGB(x, y);
+                final int b_argb = b.getRGB(x, y);
                 if (a_argb != b_argb) {
                     if (calculateARGBDistance(a_argb, b_argb) <= tolerance)
                      {
@@ -231,32 +231,32 @@ public class RoundtripTest extends Imagi
         }
     }
 
-    private int calculateARGBDistance(int a, int b) {
-        int aAlpha = 0xff & (a >> 24);
-        int aRed = 0xff & (a >> 16);
-        int aGreen = 0xff & (a >> 8);
-        int aBlue = 0xff & (a >> 0);
-        int bAlpha = 0xff & (b >> 24);
-        int bRed = 0xff & (b >> 16);
-        int bGreen = 0xff & (b >> 8);
-        int bBlue = 0xff & (b >> 0);
-        int diff = Math.abs(aAlpha - bAlpha) + Math.abs(aRed - bRed)
+    private int calculateARGBDistance(final int a, final int b) {
+        final int aAlpha = 0xff & (a >> 24);
+        final int aRed = 0xff & (a >> 16);
+        final int aGreen = 0xff & (a >> 8);
+        final int aBlue = 0xff & (a >> 0);
+        final int bAlpha = 0xff & (b >> 24);
+        final int bRed = 0xff & (b >> 16);
+        final int bGreen = 0xff & (b >> 8);
+        final int bBlue = 0xff & (b >> 0);
+        final int diff = Math.abs(aAlpha - bAlpha) + Math.abs(aRed - bRed)
                 + Math.abs(aGreen - bGreen) + Math.abs(aBlue - bBlue);
         return diff;
 
     }
 
-    private void compareFilesExact(File a, File b) throws IOException {
+    private void compareFilesExact(final File a, final File b) throws IOException {
         assertTrue(a.exists() && a.isFile());
         assertTrue(b.exists() && b.isFile());
         assertEquals(a.length(), b.length());
 
-        byte aData[] = IoUtils.getFileBytes(a);
-        byte bData[] = IoUtils.getFileBytes(b);
+        final byte aData[] = IoUtils.getFileBytes(a);
+        final byte bData[] = IoUtils.getFileBytes(b);
 
         for (int i = 0; i < a.length(); i++) {
-            int aByte = 0xff & aData[i];
-            int bByte = 0xff & bData[i];
+            final int aByte = 0xff & aData[i];
+            final int bByte = 0xff & bData[i];
 
             if (aByte != bByte) {
                 Debug.debug("a", a);
@@ -272,7 +272,7 @@ public class RoundtripTest extends Imagi
     }
 
     public void testBitmapRoundtrip() throws Exception {
-        BufferedImage testImages[] = { //
+        final BufferedImage testImages[] = { //
 
         createArgbBitmapImage(1, 1), // minimal
                 createArgbBitmapImage(2, 2), //
@@ -285,9 +285,9 @@ public class RoundtripTest extends Imagi
                 createBitmapBitmapImage(300, 300), // larger than 256
         };
 
-        for (BufferedImage testImage : testImages) {
-            for (FormatInfo element : FORMAT_INFOS) {
-                FormatInfo formatInfo = element;
+        for (final BufferedImage testImage : testImages) {
+            for (final FormatInfo element : FORMAT_INFOS) {
+                final FormatInfo formatInfo = element;
                 if ((!formatInfo.canRead) || (!formatInfo.canWrite)) {
                     continue;
                 }
@@ -300,7 +300,7 @@ public class RoundtripTest extends Imagi
     }
 
     public void testGrayscaleRoundtrip() throws Exception {
-        BufferedImage testImages[] = { //
+        final BufferedImage testImages[] = { //
 
         createArgbBitmapImage(1, 1), // minimal
                 createArgbGrayscaleImage(2, 2), //
@@ -313,9 +313,9 @@ public class RoundtripTest extends Imagi
                 createGrayscaleGrayscaleImage(300, 300), // larger than 256
         };
 
-        for (BufferedImage testImage : testImages) {
-            for (FormatInfo element : FORMAT_INFOS) {
-                FormatInfo formatInfo = element;
+        for (final BufferedImage testImage : testImages) {
+            for (final FormatInfo element : FORMAT_INFOS) {
+                final FormatInfo formatInfo = element;
                 if ((!formatInfo.canRead) || (!formatInfo.canWrite)) {
                     continue;
                 }
@@ -333,7 +333,7 @@ public class RoundtripTest extends Imagi
     }
 
     public void testLimitedColorRoundtrip() throws Exception {
-        BufferedImage testImages[] = { //
+        final BufferedImage testImages[] = { //
 
         createLimitedColorImage(1, 1), // minimal
                 createLimitedColorImage(2, 2), //
@@ -341,9 +341,9 @@ public class RoundtripTest extends Imagi
                 createLimitedColorImage(300, 300), // larger than 256
         };
 
-        for (BufferedImage testImage : testImages) {
-            for (FormatInfo element : FORMAT_INFOS) {
-                FormatInfo formatInfo = element;
+        for (final BufferedImage testImage : testImages) {
+            for (final FormatInfo element : FORMAT_INFOS) {
+                final FormatInfo formatInfo = element;
                 if ((!formatInfo.canRead) || (!formatInfo.canWrite)) {
                     continue;
                 }
@@ -364,7 +364,7 @@ public class RoundtripTest extends Imagi
     }
 
     public void testFullColorRoundtrip() throws Exception {
-        BufferedImage testImages[] = { //
+        final BufferedImage testImages[] = { //
 
         createFullColorImage(1, 1), // minimal
                 createFullColorImage(2, 2), //
@@ -372,9 +372,9 @@ public class RoundtripTest extends Imagi
                 createFullColorImage(300, 300), // larger than 256
         };
 
-        for (BufferedImage testImage : testImages) {
-            for (FormatInfo element : FORMAT_INFOS) {
-                FormatInfo formatInfo = element;
+        for (final BufferedImage testImage : testImages) {
+            for (final FormatInfo element : FORMAT_INFOS) {
+                final FormatInfo formatInfo = element;
                 if ((!formatInfo.canRead) || (!formatInfo.canWrite)) {
                     continue;
                 }
@@ -399,28 +399,28 @@ public class RoundtripTest extends Imagi
     
     public void testPixelDensityRoundtrip() throws IOException,
             ImageReadException, ImageWriteException {
-        BufferedImage testImage = createFullColorImage(2, 2);
-        for (FormatInfo formatInfo : FORMAT_INFOS) {
+        final BufferedImage testImage = createFullColorImage(2, 2);
+        for (final FormatInfo formatInfo : FORMAT_INFOS) {
             if (!formatInfo.canRead || !formatInfo.canWrite || !formatInfo.preservesResolution)
{
                 continue;
             }
             
             Debug.debug("pixel density test: " + formatInfo.format.getName());
 
-            File temp1 = createTempFile("pixeldensity.", "."
+            final File temp1 = createTempFile("pixeldensity.", "."
                     + formatInfo.format.getExtension());
             
-            Map<String,Object> params = new HashMap<String,Object>();
-            PixelDensity pixelDensity = PixelDensity.createFromPixelsPerInch(75, 150);
+            final Map<String,Object> params = new HashMap<String,Object>();
+            final PixelDensity pixelDensity = PixelDensity.createFromPixelsPerInch(75, 150);
             params.put(ImagingConstants.PARAM_KEY_PIXEL_DENSITY, pixelDensity);
             Imaging.writeImage(testImage, temp1, formatInfo.format, params);
             
-            ImageInfo imageInfo = Imaging.getImageInfo(temp1);
+            final ImageInfo imageInfo = Imaging.getImageInfo(temp1);
             if (imageInfo == null) {
                 continue;
             }
-            int xReadDPI = imageInfo.getPhysicalWidthDpi();
-            int yReadDPI = imageInfo.getPhysicalHeightDpi();
+            final int xReadDPI = imageInfo.getPhysicalWidthDpi();
+            final int yReadDPI = imageInfo.getPhysicalHeightDpi();
             // allow a 5% margin of error in storage and conversion
             assertTrue("horizontal pixel density stored wrongly for " + formatInfo.format
+
                     " in=" + pixelDensity.horizontalDensityInches() + ", out=" + xReadDPI,
@@ -433,20 +433,20 @@ public class RoundtripTest extends Imagi
         }
     }
 
-    private void roundtrip(FormatInfo formatInfo, BufferedImage testImage,
-            String tempPrefix, boolean imageExact) throws IOException,
+    private void roundtrip(final FormatInfo formatInfo, final BufferedImage testImage,
+            final String tempPrefix, final boolean imageExact) throws IOException,
             ImageReadException, ImageWriteException {
-        File temp1 = createTempFile(tempPrefix + ".", "."
+        final File temp1 = createTempFile(tempPrefix + ".", "."
                 + formatInfo.format.getExtension());
         Debug.debug("tempFile: " + temp1.getName());
 
-        Map<String,Object> params = new HashMap<String,Object>();
+        final Map<String,Object> params = new HashMap<String,Object>();
         Imaging.writeImage(testImage, temp1, formatInfo.format, params);
 
-        Map<String,Object> readParams = new HashMap<String,Object>();
+        final Map<String,Object> readParams = new HashMap<String,Object>();
         readParams.put(ImagingConstants.BUFFERED_IMAGE_FACTORY,
                 new RgbBufferedImageFactory());
-        BufferedImage image2 = Imaging.getBufferedImage(temp1, readParams);
+        final BufferedImage image2 = Imaging.getBufferedImage(temp1, readParams);
         assertNotNull(image2);
 
         if (imageExact) {
@@ -456,7 +456,7 @@ public class RoundtripTest extends Imagi
         }
 
         if (formatInfo.identicalSecondWrite) {
-            File temp2 = createTempFile(tempPrefix + ".", "."
+            final File temp2 = createTempFile(tempPrefix + ".", "."
                     + formatInfo.format.getExtension());
             // Debug.debug("tempFile: " + tempFile.getName());
             Imaging.writeImage(image2, temp2, formatInfo.format, params);

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/test/util/FileSystemTraversal.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/test/util/FileSystemTraversal.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/test/util/FileSystemTraversal.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/test/util/FileSystemTraversal.java
Tue Dec  4 17:23:16 2012
@@ -32,27 +32,27 @@ public class FileSystemTraversal {
         public boolean visit(File file, double progressEstimate);
     }
 
-    public boolean traverseFiles(File file, Visitor visitor) {
+    public boolean traverseFiles(final File file, final Visitor visitor) {
 
         return traverse(file, MODE_FILES, visitor);
     }
 
-    public boolean traverseFolders(File file, Visitor visitor) {
+    public boolean traverseFolders(final File file, final Visitor visitor) {
 
         return traverse(file, MODE_FOLDERS, visitor);
     }
 
-    public boolean traverseAll(File file, Visitor visitor) {
+    public boolean traverseAll(final File file, final Visitor visitor) {
 
         return traverse(file, MODE_FILES_AND_FOLDERS, visitor);
     }
 
-    public boolean traverse(File file, int mode, Visitor visitor) {
+    public boolean traverse(final File file, final int mode, final Visitor visitor) {
         return traverse(file, mode, visitor, 0, 1);
     }
 
-    private boolean traverse(File file, int mode, Visitor visitor,
-            double estimate, double estimateIncrement) {
+    private boolean traverse(final File file, final int mode, final Visitor visitor,
+            final double estimate, final double estimateIncrement) {
 
         if (file.isFile()) {
             if ((mode == MODE_FILES) || (mode == MODE_FILES_AND_FOLDERS)
@@ -62,12 +62,12 @@ public class FileSystemTraversal {
                 }
             }
         } else if (file.isDirectory()) {
-            File files[] = file.listFiles();
+            final File files[] = file.listFiles();
             if (files != null) {
                 for (int i = 0; i < files.length; i++) {
-                    File child = files[i];
+                    final File child = files[i];
                     if (ON_MAC_OS_X && child.isDirectory()) {
-                        String name = child.getName();
+                        final String name = child.getName();
                         if (name.equalsIgnoreCase("automount")
                                 || name.equalsIgnoreCase("private")
                                 || name.equalsIgnoreCase("Network")
@@ -102,22 +102,22 @@ public class FileSystemTraversal {
         return true;
     }
 
-    public boolean traverseFiles(Visitor visitor) {
+    public boolean traverseFiles(final Visitor visitor) {
 
         return traverse(MODE_FILES, visitor);
     }
 
-    public boolean traverseFolders(Visitor visitor) {
+    public boolean traverseFolders(final Visitor visitor) {
 
         return traverse(MODE_FOLDERS, visitor);
     }
 
-    public boolean traverseAll(Visitor visitor) {
+    public boolean traverseAll(final Visitor visitor) {
 
         return traverse(MODE_FILES_AND_FOLDERS, visitor);
     }
 
-    public boolean traverse(int mode, Visitor visitor) {
+    public boolean traverse(final int mode, final Visitor visitor) {
         return traverse(mode, visitor, 0, 1);
     }
 
@@ -126,19 +126,19 @@ public class FileSystemTraversal {
     static {
         try {
             ON_MAC_OS_X = (System.getProperty("mrj.version") != null);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             Debug.debug(e);
 
             ON_MAC_OS_X = false;
         }
     }
 
-    private boolean traverse(int mode, Visitor visitor, double estimate,
-            double estimateIncrement) {
+    private boolean traverse(final int mode, final Visitor visitor, final double estimate,
+            final double estimateIncrement) {
         File roots[] = File.listRoots();
 
         if (ON_MAC_OS_X) {
-            File Volumes = new File("/Volumes/");
+            final File Volumes = new File("/Volumes/");
             roots = Volumes.listFiles();
         } else {
             roots = File.listRoots();
@@ -149,7 +149,7 @@ public class FileSystemTraversal {
         }
 
         for (int i = 0; i < roots.length; i++) {
-            File root = roots[i];
+            final File root = roots[i];
 
             if (root == null || !root.exists()) {
                 continue;



Mime
View raw message