You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/12/04 18:24:32 UTC
svn commit: r1417043 [20/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/ ...
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java Tue Dec 4 17:23:16 2012
@@ -56,28 +56,28 @@ public class IptcUpdateTest extends Iptc
* Remove all Photoshop IPTC data from a JPEG file.
*/
public void testRemove() throws Exception {
- List<File> images = imagesWithIptcData;
+ final List<File> images = imagesWithIptcData;
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);
// Debug.debug();
- ByteSource byteSource = new ByteSourceFile(imageFile);
+ final ByteSource byteSource = new ByteSourceFile(imageFile);
- Map<String,Object> params = new HashMap<String,Object>();
- boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+ final Map<String,Object> params = new HashMap<String,Object>();
+ final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
- JpegPhotoshopMetadata metadata = new JpegImageParser()
+ final JpegPhotoshopMetadata metadata = new JpegImageParser()
.getPhotoshopMetadata(byteSource, params);
assertNotNull(metadata);
// metadata.dump();
- File noIptcFile = createTempFile(imageFile.getName()
+ final File noIptcFile = createTempFile(imageFile.getName()
+ ".iptc.remove.", ".jpg");
{
// test remove
@@ -94,7 +94,7 @@ public class IptcUpdateTest extends Iptc
os = null;
}
- JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+ final JpegPhotoshopMetadata outMetadata = new JpegImageParser()
.getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
params);
assertTrue(outMetadata == null
@@ -105,32 +105,32 @@ public class IptcUpdateTest extends Iptc
}
public void testRemoveInsertUpdate() throws Exception {
- List<File> images = imagesWithIptcData;
+ final List<File> images = imagesWithIptcData;
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);
Debug.debug();
- ByteSource byteSource = new ByteSourceFile(imageFile);
+ final ByteSource byteSource = new ByteSourceFile(imageFile);
// Debug.debug("Segments:");
// new JpegUtils().dumpJFIF(byteSource);
- Map<String,Object> params = new HashMap<String,Object>();
- boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+ final Map<String,Object> params = new HashMap<String,Object>();
+ final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
- JpegPhotoshopMetadata metadata = new JpegImageParser()
+ final JpegPhotoshopMetadata metadata = new JpegImageParser()
.getPhotoshopMetadata(byteSource, params);
assertNotNull(metadata);
metadata.dump();
- File noIptcFile = createTempFile(imageFile.getName()
+ final File noIptcFile = createTempFile(imageFile.getName()
+ ".iptc.remove.", ".jpg");
{
// test remove
@@ -150,7 +150,7 @@ public class IptcUpdateTest extends Iptc
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(noIptcFile));
- JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+ final JpegPhotoshopMetadata outMetadata = new JpegImageParser()
.getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
params);
assertTrue(outMetadata == null
@@ -159,11 +159,11 @@ public class IptcUpdateTest extends Iptc
{
// test no-change update
- List<IptcBlock> newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
- List<IptcRecord> oldRecords = metadata.photoshopApp13Data.getRecords();
- List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
+ final List<IptcBlock> newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
+ final List<IptcRecord> oldRecords = metadata.photoshopApp13Data.getRecords();
+ final List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
for (int j = 0; j < oldRecords.size(); j++) {
- IptcRecord record = oldRecords.get(j);
+ final IptcRecord record = oldRecords.get(j);
if (record.iptcType != IptcTypes.CITY
&& record.iptcType != IptcTypes.CREDIT) {
newRecords.add(record);
@@ -174,10 +174,10 @@ public class IptcUpdateTest extends Iptc
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
- PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+ final PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
newBlocks);
- File updated = createTempFile(imageFile.getName()
+ final File updated = createTempFile(imageFile.getName()
+ ".iptc.update.", ".jpg");
OutputStream os = null;
try {
@@ -194,8 +194,8 @@ public class IptcUpdateTest extends Iptc
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
- ByteSource updateByteSource = new ByteSourceFile(updated);
- JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+ final ByteSource updateByteSource = new ByteSourceFile(updated);
+ final JpegPhotoshopMetadata outMetadata = new JpegImageParser()
.getPhotoshopMetadata(updateByteSource, params);
// Debug.debug("outMetadata", outMetadata.toString());
@@ -210,17 +210,17 @@ public class IptcUpdateTest extends Iptc
{
// test update
- List<IptcBlock> newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
- List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
+ final List<IptcBlock> newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
+ final List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
newRecords.add(new IptcRecord(IptcTypes.CITY, "Albany, NY"));
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
- PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+ final PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
newBlocks);
- File updated = createTempFile(imageFile.getName()
+ final File updated = createTempFile(imageFile.getName()
+ ".iptc.update.", ".jpg");
OutputStream os = null;
try {
@@ -237,8 +237,8 @@ public class IptcUpdateTest extends Iptc
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
- ByteSource updateByteSource = new ByteSourceFile(updated);
- JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+ final ByteSource updateByteSource = new ByteSourceFile(updated);
+ final JpegPhotoshopMetadata outMetadata = new JpegImageParser()
.getPhotoshopMetadata(updateByteSource, params);
// Debug.debug("outMetadata", outMetadata.toString());
@@ -253,17 +253,17 @@ public class IptcUpdateTest extends Iptc
{
// test insert
- List<IptcBlock> newBlocks = new ArrayList<IptcBlock>();
- List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
+ final List<IptcBlock> newBlocks = new ArrayList<IptcBlock>();
+ final List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
newRecords.add(new IptcRecord(IptcTypes.CITY, "Albany, NY"));
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
- PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+ final PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
newBlocks);
- File updated = createTempFile(imageFile.getName()
+ final File updated = createTempFile(imageFile.getName()
+ ".iptc.insert.", ".jpg");
OutputStream os = null;
try {
@@ -281,8 +281,8 @@ public class IptcUpdateTest extends Iptc
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
- ByteSource updateByteSource = new ByteSourceFile(updated);
- JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+ final ByteSource updateByteSource = new ByteSourceFile(updated);
+ final JpegPhotoshopMetadata outMetadata = new JpegImageParser()
.getPhotoshopMetadata(updateByteSource, params);
// Debug.debug("outMetadata", outMetadata.toString());
@@ -302,46 +302,46 @@ public class IptcUpdateTest extends Iptc
* IPTC data.
*/
public void testAddIptcData() throws Exception {
- List<File> images = getJpegImages();
+ final List<File> images = getJpegImages();
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);
// Debug.debug();
- ByteSource byteSource = new ByteSourceFile(imageFile);
+ final ByteSource byteSource = new ByteSourceFile(imageFile);
// Debug.debug("Segments:");
// new JpegUtils().dumpJFIF(byteSource);
- Map<String,Object> params = new HashMap<String,Object>();
- boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+ final Map<String,Object> params = new HashMap<String,Object>();
+ final boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
- JpegPhotoshopMetadata metadata = new JpegImageParser()
+ final JpegPhotoshopMetadata metadata = new JpegImageParser()
.getPhotoshopMetadata(byteSource, params);
// metadata.dump();
{
- List<IptcBlock> newBlocks = new ArrayList<IptcBlock>();
+ final List<IptcBlock> newBlocks = new ArrayList<IptcBlock>();
List<IptcRecord> newRecords = new ArrayList<IptcRecord>();
if (null != metadata) {
- boolean keepOldIptcNonTextValues = true;
+ final boolean keepOldIptcNonTextValues = true;
if (keepOldIptcNonTextValues) {
newBlocks.addAll(metadata.photoshopApp13Data
.getNonIptcBlocks());
}
- boolean keepOldIptcTextValues = true;
+ final boolean keepOldIptcTextValues = true;
if (keepOldIptcTextValues) {
- List<IptcRecord> oldRecords = metadata.photoshopApp13Data
+ final List<IptcRecord> oldRecords = metadata.photoshopApp13Data
.getRecords();
newRecords = new ArrayList<IptcRecord>();
for (int j = 0; j < oldRecords.size(); j++) {
- IptcRecord record = oldRecords.get(j);
+ final IptcRecord record = oldRecords.get(j);
if (record.iptcType != IptcTypes.CITY
&& record.iptcType != IptcTypes.CREDIT) {
newRecords.add(record);
@@ -354,10 +354,10 @@ public class IptcUpdateTest extends Iptc
newRecords.add(new IptcRecord(IptcTypes.CREDIT,
"William Sorensen"));
- PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+ final PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
newBlocks);
- File updated = createTempFile(imageFile.getName()
+ final File updated = createTempFile(imageFile.getName()
+ ".iptc.add.", ".jpg");
OutputStream os = null;
try {
@@ -374,8 +374,8 @@ public class IptcUpdateTest extends Iptc
// Debug.debug("Destination Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
- ByteSource updateByteSource = new ByteSourceFile(updated);
- JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+ final ByteSource updateByteSource = new ByteSourceFile(updated);
+ final JpegPhotoshopMetadata outMetadata = new JpegImageParser()
.getPhotoshopMetadata(updateByteSource, params);
// Debug.debug("outMetadata", outMetadata.toString());
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpBaseTest.java Tue Dec 4 17:23:16 2012
@@ -29,7 +29,7 @@ import org.apache.commons.imaging.format
public abstract class JpegXmpBaseTest extends ImagingTest {
- protected static boolean hasJpegXmpData(File file) {
+ protected static boolean hasJpegXmpData(final File file) {
if (!file.getName().toLowerCase().endsWith(".jpg"))
{
return false;
@@ -41,9 +41,9 @@ public abstract class JpegXmpBaseTest ex
// Debug.debug("possible file", file);
try {
- ByteSource byteSource = new ByteSourceFile(file);
+ final ByteSource byteSource = new ByteSourceFile(file);
return new JpegImageParser().hasXmpSegment(byteSource);
- } catch (Exception e) {
+ } catch (final Exception e) {
// Debug.debug("Error file", file.getAbsoluteFile());
// Debug.debug(e, 4);
return false;
@@ -51,7 +51,7 @@ public abstract class JpegXmpBaseTest ex
}
private static final ImageFilter HAS_JPEG_XMP_IMAGE_FILTER = new ImageFilter() {
- public boolean accept(File file) throws IOException, ImageReadException {
+ public boolean accept(final File file) throws IOException, ImageReadException {
return hasJpegXmpData(file);
}
};
@@ -73,7 +73,7 @@ public abstract class JpegXmpBaseTest ex
return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER);
}
- protected List<File> getImagesWithXmpData(int max) throws IOException,
+ protected List<File> getImagesWithXmpData(final int max) throws IOException,
ImageReadException {
return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER, max);
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java Tue Dec 4 17:23:16 2012
@@ -30,19 +30,19 @@ import org.apache.commons.imaging.util.D
public class JpegXmpDumpTest extends JpegXmpBaseTest {
public void test() throws Exception {
- List<File> images = getImagesWithXmpData();
+ final List<File> images = getImagesWithXmpData();
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);
Debug.debug();
- ByteSource byteSource = new ByteSourceFile(imageFile);
- Map<String,Object> params = new HashMap<String,Object>();
- String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
+ final ByteSource byteSource = new ByteSourceFile(imageFile);
+ final Map<String,Object> params = new HashMap<String,Object>();
+ final String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
assertNotNull(xmpXml);
Debug.debug("xmpXml", xmpXml);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java Tue Dec 4 17:23:16 2012
@@ -34,31 +34,31 @@ import org.apache.commons.imaging.util.D
public class JpegXmpRewriteTest extends JpegXmpBaseTest {
public void testRemoveInsertUpdate() throws Exception {
- List<File> images = getImagesWithXmpData();
+ final List<File> images = getImagesWithXmpData();
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);
// boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
// if (ignoreImageData)
// continue;
- ByteSource byteSource = new ByteSourceFile(imageFile);
+ final ByteSource byteSource = new ByteSourceFile(imageFile);
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(byteSource);
- Map<String,Object> params = new HashMap<String,Object>();
- String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
+ final Map<String,Object> params = new HashMap<String,Object>();
+ final String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
assertNotNull(xmpXml);
// Debug.debug("xmpXml", xmpXml.length());
// Debug.debug();
- File noXmpFile = createTempFile(imageFile.getName() + ".", ".jpg");
+ final File noXmpFile = createTempFile(imageFile.getName() + ".", ".jpg");
{
// test remove
@@ -77,7 +77,7 @@ public class JpegXmpRewriteTest extends
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(noXmpFile));
- String outXmp = new JpegImageParser().getXmpXml(
+ final String outXmp = new JpegImageParser().getXmpXml(
new ByteSourceFile(noXmpFile), params);
assertNull(outXmp);
}
@@ -85,8 +85,8 @@ public class JpegXmpRewriteTest extends
{
// test update
- String newXmpXml = "test";
- File updated = createTempFile(imageFile.getName() + ".", ".jpg");
+ final String newXmpXml = "test";
+ final File updated = createTempFile(imageFile.getName() + ".", ".jpg");
OutputStream os = null;
try {
os = new FileOutputStream(updated);
@@ -103,7 +103,7 @@ public class JpegXmpRewriteTest extends
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
- String outXmp = new JpegImageParser().getXmpXml(
+ final String outXmp = new JpegImageParser().getXmpXml(
new ByteSourceFile(updated), params);
assertNotNull(outXmp);
assertEquals(outXmp, newXmpXml);
@@ -112,8 +112,8 @@ public class JpegXmpRewriteTest extends
{
// test insert
- String newXmpXml = "test";
- File updated = createTempFile(imageFile.getName() + ".", ".jpg");
+ final String newXmpXml = "test";
+ final File updated = createTempFile(imageFile.getName() + ".", ".jpg");
OutputStream os = null;
try {
os = new FileOutputStream(updated);
@@ -130,7 +130,7 @@ public class JpegXmpRewriteTest extends
// Debug.debug("Source Segments:");
// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
- String outXmp = new JpegImageParser().getXmpXml(
+ final String outXmp = new JpegImageParser().getXmpXml(
new ByteSourceFile(updated), params);
assertNotNull(outXmp);
assertEquals(outXmp, newXmpXml);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamBaseTest.java Tue Dec 4 17:23:16 2012
@@ -28,14 +28,14 @@ import org.apache.commons.imaging.Imagin
public abstract class PamBaseTest extends ImagingTest {
- private static boolean isPam(File file) throws IOException,
+ private static boolean isPam(final File file) throws IOException,
ImageReadException {
- ImageFormat format = Imaging.guessFormat(file);
+ final ImageFormat format = Imaging.guessFormat(file);
return format == ImageFormat.IMAGE_FORMAT_PAM;
}
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 isPam(file);
}
};
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java Tue Dec 4 17:23:16 2012
@@ -33,23 +33,23 @@ public class PamReadTest extends PamBase
public void test() throws Exception {
Debug.debug("start");
- List<File> images = getPamImages();
+ final List<File> images = getPamImages();
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/pcx/PcxBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxBaseTest.java Tue Dec 4 17:23:16 2012
@@ -26,12 +26,12 @@ import org.apache.commons.imaging.Imagin
public abstract class PcxBaseTest extends ImagingTest {
- private static boolean isPcx(File file) {
+ private static boolean isPcx(final File file) {
return file.getName().toLowerCase().endsWith(".pcx");
}
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 isPcx(file);
}
};
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java Tue Dec 4 17:23:16 2012
@@ -33,23 +33,23 @@ public class PcxReadTest extends PcxBase
public void test() throws Exception {
Debug.debug("start");
- List<File> images = getPcxImages();
+ final List<File> images = getPcxImages();
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/png/ConvertPngToGifTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java Tue Dec 4 17:23:16 2012
@@ -30,13 +30,13 @@ public class ConvertPngToGifTest extends
public void test() throws Exception {
- List<File> images = getPngImages();
+ final List<File> images = getPngImages();
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 (isInvalidPNGTestFile(imageFile))
{
continue;
@@ -44,13 +44,13 @@ public class ConvertPngToGifTest extends
// Debug.debug();
}
- Hashtable<String,Object> params = new Hashtable<String,Object>();
+ final Hashtable<String,Object> params = new Hashtable<String,Object>();
// params.put(SanselanConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
- BufferedImage image = Imaging.getBufferedImage(imageFile, params);
+ final BufferedImage image = Imaging.getBufferedImage(imageFile, params);
assertNotNull(image);
- File outFile = createTempFile(imageFile.getName() + ".", ".gif");
+ final File outFile = createTempFile(imageFile.getName() + ".", ".gif");
// Debug.debug("outFile", outFile);
Imaging.writeImage(image, outFile, ImageFormat.IMAGE_FORMAT_GIF,
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngBaseTest.java Tue Dec 4 17:23:16 2012
@@ -28,14 +28,14 @@ import org.apache.commons.imaging.Imagin
public abstract class PngBaseTest extends ImagingTest {
- private static boolean isPng(File file) throws IOException,
+ private static boolean isPng(final File file) throws IOException,
ImageReadException {
- ImageFormat format = Imaging.guessFormat(file);
+ final ImageFormat format = Imaging.guessFormat(file);
return format == ImageFormat.IMAGE_FORMAT_PNG;
}
private static final ImageFilter imageFilter = new ImageFilter() {
- public boolean accept(File file) throws IOException, ImageReadException {
+ public boolean accept(final File file) throws IOException, ImageReadException {
return isPng(file);
}
};
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngMultipleRoundtripTest.java Tue Dec 4 17:23:16 2012
@@ -30,14 +30,14 @@ import org.apache.commons.imaging.util.D
public class PngMultipleRoundtripTest extends PngBaseTest {
public void test() throws Exception {
- String imagesFolderPath = FilenameUtils
+ final String imagesFolderPath = FilenameUtils
.separatorsToSystem("src\\test\\data\\images\\png\\3");
- File imagesFolder = new File(imagesFolderPath);
+ final File imagesFolder = new File(imagesFolderPath);
assertTrue(imagesFolder.exists() && imagesFolder.isDirectory());
- File files[] = imagesFolder.listFiles();
- for (File file : files) {
- File imageFile = file;
+ final File files[] = imagesFolder.listFiles();
+ for (final File file : files) {
+ final File imageFile = file;
if (!imageFile.isFile()) {
continue;
}
@@ -50,18 +50,18 @@ public class PngMultipleRoundtripTest ex
File lastFile = imageFile;
for (int j = 0; j < 10; j++) {
- Map<String,Object> readParams = new HashMap<String,Object>();
+ final Map<String,Object> readParams = new HashMap<String,Object>();
// readParams.put(SanselanConstants.BUFFERED_IMAGE_FACTORY,
// new RgbBufferedImageFactory());
- BufferedImage image = Imaging.getBufferedImage(lastFile,
+ final BufferedImage image = Imaging.getBufferedImage(lastFile,
readParams);
assertNotNull(image);
- File tempFile = createTempFile(imageFile.getName() + "." + j
+ final File tempFile = createTempFile(imageFile.getName() + "." + j
+ ".", ".png");
Debug.debug("tempFile", tempFile);
- Map<String,Object> writeParams = new HashMap<String,Object>();
+ final Map<String,Object> writeParams = new HashMap<String,Object>();
Imaging.writeImage(image, tempFile,
ImageFormat.IMAGE_FORMAT_PNG, writeParams);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java Tue Dec 4 17:23:16 2012
@@ -31,42 +31,42 @@ public class PngReadTest extends PngBase
public void test() throws Exception {
Debug.debug("start");
- List<File> images = getPngImages();
+ final List<File> images = getPngImages();
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);
if (isInvalidPNGTestFile(imageFile)) {
try {
Imaging.getMetadata(imageFile);
fail("Image read should have failed.");
- } catch (Exception e) {
+ } catch (final Exception e) {
}
try {
Imaging.getImageInfo(imageFile);
fail("Image read should have failed.");
- } catch (Exception e) {
+ } catch (final Exception e) {
}
try {
Imaging.getBufferedImage(imageFile);
fail("Image read should have failed.");
- } catch (Exception e) {
+ } catch (final Exception e) {
}
} else {
- 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);
Debug.debug("ICC profile", Imaging.getICCProfile(imageFile));
- 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/png/PngTextTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngTextTest.java Tue Dec 4 17:23:16 2012
@@ -35,49 +35,49 @@ import org.apache.commons.imaging.util.I
public class PngTextTest extends PngBaseTest {
public void test() throws Exception {
- int width = 1;
- int height = 1;
- BufferedImage srcImage = new BufferedImage(width, height,
+ final int width = 1;
+ final int height = 1;
+ final BufferedImage srcImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
srcImage.setRGB(0, 0, Color.red.getRGB());
- Map<String,Object> writeParams = new HashMap<String,Object>();
+ final Map<String,Object> writeParams = new HashMap<String,Object>();
- List<PngText> writeTexts = new ArrayList<PngText>();
+ final List<PngText> writeTexts = new ArrayList<PngText>();
{
- String keyword = "a";
- String text = "b";
+ final String keyword = "a";
+ final String text = "b";
writeTexts.add(new PngText.Text(keyword, text));
}
{
- String keyword = "c";
- String text = "d";
+ final String keyword = "c";
+ final String text = "d";
writeTexts.add(new PngText.Ztxt(keyword, text));
}
{
- String keyword = "e";
- String text = "f";
- String languageTag = "g";
- String translatedKeyword = "h";
+ final String keyword = "e";
+ final String text = "f";
+ final String languageTag = "g";
+ final String translatedKeyword = "h";
writeTexts.add(new PngText.Itxt(keyword, text, languageTag,
translatedKeyword));
}
writeParams.put(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS, writeTexts);
- byte bytes[] = Imaging.writeImageToBytes(srcImage,
+ final byte bytes[] = Imaging.writeImageToBytes(srcImage,
ImageFormat.IMAGE_FORMAT_PNG, writeParams);
- File tempFile = createTempFile("temp", ".png");
+ final File tempFile = createTempFile("temp", ".png");
IoUtils.writeToFile(bytes, tempFile);
- PngImageInfo imageInfo = (PngImageInfo) Imaging.getImageInfo(bytes);
+ final PngImageInfo imageInfo = (PngImageInfo) Imaging.getImageInfo(bytes);
assertNotNull(imageInfo);
- List<PngText> readTexts = imageInfo.getTextChunks();
+ final List<PngText> readTexts = imageInfo.getTextChunks();
assertEquals(readTexts.size(), 3);
for (int i = 0; i < readTexts.size(); i++) {
- PngText text = readTexts.get(i);
+ final PngText text = readTexts.get(i);
if (text.keyword.equals("a")) {
assertEquals(text.text, "b");
} else if (text.keyword.equals("c")) {
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java Tue Dec 4 17:23:16 2012
@@ -32,13 +32,13 @@ public class PngWriteForceTrueColorText
public void test() throws Exception {
- List<File> images = getPngImages();
+ final List<File> images = getPngImages();
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);
try {
if (isInvalidPNGTestFile(imageFile)) {
continue;
@@ -50,22 +50,22 @@ public class PngWriteForceTrueColorText
// params.put(SanselanConstants.PARAM_KEY_VERBOSE,
// Boolean.TRUE);
- BufferedImage image = Imaging.getBufferedImage(imageFile,
+ final BufferedImage image = Imaging.getBufferedImage(imageFile,
new HashMap<String,Object>());
assertNotNull(image);
- File outFile = createTempFile(imageFile.getName() + ".", ".gif");
+ final File outFile = createTempFile(imageFile.getName() + ".", ".gif");
// Debug.debug("outFile", outFile);
- Map<String,Object> params = new HashMap<String,Object>();
+ final Map<String,Object> params = new HashMap<String,Object>();
params.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
Boolean.TRUE);
Imaging.writeImage(image, outFile,
ImageFormat.IMAGE_FORMAT_PNG, params);
- BufferedImage image2 = Imaging.getBufferedImage(outFile,
+ final BufferedImage image2 = Imaging.getBufferedImage(outFile,
new HashMap<String,Object>());
- } catch (Exception e) {
+ } catch (final Exception e) {
Debug.debug("imageFile", imageFile);
throw e;
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteReadTest.java Tue Dec 4 17:23:16 2012
@@ -37,8 +37,8 @@ public class PngWriteReadTest extends Im
// super(name);
// }
- private int[][] getSimpleRawData(int width, int height, int value) {
- int[][] result = new int[height][width];
+ private int[][] getSimpleRawData(final int width, final int height, final int value) {
+ final int[][] result = new int[height][width];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
result[y][x] = value;
@@ -47,13 +47,13 @@ public class PngWriteReadTest extends Im
return result;
}
- private int[][] getAscendingRawData(int width, int height) {
- int[][] result = new int[height][width];
+ private int[][] getAscendingRawData(final int width, final int height) {
+ final int[][] result = new int[height][width];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
- int alpha = (x + y) % 256;
- int value = (x + y) % 256;
- int argb = (0xff & alpha) << 24 | (0xff & value) << 16
+ final int alpha = (x + y) % 256;
+ final int value = (x + y) % 256;
+ final int argb = (0xff & alpha) << 24 | (0xff & value) << 16
| (0xff & value) << 8 | (0xff & value) << 0;
result[y][x] = argb;
@@ -62,12 +62,12 @@ public class PngWriteReadTest extends Im
return result;
}
- private int[][] randomRawData(int width, int height) {
- Random random = new Random();
- int[][] result = new int[height][width];
+ private int[][] randomRawData(final int width, final int height) {
+ final Random random = new Random();
+ final int[][] result = new int[height][width];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
- int argb = random.nextInt();
+ final int argb = random.nextInt();
result[y][x] = argb;
}
}
@@ -75,35 +75,35 @@ public class PngWriteReadTest extends Im
}
public void test() throws Exception {
- int[][] smallBlackPixels = getSimpleRawData(256, 256, 0);
- int[][] singleBlackPixel = getSimpleRawData(1, 1, 0);
- int[][] smallRedPixels = getSimpleRawData(256, 256, 0xffff0000);
- int[][] singleRedPixel = getSimpleRawData(1, 1, 0xffff0000);
- int[][] smallAscendingPixels = getAscendingRawData(256, 256);
- int[][] smallRandomPixels = randomRawData(256, 256);
+ final int[][] smallBlackPixels = getSimpleRawData(256, 256, 0);
+ final int[][] singleBlackPixel = getSimpleRawData(1, 1, 0);
+ final int[][] smallRedPixels = getSimpleRawData(256, 256, 0xffff0000);
+ final int[][] singleRedPixel = getSimpleRawData(1, 1, 0xffff0000);
+ final int[][] smallAscendingPixels = getAscendingRawData(256, 256);
+ final int[][] smallRandomPixels = randomRawData(256, 256);
- int[][][] testData = { smallBlackPixels, singleBlackPixel,
+ final int[][][] testData = { smallBlackPixels, singleBlackPixel,
smallRedPixels, singleRedPixel, smallAscendingPixels,
smallRandomPixels, };
- for (int[][] rawData : testData) {
+ for (final int[][] rawData : testData) {
writeAndReadImageData(rawData);
}
}
public void testTransparency() throws Exception {
// Test for https://issues.apache.org/jira/browse/SANSELAN-52
- int[][] smallAscendingPixels = getAscendingRawData(256, 256);
- byte[] pngBytes = Imaging.writeImageToBytes(
+ final int[][] smallAscendingPixels = getAscendingRawData(256, 256);
+ final byte[] pngBytes = Imaging.writeImageToBytes(
imageDataToBufferedImage(smallAscendingPixels),
ImageFormat.IMAGE_FORMAT_PNG, null);
assertTrue(Imaging.getImageInfo(pngBytes).isTransparent());
}
- private BufferedImage imageDataToBufferedImage(int[][] rawData) {
- int width = rawData[0].length;
- int height = rawData.length;
- BufferedImage image = new BufferedImage(width, height,
+ private BufferedImage imageDataToBufferedImage(final int[][] rawData) {
+ final int width = rawData[0].length;
+ final int height = rawData.length;
+ final BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
@@ -113,10 +113,10 @@ public class PngWriteReadTest extends Im
return image;
}
- private int[][] bufferedImageToImageData(BufferedImage image) {
- int width = image.getWidth();
- int height = image.getHeight();
- int[][] result = new int[height][width];
+ private int[][] bufferedImageToImageData(final BufferedImage image) {
+ final int width = image.getWidth();
+ final int height = image.getHeight();
+ final int[][] result = new int[height][width];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
@@ -126,35 +126,35 @@ public class PngWriteReadTest extends Im
return result;
}
- private void writeAndReadImageData(int[][] rawData) throws IOException,
+ private void writeAndReadImageData(final int[][] rawData) throws IOException,
ImageReadException, ImageWriteException {
- BufferedImage srcImage = imageDataToBufferedImage(rawData);
+ final BufferedImage srcImage = imageDataToBufferedImage(rawData);
- Map<String,Object> writeParams = new HashMap<String,Object>();
+ final Map<String,Object> writeParams = new HashMap<String,Object>();
// writeParams.put(SanselanConstants.PARAM_KEY_FORMAT,
// ImageFormat.IMAGE_FORMAT_PNG);
// writeParams.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
// Boolean.TRUE);
- byte bytes[] = Imaging.writeImageToBytes(srcImage,
+ final byte bytes[] = Imaging.writeImageToBytes(srcImage,
ImageFormat.IMAGE_FORMAT_PNG, writeParams);
// Debug.debug("bytes", bytes);
- File tempFile = createTempFile("temp", ".png");
+ final File tempFile = createTempFile("temp", ".png");
IoUtils.writeToFile(bytes, tempFile);
- BufferedImage dstImage = Imaging.getBufferedImage(bytes);
+ final BufferedImage dstImage = Imaging.getBufferedImage(bytes);
assertNotNull(dstImage);
assertTrue(srcImage.getWidth() == dstImage.getWidth());
assertTrue(srcImage.getHeight() == dstImage.getHeight());
- int dstData[][] = bufferedImageToImageData(dstImage);
+ final int dstData[][] = bufferedImageToImageData(dstImage);
compare(rawData, dstData);
}
- private void compare(int[][] a, int[][] b) {
+ private void compare(final int[][] a, final int[][] b) {
assertNotNull(a);
assertNotNull(b);
assertTrue(a.length == b.length);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java Tue Dec 4 17:23:16 2012
@@ -10,14 +10,14 @@ import org.apache.commons.imaging.Imagin
import org.apache.commons.imaging.ImagingTest;
public abstract class PsdBaseTest extends ImagingTest {
- private static boolean isPsd(File file) throws IOException,
+ private static boolean isPsd(final File file) throws IOException,
ImageReadException {
- ImageFormat format = Imaging.guessFormat(file);
+ final ImageFormat format = Imaging.guessFormat(file);
return format == ImageFormat.IMAGE_FORMAT_PSD;
}
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 isPsd(file);
}
};
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java Tue Dec 4 17:23:16 2012
@@ -15,25 +15,25 @@ public class PsdReadTest extends PsdBase
public void test() throws Exception {
Debug.debug("start");
- List<File> images = getPsdImages();
+ final List<File> images = getPsdImages();
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);
Imaging.getICCProfile(imageFile, params);
- 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/rgbe/RgbeBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeBaseTest.java Tue Dec 4 17:23:16 2012
@@ -26,14 +26,14 @@ import org.apache.commons.imaging.Imagin
import org.apache.commons.imaging.ImagingTest;
public abstract class RgbeBaseTest extends ImagingTest {
- private static boolean isRgbe(File file) throws IOException,
+ private static boolean isRgbe(final File file) throws IOException,
ImageReadException {
- ImageFormat format = Imaging.guessFormat(file);
+ final ImageFormat format = Imaging.guessFormat(file);
return format == ImageFormat.IMAGE_FORMAT_RGBE;
}
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 isRgbe(file);
}
};
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java Tue Dec 4 17:23:16 2012
@@ -31,23 +31,23 @@ public class RgbeReadTest extends RgbeBa
public void test() throws IOException, ImageReadException {
Debug.debug("start");
- List<File> images = getRgbeImages();
+ final List<File> images = getRgbeImages();
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);
+ final BufferedImage image = Imaging.getBufferedImage(imageFile);
assertNotNull(image);
}
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBaseTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBaseTest.java Tue Dec 4 17:23:16 2012
@@ -28,14 +28,14 @@ import org.apache.commons.imaging.Imagin
public abstract class TiffBaseTest extends ImagingTest {
- private static boolean isTiff(File file) throws IOException,
+ private static boolean isTiff(final File file) throws IOException,
ImageReadException {
- ImageFormat format = Imaging.guessFormat(file);
+ final ImageFormat format = Imaging.guessFormat(file);
return format == ImageFormat.IMAGE_FORMAT_TIFF;
}
private static final ImageFilter imageFilter = new ImageFilter() {
- public boolean accept(File file) throws IOException, ImageReadException {
+ public boolean accept(final File file) throws IOException, ImageReadException {
return isTiff(file);
}
};
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java Tue Dec 4 17:23:16 2012
@@ -32,8 +32,8 @@ import org.apache.commons.imaging.util.D
public class TiffCcittTest extends TiffBaseTest {
public void testAll5x2Compressions() {
- byte[] uncompressed = new byte[2];
- int[] combinations = new int[10];
+ final byte[] uncompressed = new byte[2];
+ final int[] combinations = new int[10];
do {
for (int x = 0; x < 5; x++) {
if (combinations[x] != 0) {
@@ -47,103 +47,103 @@ public class TiffCcittTest extends TiffB
}
try {
- byte[] compressed = T4AndT6Compression.compressModifiedHuffman(
+ final byte[] compressed = T4AndT6Compression.compressModifiedHuffman(
uncompressed, 5, 2);
- byte[] result = T4AndT6Compression.decompressModifiedHuffman(
+ final byte[] result = T4AndT6Compression.decompressModifiedHuffman(
compressed, 5, 2);
assertEquals(uncompressed.length, result.length);
for (int i = 0; i < uncompressed.length; i++) {
assertEquals(uncompressed[i], result[i]);
}
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- byte[] compressed = T4AndT6Compression.compressT4_1D(
+ final byte[] compressed = T4AndT6Compression.compressT4_1D(
uncompressed, 5, 2, true);
- byte[] result = T4AndT6Compression.decompressT4_1D(compressed,
+ final byte[] result = T4AndT6Compression.decompressT4_1D(compressed,
5, 2, true);
assertEquals(uncompressed.length, result.length);
for (int i = 0; i < uncompressed.length; i++) {
assertEquals(uncompressed[i], result[i]);
}
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- byte[] compressed = T4AndT6Compression.compressT4_1D(
+ final byte[] compressed = T4AndT6Compression.compressT4_1D(
uncompressed, 5, 2, false);
- byte[] result = T4AndT6Compression.decompressT4_1D(compressed,
+ final byte[] result = T4AndT6Compression.decompressT4_1D(compressed,
5, 2, false);
assertEquals(uncompressed.length, result.length);
for (int i = 0; i < uncompressed.length; i++) {
assertEquals(uncompressed[i], result[i]);
}
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- byte[] compressed = T4AndT6Compression.compressT4_2D(
+ final byte[] compressed = T4AndT6Compression.compressT4_2D(
uncompressed, 5, 2, true, 2);
- byte[] result = T4AndT6Compression.decompressT4_2D(compressed,
+ final byte[] result = T4AndT6Compression.decompressT4_2D(compressed,
5, 2, true);
assertEquals(uncompressed.length, result.length);
for (int i = 0; i < uncompressed.length; i++) {
assertEquals(uncompressed[i], result[i]);
}
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- byte[] compressed = T4AndT6Compression.compressT4_2D(
+ final byte[] compressed = T4AndT6Compression.compressT4_2D(
uncompressed, 5, 2, false, 2);
- byte[] result = T4AndT6Compression.decompressT4_2D(compressed,
+ final byte[] result = T4AndT6Compression.decompressT4_2D(compressed,
5, 2, false);
assertEquals(uncompressed.length, result.length);
for (int i = 0; i < uncompressed.length; i++) {
assertEquals(uncompressed[i], result[i]);
}
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- byte[] compressed = T4AndT6Compression.compressT6(uncompressed,
+ final byte[] compressed = T4AndT6Compression.compressT6(uncompressed,
5, 2);
- byte[] result = T4AndT6Compression.decompressT6(compressed, 5,
+ final byte[] result = T4AndT6Compression.decompressT6(compressed, 5,
2);
assertEquals(uncompressed.length, result.length);
for (int i = 0; i < uncompressed.length; i++) {
assertEquals(uncompressed[i], result[i]);
}
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
}
@@ -151,8 +151,8 @@ public class TiffCcittTest extends TiffB
}
public void testAll5x2Images() {
- int[] combinations = new int[10];
- BufferedImage image = new BufferedImage(5, 2,
+ final int[] combinations = new int[10];
+ final BufferedImage image = new BufferedImage(5, 2,
BufferedImage.TYPE_INT_RGB);
do {
for (int x = 0; x < 5; x++) {
@@ -171,119 +171,119 @@ public class TiffCcittTest extends TiffB
}
try {
- HashMap<String,Object> params = new HashMap<String,Object>();
+ final HashMap<String,Object> params = new HashMap<String,Object>();
params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
TiffConstants.TIFF_COMPRESSION_CCITT_1D);
- byte[] compressed = Imaging.writeImageToBytes(image,
+ final byte[] compressed = Imaging.writeImageToBytes(image,
ImageFormat.IMAGE_FORMAT_TIFF, params);
- BufferedImage result = Imaging.getBufferedImage(compressed);
+ final BufferedImage result = Imaging.getBufferedImage(compressed);
compareImages(image, result);
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- HashMap<String,Object> params = new HashMap<String,Object>();
+ final HashMap<String,Object> params = new HashMap<String,Object>();
params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 0);
- byte[] compressed = Imaging.writeImageToBytes(image,
+ final byte[] compressed = Imaging.writeImageToBytes(image,
ImageFormat.IMAGE_FORMAT_TIFF, params);
- BufferedImage result = Imaging.getBufferedImage(compressed);
+ final BufferedImage result = Imaging.getBufferedImage(compressed);
compareImages(image, result);
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- HashMap<String,Object> params = new HashMap<String,Object>();
+ final HashMap<String,Object> params = new HashMap<String,Object>();
params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 4);
- byte[] compressed = Imaging.writeImageToBytes(image,
+ final byte[] compressed = Imaging.writeImageToBytes(image,
ImageFormat.IMAGE_FORMAT_TIFF, params);
- BufferedImage result = Imaging.getBufferedImage(compressed);
+ final BufferedImage result = Imaging.getBufferedImage(compressed);
compareImages(image, result);
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- HashMap<String,Object> params = new HashMap<String,Object>();
+ final HashMap<String,Object> params = new HashMap<String,Object>();
params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 1);
- byte[] compressed = Imaging.writeImageToBytes(image,
+ final byte[] compressed = Imaging.writeImageToBytes(image,
ImageFormat.IMAGE_FORMAT_TIFF, params);
- BufferedImage result = Imaging.getBufferedImage(compressed);
+ final BufferedImage result = Imaging.getBufferedImage(compressed);
compareImages(image, result);
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- HashMap<String,Object> params = new HashMap<String,Object>();
+ final HashMap<String,Object> params = new HashMap<String,Object>();
params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3);
params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 5);
- byte[] compressed = Imaging.writeImageToBytes(image,
+ final byte[] compressed = Imaging.writeImageToBytes(image,
ImageFormat.IMAGE_FORMAT_TIFF, params);
- BufferedImage result = Imaging.getBufferedImage(compressed);
+ final BufferedImage result = Imaging.getBufferedImage(compressed);
compareImages(image, result);
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
Debug.debug(ex);
assertFalse(true);
}
try {
- HashMap<String,Object> params = new HashMap<String,Object>();
+ final HashMap<String,Object> params = new HashMap<String,Object>();
params.put(ImagingConstants.PARAM_KEY_COMPRESSION,
TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_4);
- byte[] compressed = Imaging.writeImageToBytes(image,
+ final byte[] compressed = Imaging.writeImageToBytes(image,
ImageFormat.IMAGE_FORMAT_TIFF, params);
- BufferedImage result = Imaging.getBufferedImage(compressed);
+ final BufferedImage result = Imaging.getBufferedImage(compressed);
compareImages(image, result);
- } catch (ImageWriteException ex) {
+ } catch (final ImageWriteException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (ImageReadException ex) {
+ } catch (final ImageReadException ex) {
Debug.debug(ex);
assertFalse(true);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
Debug.debug(ex);
assertFalse(true);
}
@@ -302,7 +302,7 @@ public class TiffCcittTest extends TiffB
* @return false if there is no more combinations (ie. nothing was done),
* true otherwise
*/
- private static boolean nextCombination(int[] sequence, int max) {
+ private static boolean nextCombination(final int[] sequence, final int max) {
int i;
for (i = 0; i < sequence.length; i++) {
if (sequence[i] == max) {
@@ -315,14 +315,14 @@ public class TiffCcittTest extends TiffB
return i < sequence.length;
}
- private void compareImages(BufferedImage a, BufferedImage b) {
+ private void compareImages(final BufferedImage a, final BufferedImage b) {
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) {
Debug.debug("width", a.getWidth());
Debug.debug("height", a.getHeight());
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java Tue Dec 4 17:23:16 2012
@@ -31,13 +31,13 @@ import org.apache.commons.imaging.util.D
public class TiffLzwTest extends TiffBaseTest {
public void testTrivial() throws Exception {
- byte bytes[] = { 0, };
+ final byte bytes[] = { 0, };
compressRoundtripAndValidate(bytes);
}
public void testMedium() throws Exception {
- int LENGTH = 1024 * 32;
- byte bytes[] = new byte[LENGTH];
+ final int LENGTH = 1024 * 32;
+ final byte bytes[] = new byte[LENGTH];
for (int modulator = 1; modulator < 255; modulator += 3) {
for (int i = 0; i < LENGTH; i++) {
bytes[i] = (byte) (0xff & (i % modulator));
@@ -72,7 +72,7 @@ public class TiffLzwTest extends TiffBas
// }
// }
- private void compressRoundtripAndValidate(byte src[]) throws IOException {
+ private void compressRoundtripAndValidate(final byte src[]) throws IOException {
final boolean DEBUG = false;
if (DEBUG) {
@@ -81,35 +81,35 @@ public class TiffLzwTest extends TiffBas
Debug.debug();
}
- int LZW_MINIMUM_CODE_SIZE = 8;
+ final int LZW_MINIMUM_CODE_SIZE = 8;
final List<Integer> codes = new ArrayList<Integer>();
- MyLzwCompressor.Listener compressionListener = new MyLzwCompressor.Listener() {
- public void dataCode(int code) {
+ final MyLzwCompressor.Listener compressionListener = new MyLzwCompressor.Listener() {
+ public void dataCode(final int code) {
codes.add(code);
}
- public void eoiCode(int code) {
+ public void eoiCode(final int code) {
codes.add(code);
}
- public void clearCode(int code) {
+ public void clearCode(final int code) {
codes.add(code);
}
- public void init(int clearCode, int eoiCode) {
+ public void init(final int clearCode, final int eoiCode) {
}
};
- MyLzwCompressor compressor = new MyLzwCompressor(LZW_MINIMUM_CODE_SIZE,
+ final MyLzwCompressor compressor = new MyLzwCompressor(LZW_MINIMUM_CODE_SIZE,
ByteOrder.MOTOROLA, true, compressionListener);
- byte compressed[] = compressor.compress(src);
+ final byte compressed[] = compressor.compress(src);
- MyLzwDecompressor.Listener decompressionListener = new MyLzwDecompressor.Listener() {
+ final MyLzwDecompressor.Listener decompressionListener = new MyLzwDecompressor.Listener() {
int index = 0;
int clearCode, eoiCode;
- public void code(int code) {
+ public void code(final int code) {
if (DEBUG) {
if (code == clearCode) {
Debug.debug("clearCode: " + index + "/" + codes.size());
@@ -120,7 +120,7 @@ public class TiffLzwTest extends TiffBas
Debug.debug();
}
}
- Integer expectedCode = codes.get(index++);
+ final Integer expectedCode = codes.get(index++);
if (code != expectedCode.intValue()) {
Debug.debug("bad code: " + index + "/" + codes.size());
Debug.debug("code: " + code + " (0x"
@@ -140,18 +140,18 @@ public class TiffLzwTest extends TiffBas
}
}
- public void init(int clearCode, int eoiCode) {
+ public void init(final int clearCode, final int eoiCode) {
this.clearCode = clearCode;
this.eoiCode = eoiCode;
}
};
- InputStream is = new ByteArrayInputStream(compressed);
- MyLzwDecompressor decompressor = new MyLzwDecompressor(
+ final InputStream is = new ByteArrayInputStream(compressed);
+ final MyLzwDecompressor decompressor = new MyLzwDecompressor(
LZW_MINIMUM_CODE_SIZE, ByteOrder.NETWORK,
decompressionListener);
decompressor.setTiffLZWMode();
- byte decompressed[] = decompressor.decompress(is, src.length);
+ final byte decompressed[] = decompressor.decompress(is, src.length);
assertEquals(src.length, decompressed.length);
for (int i = 0; i < src.length; i++) {
@@ -159,17 +159,17 @@ public class TiffLzwTest extends TiffBas
}
}
- private void decompressRoundtripAndValidate(byte src[]) throws IOException {
+ private void decompressRoundtripAndValidate(final byte src[]) throws IOException {
Debug.debug();
Debug.debug("roundtripAndValidate: " + src.length);
Debug.debug();
- int LZW_MINIMUM_CODE_SIZE = 8;
+ final int LZW_MINIMUM_CODE_SIZE = 8;
final List<Integer> codes = new ArrayList<Integer>();
- MyLzwDecompressor.Listener decompressionListener = new MyLzwDecompressor.Listener() {
+ final MyLzwDecompressor.Listener decompressionListener = new MyLzwDecompressor.Listener() {
- public void code(int code) {
+ public void code(final int code) {
Debug.debug("listener code: " + code + " (0x"
+ Integer.toHexString(code) + ") "
+ Integer.toBinaryString(code) + ", index: "
@@ -177,29 +177,29 @@ public class TiffLzwTest extends TiffBas
codes.add(code);
}
- public void init(int clearCode, int eoiCode) {
+ public void init(final int clearCode, final int eoiCode) {
}
};
- InputStream is = new ByteArrayInputStream(src);
- MyLzwDecompressor decompressor = new MyLzwDecompressor(
+ final InputStream is = new ByteArrayInputStream(src);
+ final MyLzwDecompressor decompressor = new MyLzwDecompressor(
LZW_MINIMUM_CODE_SIZE, ByteOrder.NETWORK,
decompressionListener);
decompressor.setTiffLZWMode();
- byte decompressed[] = decompressor.decompress(is, src.length);
+ final byte decompressed[] = decompressor.decompress(is, src.length);
- MyLzwCompressor.Listener compressionListener = new MyLzwCompressor.Listener() {
+ final MyLzwCompressor.Listener compressionListener = new MyLzwCompressor.Listener() {
int clearCode, eoiCode;
- public void init(int clearCode, int eoiCode) {
+ public void init(final int clearCode, final int eoiCode) {
this.clearCode = clearCode;
this.eoiCode = eoiCode;
}
int index = 0;
- private void code(int code) {
+ private void code(final int code) {
if (code == clearCode) {
Debug.debug("clearCode: " + index + "/" + codes.size());
@@ -209,7 +209,7 @@ public class TiffLzwTest extends TiffBas
Debug.debug("eoiCode: " + index + "/" + codes.size());
Debug.debug();
}
- Integer expectedCode = codes.get(index++);
+ final Integer expectedCode = codes.get(index++);
if (code != expectedCode.intValue()) {
Debug.debug("bad code: " + index + "/" + codes.size());
Debug.debug("code: " + code + " (0x"
@@ -229,23 +229,23 @@ public class TiffLzwTest extends TiffBas
}
}
- public void dataCode(int code) {
+ public void dataCode(final int code) {
code(code);
}
- public void eoiCode(int code) {
+ public void eoiCode(final int code) {
code(code);
}
- public void clearCode(int code) {
+ public void clearCode(final int code) {
code(code);
}
};
- MyLzwCompressor compressor = new MyLzwCompressor(LZW_MINIMUM_CODE_SIZE,
+ final MyLzwCompressor compressor = new MyLzwCompressor(LZW_MINIMUM_CODE_SIZE,
ByteOrder.MOTOROLA, true, compressionListener);
- byte compressed[] = compressor.compress(decompressed);
+ final byte compressed[] = compressor.compress(decompressed);
assertEquals(src.length, compressed.length);
for (int i = 0; i < src.length; i++) {
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java?rev=1417043&r1=1417042&r2=1417043&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java Tue Dec 4 17:23:16 2012
@@ -29,24 +29,24 @@ import org.apache.commons.imaging.util.D
public class TiffReadTest 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);
Debug.debug("ICC profile", Imaging.getICCProfile(imageFile));
- ImageInfo imageInfo = Imaging.getImageInfo(imageFile);
+ final ImageInfo imageInfo = Imaging.getImageInfo(imageFile);
assertNotNull(imageInfo);
- BufferedImage image = Imaging.getBufferedImage(imageFile);
+ final BufferedImage image = Imaging.getBufferedImage(imageFile);
assertNotNull(image);
}
}