You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2013/11/26 14:36:45 UTC
svn commit: r1545653 [1/2] - in /commons/proper/imaging/trunk/src:
main/java/org/apache/commons/imaging/
main/java/org/apache/commons/imaging/common/itu_t4/
main/java/org/apache/commons/imaging/formats/jpeg/
main/java/org/apache/commons/imaging/formats...
Author: ebourg
Date: Tue Nov 26 13:36:44 2013
New Revision: 1545653
URL: http://svn.apache.org/r1545653
Log:
Cleaned up the Debug class
Added:
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/TestUtils.java (with props)
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceBlock.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdConstants.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/ImagingTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/color/ColorConversionsTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/SpecificExifTagTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/WriteExifMetadataExampleTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpDumpTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriteTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pam/PamReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/pcx/PcxReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/ConvertPngToGifTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpDumpTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xmp/XmpUpdateTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/xpm/XpmReadTest.java
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java Tue Nov 26 13:36:44 2013
@@ -31,4 +31,34 @@ public class ImageWriteException extends
public ImageWriteException(final String message, final Throwable cause) {
super(message, cause);
}
+
+ public ImageWriteException(final String message, final Object data) {
+ super(message + ": " + data + " (" + getType(data) + ")");
+ }
+
+ private static String getType(final Object value) {
+ if (value == null) {
+ return "null";
+ } else if (value instanceof Object[]) {
+ return "[Object[]: " + ((Object[]) value).length + "]";
+ } else if (value instanceof char[]) {
+ return "[char[]: " + ((char[]) value).length + "]";
+ } else if (value instanceof byte[]) {
+ return "[byte[]: " + ((byte[]) value).length + "]";
+ } else if (value instanceof short[]) {
+ return "[short[]: " + ((short[]) value).length + "]";
+ } else if (value instanceof int[]) {
+ return "[int[]: " + ((int[]) value).length + "]";
+ } else if (value instanceof long[]) {
+ return "[long[]: " + ((long[]) value).length + "]";
+ } else if (value instanceof float[]) {
+ return "[float[]: " + ((float[]) value).length + "]";
+ } else if (value instanceof double[]) {
+ return "[double[]: " + ((double[]) value).length + "]";
+ } else if (value instanceof boolean[]) {
+ return "[boolean[]: " + ((boolean[]) value).length + "]";
+ } else {
+ return value.getClass().getName();
+ }
+ }
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java Tue Nov 26 13:36:44 2013
@@ -23,7 +23,6 @@ import org.apache.commons.imaging.ImageR
import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.common.BitInputStreamFlexible;
import org.apache.commons.imaging.common.itu_t4.T4_T6_Tables.Entry;
-import org.apache.commons.imaging.util.Debug;
import org.apache.commons.imaging.util.IoUtils;
public final class T4AndT6Compression {
@@ -70,7 +69,7 @@ public final class T4AndT6Compression {
CONTROL_CODES.insert(T4_T6_Tables.VR2.bitString, T4_T6_Tables.VR2);
CONTROL_CODES.insert(T4_T6_Tables.VR3.bitString, T4_T6_Tables.VR3);
} catch (final HuffmanTreeException cannotHappen) {
- Debug.debug(cannotHappen);
+ throw new Error(cannotHappen);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java Tue Nov 26 13:36:44 2013
@@ -256,13 +256,12 @@ public class JpegImageParser extends Ima
private void dumpSegments(final List<? extends Segment> v) {
Debug.debug();
- Debug.debug("dumpSegments", v.size());
+ Debug.debug("dumpSegments: " + v.size());
for (int i = 0; i < v.size(); i++) {
final App2Segment segment = (App2Segment) v.get(i);
- Debug.debug((i) + ": " + segment.cur_marker + " / "
- + segment.num_markers);
+ Debug.debug((i) + ": " + segment.cur_marker + " / " + segment.num_markers);
}
Debug.debug();
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java Tue Nov 26 13:36:44 2013
@@ -129,9 +129,7 @@ public class IptcParser extends BinaryFi
while (index + 1 < bytes.length) {
final int tagMarker = 0xff & bytes[index++];
if (verbose) {
- Debug.debug("tagMarker",
- tagMarker + " (0x" + Integer.toHexString(tagMarker)
- + ")");
+ Debug.debug("tagMarker: " + tagMarker + " (0x" + Integer.toHexString(tagMarker) + ")");
}
if (tagMarker != IptcConstants.IPTC_RECORD_TAG_MARKER) {
@@ -143,10 +141,7 @@ public class IptcParser extends BinaryFi
final int recordNumber = 0xff & bytes[index++];
if (verbose) {
- Debug.debug(
- "recordNumber",
- recordNumber + " (0x"
- + Integer.toHexString(recordNumber) + ")");
+ Debug.debug("recordNumber: " + recordNumber + " (0x" + Integer.toHexString(recordNumber) + ")");
}
// int recordPrefix = convertByteArrayToShort("recordPrefix", index,
@@ -169,9 +164,7 @@ public class IptcParser extends BinaryFi
final int recordType = 0xff & bytes[index];
if (verbose) {
- Debug.debug("recordType",
- recordType + " (0x" + Integer.toHexString(recordType)
- + ")");
+ Debug.debug("recordType: " + recordType + " (0x" + Integer.toHexString(recordType) + ")");
}
index++;
@@ -287,18 +280,14 @@ public class IptcParser extends BinaryFi
"Invalid Image Resource Block Signature");
}
- final int blockType = bis
- .read2Bytes("Image Resource Block missing type");
+ final int blockType = bis.read2Bytes("Image Resource Block missing type");
if (verbose) {
- Debug.debug("blockType",
- blockType + " (0x" + Integer.toHexString(blockType)
- + ")");
+ Debug.debug("blockType: " + blockType + " (0x" + Integer.toHexString(blockType) + ")");
}
- final int blockNameLength = bis.readByte("Name length",
- "Image Resource Block missing name length");
+ final int blockNameLength = bis.readByte("Name length", "Image Resource Block missing name length");
if (verbose && blockNameLength > 0) {
- Debug.debug("blockNameLength", blockNameLength + " (0x"
+ Debug.debug("blockNameLength: " + blockNameLength + " (0x"
+ Integer.toHexString(blockNameLength) + ")");
}
byte[] blockNameBytes;
@@ -321,12 +310,9 @@ public class IptcParser extends BinaryFi
}
}
- final int blockSize = bis
- .read4Bytes("Image Resource Block missing size");
+ final int blockSize = bis.read4Bytes("Image Resource Block missing size");
if (verbose) {
- Debug.debug("blockSize",
- blockSize + " (0x" + Integer.toHexString(blockSize)
- + ")");
+ Debug.debug("blockSize: " + blockSize + " (0x" + Integer.toHexString(blockSize) + ")");
}
/*
@@ -334,8 +320,7 @@ public class IptcParser extends BinaryFi
* than bytes.length but will at least prevent OutOfMemory errors
*/
if (blockSize > bytes.length) {
- throw new ImageReadException("Invalid Block Size : "
- + blockSize + " > " + bytes.length);
+ throw new ImageReadException("Invalid Block Size : " + blockSize + " > " + bytes.length);
}
final byte[] blockData;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java Tue Nov 26 13:36:44 2013
@@ -448,13 +448,13 @@ public class PngWriter {
final boolean hasAlpha = new PaletteFactory().hasTransparency(src);
if (verbose) {
- Debug.debug("hasAlpha", hasAlpha);
+ Debug.debug("hasAlpha: " + hasAlpha);
}
// int transparency = new PaletteFactory().getTransparency(src);
boolean isGrayscale = new PaletteFactory().isGrayscale(src);
if (verbose) {
- Debug.debug("isGrayscale", isGrayscale);
+ Debug.debug("isGrayscale: " + isGrayscale);
}
byte colorType;
@@ -475,13 +475,13 @@ public class PngWriter {
colorType = getColourType(hasAlpha, isGrayscale);
}
if (verbose) {
- Debug.debug("colorType", colorType);
+ Debug.debug("colorType: " + colorType);
}
}
final byte bitDepth = getBitDepth(colorType, params);
if (verbose) {
- Debug.debug("bit_depth", bitDepth);
+ Debug.debug("bit_depth: " + bitDepth);
}
int sampleDepth;
@@ -491,7 +491,7 @@ public class PngWriter {
sampleDepth = bitDepth;
}
if (verbose) {
- Debug.debug("sample_depth", sampleDepth);
+ Debug.debug("sample_depth: " + sampleDepth);
}
{
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceBlock.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceBlock.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceBlock.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceBlock.java Tue Nov 26 13:36:44 2013
@@ -32,7 +32,7 @@ class ImageResourceBlock {
}
public String getName() throws UnsupportedEncodingException {
- Debug.debug("getName", nameData.length);
+ Debug.debug("getName: " + nameData.length);
return new String(nameData, "ISO-8859-1");
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdConstants.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdConstants.java Tue Nov 26 13:36:44 2013
@@ -190,7 +190,7 @@ public class PsdConstants {
10000,
"Print flags information. 2 bytes version (=1), 1 byte center crop marks, 1 byte (=0), 4 bytes bleed width value, 2 bytes bleed width scale."), };
} catch (final Exception e) {
- Debug.debug(PsdConstants.class, e);
+ Debug.debug(PsdConstants.class.getName(), e);
}
fImageResourceTypes = temp;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeByte.java Tue Nov 26 13:36:44 2013
@@ -20,7 +20,6 @@ import java.nio.ByteOrder;
import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.util.Debug;
public class FieldTypeByte extends FieldType {
public FieldTypeByte(final int type, final String name) {
@@ -43,8 +42,7 @@ public class FieldTypeByte extends Field
} else if (o instanceof byte[]) {
return (byte[]) o;
} else {
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
+ throw new ImageWriteException("Invalid data", o);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeDouble.java Tue Nov 26 13:36:44 2013
@@ -21,7 +21,6 @@ import java.nio.ByteOrder;
import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.util.Debug;
public class FieldTypeDouble extends FieldType {
public FieldTypeDouble(final int type, final String name) {
@@ -54,8 +53,7 @@ public class FieldTypeDouble extends Fie
}
return ByteConversions.toBytes(values, byteOrder);
} else {
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
+ throw new ImageWriteException("Invalid data", o);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeFloat.java Tue Nov 26 13:36:44 2013
@@ -21,7 +21,6 @@ import java.nio.ByteOrder;
import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.util.Debug;
public class FieldTypeFloat extends FieldType {
public FieldTypeFloat(final int type, final String name) {
@@ -53,8 +52,7 @@ public class FieldTypeFloat extends Fiel
}
return ByteConversions.toBytes(values, byteOrder);
} else {
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
+ throw new ImageWriteException("Invalid data", o);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeLong.java Tue Nov 26 13:36:44 2013
@@ -21,7 +21,6 @@ import java.nio.ByteOrder;
import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.util.Debug;
public class FieldTypeLong extends FieldType {
public FieldTypeLong(final int type, final String name) {
@@ -53,8 +52,7 @@ public class FieldTypeLong extends Field
}
return ByteConversions.toBytes(values, byteOrder);
} else {
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
+ throw new ImageWriteException("Invalid data", o);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeRational.java Tue Nov 26 13:36:44 2013
@@ -22,7 +22,6 @@ import org.apache.commons.imaging.ImageW
import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.common.RationalNumber;
import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.util.Debug;
public class FieldTypeRational extends FieldType {
public FieldTypeRational(final int type, final String name) {
@@ -67,8 +66,7 @@ public class FieldTypeRational extends F
}
return ByteConversions.toBytes(rationalNumbers, byteOrder);
} else {
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
+ throw new ImageWriteException("Invalid data", o);
}
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/fieldtypes/FieldTypeShort.java Tue Nov 26 13:36:44 2013
@@ -21,7 +21,6 @@ import java.nio.ByteOrder;
import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.util.Debug;
public class FieldTypeShort extends FieldType {
public FieldTypeShort(final int type, final String name) {
@@ -55,8 +54,7 @@ public class FieldTypeShort extends Fiel
}
return ByteConversions.toBytes(values, byteOrder);
} else {
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
+ throw new ImageWriteException("Invalid data", o);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java Tue Nov 26 13:36:44 2013
@@ -82,8 +82,7 @@ public final class TagInfoGpsText extend
public byte[] encodeValue(final FieldType fieldType, final Object value, final ByteOrder byteOrder)
throws ImageWriteException {
if (!(value instanceof String)) {
- throw new ImageWriteException("GPS text value not String: " + value
- + " (" + Debug.getType(value) + ")");
+ throw new ImageWriteException("GPS text value not String", value);
}
final String s = (String) value;
@@ -142,10 +141,10 @@ public final class TagInfoGpsText extend
} else if (entry.getFieldType() == FieldType.BYTE) {
/* later */
} else {
- Debug.debug("entry.type", entry.getFieldType());
- Debug.debug("entry.directoryType", entry.getDirectoryType());
- Debug.debug("entry.type", entry.getDescriptionWithoutValue());
- Debug.debug("entry.type", entry.getFieldType());
+ Debug.debug("entry.type: " + entry.getFieldType());
+ Debug.debug("entry.directoryType: " + entry.getDirectoryType());
+ Debug.debug("entry.type: " + entry.getDescriptionWithoutValue());
+ Debug.debug("entry.type: " + entry.getFieldType());
throw new ImageReadException("GPS text field not encoded as bytes.");
}
@@ -155,8 +154,7 @@ public final class TagInfoGpsText extend
// try ASCII, with NO prefix.
return new String(bytes, "US-ASCII");
} catch (final UnsupportedEncodingException e) {
- throw new ImageReadException(
- "GPS text field missing encoding prefix.", e);
+ throw new ImageReadException("GPS text field missing encoding prefix.", e);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java Tue Nov 26 13:36:44 2013
@@ -24,7 +24,6 @@ import org.apache.commons.imaging.ImageW
import org.apache.commons.imaging.formats.tiff.TiffField;
import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
-import org.apache.commons.imaging.util.Debug;
/**
* Windows XP onwards store some tags using UTF-16LE, but the field type is byte
@@ -40,8 +39,7 @@ public class TagInfoXpString extends Tag
public byte[] encodeValue(final FieldType fieldType, final Object value, final ByteOrder byteOrder)
throws ImageWriteException {
if (!(value instanceof String)) {
- throw new ImageWriteException("Text value not String: " + value
- + " (" + Debug.getType(value) + ")");
+ throw new ImageWriteException("Text value not String", value);
}
final String s = (String) value;
try {
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutQuantizer.java Tue Nov 26 13:36:44 2013
@@ -73,8 +73,7 @@ public class MedianCutQuantizer {
int mask = 0xff & (0xff << i);
mask = mask | (mask << 8) | (mask << 16) | (mask << 24);
- Debug.debug("mask(" + i + ")",
- mask + " (" + Integer.toHexString(mask) + ")");
+ Debug.debug("mask(" + i + "): " + mask + " (" + Integer.toHexString(mask) + ")");
final Map<Integer, ColorCount> result = groupColors1(image, max, mask);
if (result != null) {
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/Palette.java Tue Nov 26 13:36:44 2013
@@ -47,8 +47,7 @@ public abstract class Palette {
public void dump() {
for (int i = 0; i < length(); i++) {
- Debug.debug("\t" + "palette[" + i + "]", getEntry(i) + " (0x"
- + Integer.toHexString(getEntry(i)) + ")");
+ Debug.debug("\t" + "palette[" + i + "]: " + getEntry(i) + " (0x" + Integer.toHexString(getEntry(i)) + ")");
}
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/util/Debug.java Tue Nov 26 13:36:44 2013
@@ -16,9 +16,6 @@
*/
package org.apache.commons.imaging.util;
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.Rectangle;
import java.awt.color.ICC_Profile;
import java.io.File;
import java.text.DateFormat;
@@ -34,7 +31,7 @@ public final class Debug {
private static final boolean DEBUG = false;
// public static String newline = System.getProperty("line.separator");
- public static final String NEWLINE = "\r\n";
+ private static final String NEWLINE = "\r\n";
private static long counter = 0;
public static void debug(final String message) {
@@ -43,43 +40,13 @@ public final class Debug {
}
}
- public static void debug(final Object o) {
- if (DEBUG) {
- System.out.println(o == null ? "null" : o.toString());
- }
- }
-
- public static String getDebug(final String message) {
- return message;
- }
-
public static void debug() {
- newline();
- }
-
- public static void newline() {
if (DEBUG) {
System.out.print(NEWLINE);
}
}
- public static String getDebug(final String message, final int value) {
- return getDebug(message + ": " + (value));
- }
-
- public static String getDebug(final String message, final double value) {
- return getDebug(message + ": " + (value));
- }
-
- public static String getDebug(final String message, final String value) {
- return getDebug(message + " " + value);
- }
-
- public static String getDebug(final String message, final long value) {
- return getDebug(message + " " + Long.toString(value));
- }
-
- public static String getDebug(final String message, final int v[]) {
+ private static String getDebug(final String message, final int v[]) {
final StringBuilder result = new StringBuilder();
if (v == null) {
@@ -94,12 +61,12 @@ public final class Debug {
return result.toString();
}
- public static String getDebug(final String message, final byte v[]) {
+ private static String getDebug(final String message, final byte v[]) {
final int max = 250;
return getDebug(message, v, max);
}
- public static String getDebug(final String message, final byte v[], final int max) {
+ private static String getDebug(final String message, final byte v[], final int max) {
final StringBuilder result = new StringBuilder();
@@ -129,55 +96,38 @@ public final class Debug {
return result.toString();
}
- public static String getDebug(final String message, final char v[]) {
+ private static String getDebug(final String message, final char v[]) {
final StringBuilder result = new StringBuilder();
if (v == null) {
- result.append(getDebug(message + " (" + null + ")") + NEWLINE);
+ result.append(message + " (" + null + ")" + NEWLINE);
} else {
- result.append(getDebug(message + " (" + v.length + ")") + NEWLINE);
+ result.append(message + " (" + v.length + ")" + NEWLINE);
for (final char element : v) {
- result.append(getDebug("\t" + element + " (" + (0xff & element))
- + ")" + NEWLINE);
+ result.append("\t" + element + " (" + (0xff & element) + ")" + NEWLINE);
}
result.append(NEWLINE);
}
return result.toString();
}
- public static String getDebug(final String message, final List<?> v) {
- final StringBuilder result = new StringBuilder();
-
- final String suffix = " [" + counter++ + "]";
-
- result.append(getDebug(message + " (" + v.size() + ")" + suffix) + NEWLINE);
- for (Object aV : v) {
- result.append(getDebug("\t" + aV.toString() + suffix) + NEWLINE);
- }
- result.append(NEWLINE);
-
- return result.toString();
- }
-
- public static void debug(final String message, final Map<?, ?> map) {
+ private static void debug(final String message, final Map<?, ?> map) {
debug(getDebug(message, map));
}
- public static String getDebug(final String message, final Map<?,?> map) {
+ private static String getDebug(final String message, final Map<?,?> map) {
final StringBuilder result = new StringBuilder();
if (map == null) {
- return getDebug(message + " map: " + null);
+ return message + " map: " + null;
}
final List<Object> keys = new ArrayList<Object>(map.keySet());
- result.append(getDebug(message + " map: " + keys.size()) + NEWLINE);
+ result.append(message + " map: " + keys.size() + NEWLINE);
for (int i = 0; i < keys.size(); i++) {
final Object key = keys.get(i);
final Object value = map.get(key);
- result.append(getDebug("\t" + i + ": '" + key + "' -> '" + value
- + "'")
- + NEWLINE);
+ result.append("\t" + i + ": '" + key + "' -> '" + value + "'" + NEWLINE);
}
result.append(NEWLINE);
@@ -185,69 +135,6 @@ public final class Debug {
return result.toString();
}
- public static boolean compare(final String prefix, final Map<?, ?> a, final Map<?, ?> b) {
- return compare(prefix, a, b, null, null);
- }
-
- private static void log(final StringBuilder buffer, final String s) {
- Debug.debug(s);
- if (buffer != null) {
- buffer.append(s + NEWLINE);
- }
- }
-
- public static boolean compare(final String prefix, final Map<?, ?> a, final Map<?, ?> b, final List<?> ignore,
- final StringBuilder buffer) {
- if ((a == null) && (b == null)) {
- log(buffer, prefix + " both maps null");
- return true;
- }
- if (a == null) {
- log(buffer, prefix + " map a: null, map b: map");
- return false;
- }
- if (b == null) {
- log(buffer, prefix + " map a: map, map b: null");
- return false;
- }
-
- final List<?> keys_a = new ArrayList<Object>(a.keySet());
- final List<?> keys_b = new ArrayList<Object>(b.keySet());
-
- if (ignore != null) {
- keys_a.removeAll(ignore);
- keys_b.removeAll(ignore);
- }
-
- boolean result = true;
-
- for (Object key : keys_a) {
- if (!keys_b.contains(key)) {
- log(buffer, prefix + "b is missing key '" + key + "' from a");
- result = false;
- } else {
- keys_b.remove(key);
- final Object value_a = a.get(key);
- final Object value_b = b.get(key);
- if (!value_a.equals(value_b)) {
- log(buffer, prefix + "key(" + key + ") value a: " + value_a
- + ") != b: " + value_b + ")");
- result = false;
- }
- }
- }
- for (Object key : keys_b) {
- log(buffer, prefix + "a is missing key '" + key + "' from b");
- result = false;
- }
-
- if (result) {
- log(buffer, prefix + "a is the same as b");
- }
-
- return result;
- }
-
private static String byteQuadToString(final int bytequad) {
final byte b1 = (byte) ((bytequad >> 24) & 0xff);
final byte b2 = (byte) ((bytequad >> 16) & 0xff);
@@ -275,49 +162,6 @@ public final class Debug {
return buffer.toString();
}
- public static String getDebug(final String message, final ICC_Profile value) {
-
- final StringBuilder result = new StringBuilder(37);
-
- result.append(getDebug("ICC_Profile " + message + ": "
- + ((value == null) ? "null" : value.toString()))
- + NEWLINE);
- if (value != null) {
- result.append(getDebug("\t getProfileClass: "
- + byteQuadToString(value.getProfileClass()))
- + NEWLINE);
- result.append(getDebug("\t getPCSType: "
- + byteQuadToString(value.getPCSType()))
- + NEWLINE);
- result.append(getDebug("\t getColorSpaceType() : "
- + byteQuadToString(value.getColorSpaceType()))
- + NEWLINE);
- }
-
- return result.toString();
-
- }
-
- public static String getDebug(final String message, final boolean value) {
- return getDebug(message + " " + ((value) ? ("true") : ("false")));
- }
-
- public static String getDebug(final String message, final File file) {
- return getDebug(message + ": "
- + ((file == null) ? "null" : file.getPath()));
- }
-
- public static String getDebug(final String message, final Date value) {
- final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
- return getDebug(message, (value == null) ? "null" : df.format(value));
- }
-
- public static String getDebug(final String message, final Calendar value) {
- final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
- return getDebug(message,
- (value == null) ? "null" : df.format(value.getTime()));
- }
-
public static void debug(final String message, final Object value) {
if (value == null) {
debug(message, "null");
@@ -333,8 +177,6 @@ public final class Debug {
debug(message, (List<?>) value);
} else if (value instanceof Map) {
debug(message, (Map<?, ?>) value);
- // } else if (value instanceof Object) {
- // debug(message, (Object) value);
} else if (value instanceof ICC_Profile) {
debug(message, (ICC_Profile) value);
} else if (value instanceof File) {
@@ -348,193 +190,42 @@ public final class Debug {
}
}
- public static void debug(final String message, final Object value[]) {
- if (value == null) {
- debug(message, "null");
- } else {
- debug(message, value.length);
- final int max = 10;
- for (int i = 0; i < value.length && i < max; i++) {
- debug("\t" + i, value[i]);
- }
- if (value.length > max) {
- debug("\t...");
- }
- }
- debug();
- }
-
- public static String getDebug(final String message, final Object value) {
- if (value == null) {
- return getDebug(message, "null");
- } else if (value instanceof Calendar) {
- return getDebug(message, (Calendar) value);
- } else if (value instanceof Date) {
- return getDebug(message, (Date) value);
- } else if (value instanceof File) {
- return getDebug(message, (File) value);
- } else if (value instanceof ICC_Profile) {
- return getDebug(message, (ICC_Profile) value);
- } else if (value instanceof Map) {
- return getDebug(message, (Map<?,?>) value);
- // else if (value instanceof Object) // getDebug(message, (Object)
- // value);
- } else if (value instanceof String) {
- return getDebug(message, (String) value);
- } else if (value instanceof byte[]) {
- return getDebug(message, (byte[]) value);
- } else if (value instanceof char[]) {
- return getDebug(message, (char[]) value);
- } else if (value instanceof int[]) {
- return getDebug(message, (int[]) value);
- } else if (value instanceof List) {
- return getDebug(message, (List<?>) value);
- } else {
- return getDebug(message, value.toString());
- }
- }
-
- public static String getType(final Object value) {
- if (value == null) {
- return "null";
- } else if (value instanceof Object[]) {
- return "[Object[]: " + ((Object[]) value).length + "]";
- } else if (value instanceof char[]) {
- return "[char[]: " + ((char[]) value).length + "]";
- } else if (value instanceof byte[]) {
- return "[byte[]: " + ((byte[]) value).length + "]";
- } else if (value instanceof short[]) {
- return "[short[]: " + ((short[]) value).length + "]";
- } else if (value instanceof int[]) {
- return "[int[]: " + ((int[]) value).length + "]";
- } else if (value instanceof long[]) {
- return "[long[]: " + ((long[]) value).length + "]";
- } else if (value instanceof float[]) {
- return "[float[]: " + ((float[]) value).length + "]";
- } else if (value instanceof double[]) {
- return "[double[]: " + ((double[]) value).length + "]";
- } else if (value instanceof boolean[]) {
- return "[boolean[]: " + ((boolean[]) value).length + "]";
- } else {
- return value.getClass().getName();
- }
- }
-
- public static boolean isArray(final Object value) {
- if (value == null) {
- return false;
- } else if (value instanceof Object[]) {
- return true;
- } else if (value instanceof char[]) {
- return true;
- } else if (value instanceof byte[]) {
- return true;
- } else if (value instanceof short[]) {
- return true;
- } else if (value instanceof int[]) {
- return true;
- } else if (value instanceof long[]) {
- return true;
- } else if (value instanceof float[]) {
- return true;
- } else if (value instanceof double[]) {
- return true;
- } else if (value instanceof boolean[]) {
- return true;
- } else {
- return false;
- }
- }
-
- public static String getDebug(final String message, final Object value[]) {
- final StringBuilder result = new StringBuilder();
-
- if (value == null) {
- result.append(getDebug(message, "null") + NEWLINE);
- } else {
- result.append(getDebug(message, value.length));
- final int max = 10;
- for (int i = 0; i < value.length && i < max; i++) {
- result.append(getDebug("\t" + i, value[i]) + NEWLINE);
- }
- if (value.length > max) {
- result.append(getDebug("\t...") + NEWLINE);
- }
- }
- result.append(NEWLINE);
-
- return result.toString();
- }
-
- public static String getDebug(final Class<?> fClass, final Throwable e) {
- return getDebug(fClass == null ? "[Unknown]" : fClass.getName(), e);
- }
-
- public static void debug(final Class<?> fClass, final Throwable e) {
- debug(fClass.getName(), e);
- }
-
- public static void debug(final String message, final boolean value) {
- debug(message + " " + ((value) ? ("true") : ("false")));
- }
-
- public static void debug(final String message, final byte v[]) {
+ private static void debug(final String message, final byte v[]) {
debug(getDebug(message, v));
}
- public static void debug(final String message, final char v[]) {
+ private static void debug(final String message, final char v[]) {
debug(getDebug(message, v));
}
- public static void debug(final String message, final Calendar value) {
+ private static void debug(final String message, final Calendar value) {
final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
debug(message, (value == null) ? "null" : df.format(value.getTime()));
}
- public static void debug(final String message, final Date value) {
+ private static void debug(final String message, final Date value) {
final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
debug(message, (value == null) ? "null" : df.format(value));
}
- public static void debug(final String message, final double value) {
- debug(message + ": " + (value));
- }
-
- public static void debug(final String message, final File file) {
+ private static void debug(final String message, final File file) {
debug(message + ": " + ((file == null) ? "null" : file.getPath()));
}
- // public static void debug(String message, Object value)
- // {
- // debug("Unknown Object " + message + ": "
- // + ((value == null) ? "null" : value.toString()));
- // }
-
- public static void debug(final String message, final ICC_Profile value) {
- debug("ICC_Profile " + message + ": "
- + ((value == null) ? "null" : value.toString()));
+ private static void debug(final String message, final ICC_Profile value) {
+ debug("ICC_Profile " + message + ": " + ((value == null) ? "null" : value.toString()));
if (value != null) {
- debug("\t getProfileClass: "
- + byteQuadToString(value.getProfileClass()));
+ debug("\t getProfileClass: " + byteQuadToString(value.getProfileClass()));
debug("\t getPCSType: " + byteQuadToString(value.getPCSType()));
- debug("\t getColorSpaceType() : "
- + byteQuadToString(value.getColorSpaceType()));
+ debug("\t getColorSpaceType() : " + byteQuadToString(value.getColorSpaceType()));
}
}
- public static void debug(final String message, final int value) {
- debug(message + ": " + (value));
- }
-
- public static void debug(final String message, final int v[]) {
+ private static void debug(final String message, final int v[]) {
debug(getDebug(message, v));
}
- public static void debug(final String message, final byte v[], final int max) {
- debug(getDebug(message, v, max));
- }
-
- public static void debug(final String message, final List<?> v) {
+ private static void debug(final String message, final List<?> v) {
final String suffix = " [" + counter++ + "]";
debug(message + " (" + v.size() + ")" + suffix);
@@ -544,27 +235,10 @@ public final class Debug {
debug();
}
- public static void debug(final String message, final long value) {
- debug(message + " " + Long.toString(value));
- }
-
- public static void debug(final String prefix, final Point p) {
- System.out.println(prefix + ": "
- + ((p == null) ? "null" : (p.x + ", " + p.y)));
- }
-
- public static void debug(final String prefix, final Rectangle r) {
- debug(getDebug(prefix, r));
- }
-
- public static void debug(final String message, final String value) {
+ private static void debug(final String message, final String value) {
debug(message + " " + value);
}
- public static void debug(final String message, final Throwable e) {
- debug(getDebug(message, e));
- }
-
public static void debug(final Throwable e) {
debug(getDebug(e));
}
@@ -573,23 +247,11 @@ public final class Debug {
debug(getDebug(e, value));
}
- public static void dumpStack() {
- debug(getStackTrace(new Exception("Stack trace"), -1, 1));
- }
-
- public static void dumpStack(final int limit) {
- debug(getStackTrace(new Exception("Stack trace"), limit, 1));
- }
-
- public static String getDebug(final String message, final Throwable e) {
- return message + NEWLINE + getDebug(e);
- }
-
- public static String getDebug(final Throwable e) {
+ private static String getDebug(final Throwable e) {
return getDebug(e, -1);
}
- public static String getDebug(final Throwable e, final int max) {
+ private static String getDebug(final Throwable e, final int max) {
final StringBuilder result = new StringBuilder(35);
final SimpleDateFormat timestamp = new SimpleDateFormat(
@@ -600,8 +262,7 @@ public final class Debug {
result.append("Throwable: "
+ ((e == null) ? "" : ("(" + e.getClass().getName() + ")"))
+ ":" + datetime + NEWLINE);
- result.append("Throwable: "
- + ((e == null) ? "null" : e.getLocalizedMessage()) + NEWLINE);
+ result.append("Throwable: " + ((e == null) ? "null" : e.getLocalizedMessage()) + NEWLINE);
result.append(NEWLINE);
result.append(getStackTrace(e, max));
@@ -613,15 +274,11 @@ public final class Debug {
return result.toString();
}
- public static String getStackTrace(final Throwable e) {
- return getStackTrace(e, -1);
- }
-
- public static String getStackTrace(final Throwable e, final int limit) {
+ private static String getStackTrace(final Throwable e, final int limit) {
return getStackTrace(e, limit, 0);
}
- public static String getStackTrace(final Throwable e, final int limit, final int skip) {
+ private static String getStackTrace(final Throwable e, final int limit, final int skip) {
final StringBuilder result = new StringBuilder();
if (e != null) {
@@ -646,182 +303,6 @@ public final class Debug {
return result.toString();
}
- public static void debugByteQuad(final String message, final int i) {
- final int alpha = (i >> 24) & 0xff;
- final int red = (i >> 16) & 0xff;
- final int green = (i >> 8) & 0xff;
- final int blue = (i >> 0) & 0xff;
-
- System.out.println(message + ": " + "alpha: " + alpha + ", " + "red: "
- + red + ", " + "green: " + green + ", " + "blue: " + blue);
- }
-
- public static void debugIPQuad(final String message, final int i) {
- final int b1 = (i >> 24) & 0xff;
- final int b2 = (i >> 16) & 0xff;
- final int b3 = (i >> 8) & 0xff;
- final int b4 = (i >> 0) & 0xff;
-
- System.out.println(message + ": " + "b1: " + b1 + ", " + "b2: " + b2
- + ", " + "b3: " + b3 + ", " + "b4: " + b4);
- }
-
- public static void debugIPQuad(final String message, final byte bytes[]) {
- System.out.print(message + ": ");
- if (bytes == null) {
- System.out.print("null");
- } else {
- for (int i = 0; i < bytes.length; i++) {
- if (i > 0) {
- System.out.print(".");
- }
- System.out.print(0xff & bytes[i]);
- }
- }
- System.out.println();
- }
-
- public static String getDebug(final String prefix, final Dimension r) {
- String s_ar1 = "null";
- String s_ar2 = "null";
-
- if (r != null) {
- final double aspect_ratio = ((double) r.width) / ((double) r.height);
- final double aspect_ratio2 = 1.0 / aspect_ratio;
-
- s_ar1 = Double.toString(aspect_ratio);
- s_ar2 = Double.toString(aspect_ratio2);
-
- if (s_ar1.length() > 7) {
- s_ar1 = s_ar1.substring(0, 7);
- }
- if (s_ar2.length() > 7) {
- s_ar2 = s_ar2.substring(0, 7);
- }
- }
-
- return (prefix + ": "
- + ((r == null) ? "null" : (r.width + "x" + r.height))
- + " aspect_ratio: " + s_ar1 + " (" + s_ar2 + ")");
- }
-
- public static void debug(final String prefix, final Dimension r) {
- debug(getDebug(prefix, r));
- }
-
- public static String getDebug(final String prefix, final Rectangle r) {
- String s_ar1 = "null";
- String s_ar2 = "null";
-
- if (r != null) {
- final double aspect_ratio = ((double) r.width) / ((double) r.height);
- final double aspect_ratio2 = 1.0 / aspect_ratio;
-
- s_ar1 = Double.toString(aspect_ratio);
- s_ar2 = Double.toString(aspect_ratio2);
-
- if (s_ar1.length() > 7) {
- s_ar1 = s_ar1.substring(0, 7);
- }
- if (s_ar2.length() > 7) {
- s_ar2 = s_ar2.substring(0, 7);
- }
- }
-
- return (prefix
- + ": "
- + ((r == null) ? "null" : (r.x + "x" + r.y + "," + r.width
- + "x" + r.height)) + " aspect_ratio: " + s_ar1 + " ("
- + s_ar2 + ")");
- }
-
- public static String getDebug(final String prefix, final Point p) {
- return (prefix + ": " + ((p == null) ? "null" : (p.x + ", " + p.y)));
- }
-
- public static void dump(final String prefix, final Object value) {
- if (value == null) {
- debug(prefix, "null");
- } else if (value instanceof Object[]) {
- final Object[] array = (Object[]) value;
- debug(prefix, array);
- for (int i = 0; i < array.length; i++) {
- dump(prefix + "\t" + i + ": ", array[i]);
- }
- } else if (value instanceof int[]) {
- final int[] array = (int[]) value;
- debug(prefix, array);
- for (int i = 0; i < array.length; i++) {
- debug(prefix + "\t" + i + ": ", array[i]);
- }
- } else if (value instanceof char[]) {
- final char[] array = (char[]) value;
- debug(prefix, "[" + new String(array) + "]");
- } else if (value instanceof long[]) {
- final long[] array = (long[]) value;
- debug(prefix, array);
- for (int i = 0; i < array.length; i++) {
- debug(prefix + "\t" + i + ": ", array[i]);
- }
- } else if (value instanceof boolean[]) {
- final boolean[] array = (boolean[]) value;
- debug(prefix, array);
- for (int i = 0; i < array.length; i++) {
- debug(prefix + "\t" + i + ": ", array[i]);
- }
- } else if (value instanceof byte[]) {
- final byte[] array = (byte[]) value;
- debug(prefix, array);
- for (int i = 0; i < array.length; i++) {
- debug(prefix + "\t" + i + ": ", array[i]);
- }
- } else if (value instanceof float[]) {
- final float[] array = (float[]) value;
- debug(prefix, array);
- for (int i = 0; i < array.length; i++) {
- debug(prefix + "\t" + i + ": ", array[i]);
- }
- } else if (value instanceof double[]) {
- final double[] array = (double[]) value;
- debug(prefix, array);
- for (int i = 0; i < array.length; i++) {
- debug(prefix + "\t" + i + ": ", array[i]);
- }
- } else if (value instanceof List) {
- final List<?> list = (List<?>) value;
- debug(prefix, "list");
- for (int i = 0; i < list.size(); i++) {
- dump(prefix + "\t" + "list: " + i + ": ", list.get(i));
- }
- } else if (value instanceof Map) {
- final Map<?,?> map = (Map<?,?>) value;
- debug(prefix, "map");
- for (final Map.Entry<?,?> entry : map.entrySet()) {
- dump(prefix + "\t" + "map: " + entry.getKey() + " -> ", entry.getValue());
- }
- // } else if (value instanceof String) {
- // debug(prefix, value);
- } else {
- debug(prefix, value.toString());
- debug(prefix + "\t", value.getClass().getName());
- }
- }
-
- public static void purgeMemory() {
- // try
- // {
- // // Thread.sleep(50);
- // System.runFinalization();
- // Thread.sleep(50);
- // System.gc();
- // Thread.sleep(50);
- // }
- // catch (Throwable e)
- // {
- // Debug.debug(e);
- // }
- }
-
private Debug() {
}
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/ImagingTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/ImagingTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/ImagingTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/ImagingTest.java Tue Nov 26 13:36:44 2013
@@ -24,9 +24,6 @@ import java.util.List;
import junit.framework.TestCase;
-import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.ImagingConstants;
import org.apache.commons.imaging.test.util.FileSystemTraversal;
import org.apache.commons.imaging.util.Debug;
@@ -151,7 +148,7 @@ public abstract class ImagingTest extend
}
if (counter++ % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
if (file.getParentFile().getName().toLowerCase().equals("@broken")) {
Added: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/TestUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/TestUtils.java?rev=1545653&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/TestUtils.java (added)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/TestUtils.java Tue Nov 26 13:36:44 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging;
+
+public class TestUtils {
+
+ public static void purgeMemory() {
+ // try
+ // {
+ // // Thread.sleep(50);
+ // System.runFinalization();
+ // Thread.sleep(50);
+ // System.gc();
+ // Thread.sleep(50);
+ // }
+ // catch (Throwable e)
+ // {
+ // Debug.debug(e);
+ // }
+ }
+}
Propchange: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/TestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/TestUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/color/ColorConversionsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/color/ColorConversionsTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/color/ColorConversionsTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/color/ColorConversionsTest.java Tue Nov 26 13:36:44 2013
@@ -32,12 +32,10 @@ public class ColorConversionsTest extend
final ColorCmy cmyk_cmy = ColorConversions.convertCMYKtoCMY(cmyk);
final int cmyk_cmy_rgb = ColorConversions.convertCMYtoRGB(cmyk_cmy);
- Debug.debug("cmy", cmy);
- Debug.debug("cmyk", cmyk);
- Debug.debug("cmyk_cmy", cmyk_cmy);
- Debug.debug("cmyk_cmy_rgb",
- cmyk_cmy_rgb + " (" + Integer.toHexString(cmyk_cmy_rgb)
- + ")");
+ Debug.debug("cmy: " + cmy);
+ Debug.debug("cmyk: " + cmyk);
+ Debug.debug("cmyk_cmy: " + cmyk_cmy);
+ Debug.debug("cmyk_cmy_rgb: " + cmyk_cmy_rgb + " (" + Integer.toHexString(cmyk_cmy_rgb) + ")");
assertEquals((0xffffff & cmyk_cmy_rgb), (0xffffff & rgb));
}
@@ -48,9 +46,8 @@ public class ColorConversionsTest extend
final ColorHsl hsl = ColorConversions.convertRGBtoHSL(rgb);
final int hsl_rgb = ColorConversions.convertHSLtoRGB(hsl);
- Debug.debug("hsl", hsl);
- Debug.debug("hsl_rgb",
- hsl_rgb + " (" + Integer.toHexString(hsl_rgb) + ")");
+ Debug.debug("hsl: " + hsl);
+ Debug.debug("hsl_rgb: " + hsl_rgb + " (" + Integer.toHexString(hsl_rgb) + ")");
assertEquals((0xffffff & hsl_rgb), (0xffffff & rgb));
}
@@ -61,9 +58,8 @@ public class ColorConversionsTest extend
final ColorHsv hsv = ColorConversions.convertRGBtoHSV(rgb);
final int hsv_rgb = ColorConversions.convertHSVtoRGB(hsv);
- Debug.debug("hsv", hsv);
- Debug.debug("hsv_rgb",
- hsv_rgb + " (" + Integer.toHexString(hsv_rgb) + ")");
+ Debug.debug("hsv: " + hsv);
+ Debug.debug("hsv_rgb: " + hsv_rgb + " (" + Integer.toHexString(hsv_rgb) + ")");
assertEquals((0xffffff & hsv_rgb), (0xffffff & rgb));
}
@@ -75,10 +71,9 @@ public class ColorConversionsTest extend
final int xyz_rgb = ColorConversions.convertXYZtoRGB(xyz);
Debug.debug();
- Debug.debug("rgb", rgb + " (" + Integer.toHexString(rgb) + ")");
- Debug.debug("xyz", xyz);
- Debug.debug("xyz_rgb",
- xyz_rgb + " (" + Integer.toHexString(xyz_rgb) + ")");
+ Debug.debug("rgb: " + rgb + " (" + Integer.toHexString(rgb) + ")");
+ Debug.debug("xyz: " + xyz);
+ Debug.debug("xyz_rgb: " + xyz_rgb + " (" + Integer.toHexString(xyz_rgb) + ")");
assertEquals((0xffffff & xyz_rgb), (0xffffff & rgb));
@@ -86,26 +81,19 @@ public class ColorConversionsTest extend
final ColorXyz cielab_xyz = ColorConversions.convertCIELabtoXYZ(cielab);
final int cielab_xyz_rgb = ColorConversions.convertXYZtoRGB(cielab_xyz);
- Debug.debug("cielab", cielab);
- Debug.debug("cielab_xyz", cielab_xyz);
- Debug.debug("cielab_xyz_rgb",
- cielab_xyz_rgb + " (" + Integer.toHexString(cielab_xyz_rgb)
- + ")");
+ Debug.debug("cielab: " + cielab);
+ Debug.debug("cielab_xyz: " + cielab_xyz);
+ Debug.debug("cielab_xyz_rgb: " + cielab_xyz_rgb + " (" + Integer.toHexString(cielab_xyz_rgb) + ")");
assertEquals((0xffffff & cielab_xyz_rgb), (0xffffff & rgb));
- final ColorHunterLab hunterlab = ColorConversions
- .convertXYZtoHunterLab(xyz);
- final ColorXyz hunterlab_xyz = ColorConversions
- .convertHunterLabtoXYZ(hunterlab);
- final int hunterlab_xyz_rgb = ColorConversions
- .convertXYZtoRGB(hunterlab_xyz);
-
- Debug.debug("hunterlab", hunterlab);
- Debug.debug("hunterlab_xyz", hunterlab_xyz);
- Debug.debug(
- "hunterlab_xyz_rgb",
- hunterlab_xyz_rgb + " ("
+ final ColorHunterLab hunterlab = ColorConversions.convertXYZtoHunterLab(xyz);
+ final ColorXyz hunterlab_xyz = ColorConversions.convertHunterLabtoXYZ(hunterlab);
+ final int hunterlab_xyz_rgb = ColorConversions.convertXYZtoRGB(hunterlab_xyz);
+
+ Debug.debug("hunterlab: " + hunterlab);
+ Debug.debug("hunterlab_xyz: " + hunterlab_xyz);
+ Debug.debug("hunterlab_xyz_rgb: " + hunterlab_xyz_rgb + " ("
+ Integer.toHexString(hunterlab_xyz_rgb) + ")");
assertEquals((0xffffff & hunterlab_xyz_rgb), (0xffffff & rgb));
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/RationalNumberTest.java Tue Nov 26 13:36:44 2013
@@ -106,9 +106,9 @@ public class RationalNumberTest extends
final NumberFormat nf = DecimalFormat.getInstance();
nf.setMaximumFractionDigits(15);
- Debug.debug("value", nf.format(value));
- Debug.debug("rational", rational);
- Debug.debug("difference", difference);
+ Debug.debug("value: " + nf.format(value));
+ Debug.debug("rational: " + rational);
+ Debug.debug("difference: " + difference);
Debug.debug();
}
}
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/common/bytesource/ByteSourceImageTest.java Tue Nov 26 13:36:44 2013
@@ -33,6 +33,7 @@ import org.apache.commons.imaging.ImageF
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.util.Debug;
import org.apache.commons.io.FileUtils;
@@ -42,7 +43,7 @@ public class ByteSourceImageTest extends
final List<File> imageFiles = getTestImages();
for (int i = 0; i < imageFiles.size(); i++) {
if (i % 1 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = imageFiles.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/bmp/BmpReadTest.java Tue Nov 26 13:36:44 2013
@@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
@@ -36,7 +37,7 @@ public class BmpReadTest extends BmpBase
final List<File> images = getBmpImages();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java Tue Nov 26 13:36:44 2013
@@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
@@ -36,7 +37,7 @@ public class DcxReadTest extends DcxBase
final List<File> images = getDcxImages();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java Tue Nov 26 13:36:44 2013
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
@@ -34,7 +35,7 @@ public class GifReadTest extends GifBase
final List<File> images = getGifImages();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java Tue Nov 26 13:36:44 2013
@@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
@@ -36,7 +37,7 @@ public class IcnsReadTest extends IcnsBa
final List<File> images = getIcnsImages();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java Tue Nov 26 13:36:44 2013
@@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
@@ -36,7 +37,7 @@ public class IcoReadTest extends IcoBase
final List<File> images = getIcoImages();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java Tue Nov 26 13:36:44 2013
@@ -26,6 +26,7 @@ import java.util.Map;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.IImageMetadata;
import org.apache.commons.imaging.util.Debug;
@@ -35,7 +36,7 @@ public class JpegReadTest extends JpegBa
final List<File> images = getJpegImages();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java Tue Nov 26 13:36:44 2013
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.bytesource.ByteSource;
import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
@@ -39,7 +40,7 @@ public class ExifDumpTest extends ExifBa
final List<File> images = getImagesWithExifData();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriteTest.java Tue Nov 26 13:36:44 2013
@@ -31,6 +31,7 @@ import java.util.Set;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.common.IImageMetadata.IImageMetadataItem;
import org.apache.commons.imaging.common.bytesource.ByteSource;
import org.apache.commons.imaging.common.bytesource.ByteSourceArray;
@@ -55,7 +56,7 @@ public class ExifRewriteTest extends Exi
final List<File> images = getImagesWithExifData();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
@@ -96,7 +97,7 @@ public class ExifRewriteTest extends Exi
final List<File> images = getImagesWithExifData();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
@@ -177,7 +178,7 @@ public class ExifRewriteTest extends Exi
final List<File> images = getImagesWithExifData();
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/GpsTest.java Tue Nov 26 13:36:44 2013
@@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingConstants;
+import org.apache.commons.imaging.TestUtils;
import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
import org.apache.commons.imaging.util.Debug;
@@ -35,7 +36,7 @@ public class GpsTest extends ExifBaseTes
final List<File> images = getImagesWithExifData(300);
for (int i = 0; i < images.size(); i++) {
if (i % 10 == 0) {
- Debug.purgeMemory();
+ TestUtils.purgeMemory();
}
final File imageFile = images.get(i);
@@ -70,17 +71,14 @@ public class GpsTest extends ExifBaseTes
continue;
}
- Debug.debug("imageFile", imageFile);
- Debug.debug("gpsInfo", gpsInfo);
- Debug.debug("gpsInfo longitude as degrees east",
- gpsInfo.getLongitudeAsDegreesEast());
- Debug.debug("gpsInfo latitude as degrees north",
- gpsInfo.getLatitudeAsDegreesNorth());
-
+ Debug.debug("imageFile " + imageFile);
+ Debug.debug("gpsInfo " + gpsInfo);
+ Debug.debug("gpsInfo longitude as degrees east " + gpsInfo.getLongitudeAsDegreesEast());
+ Debug.debug("gpsInfo latitude as degrees north " + gpsInfo.getLatitudeAsDegreesNorth());
Debug.debug();
} catch (final Exception e) {
- Debug.debug("imageFile", imageFile.getAbsoluteFile());
- Debug.debug("imageFile", imageFile.length());
+ Debug.debug("imageFile " + imageFile.getAbsoluteFile());
+ Debug.debug("imageFile " + imageFile.length());
Debug.debug(e, 13);
// File brokenFolder = new File(imageFile.getParentFile(),
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java?rev=1545653&r1=1545652&r2=1545653&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/MakerNoteFieldTest.java Tue Nov 26 13:36:44 2013
@@ -42,14 +42,14 @@ public class MakerNoteFieldTest extends
return;
}
- Debug.debug("imageFile", imageFile);
- Debug.debug("field", field);
- Debug.debug("field", Debug.getType(field));
+ Debug.debug("imageFile: " + imageFile);
+ Debug.debug("field: " + field);
+ Debug.debug("type: " + field.getClass().getSimpleName());
- Debug.debug("field", field.getTag());
- Debug.debug("field", field.getTagInfo());
- Debug.debug("length", field.getCount());
- Debug.debug("fieldType", field.getFieldType());
+ Debug.debug("field: " + field.getTag());
+ Debug.debug("field: " + field.getTagInfo());
+ Debug.debug("length: " + field.getCount());
+ Debug.debug("fieldType: " + field.getFieldType());
// Debug.debug("field", Debug.getType(field));
Debug.debug();