You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by vh...@apache.org on 2012/05/28 18:05:31 UTC
svn commit: r1343307 [1/2] - in
/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript: ./ lib/build/
src/java/org/apache/xmlgraphics/fonts/
src/java/org/apache/xmlgraphics/image/codec/png/
src/java/org/apache/xmlgraphics/image/codec/tiff/ src/java/or...
Author: vhennebert
Date: Mon May 28 16:05:29 2012
New Revision: 1343307
URL: http://svn.apache.org/viewvc?rev=1343307&view=rev
Log:
Merged changes from trunk up to revision 1337172
Added:
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/
- copied from r1343305, xmlgraphics/commons/trunk/lib/build/
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/hamcrest.core-1.1.0.LICENSE.txt
- copied unchanged from r1343305, xmlgraphics/commons/trunk/lib/build/hamcrest.core-1.1.0.LICENSE.txt
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/hamcrest.core-1.1.0.jar
- copied unchanged from r1343305, xmlgraphics/commons/trunk/lib/build/hamcrest.core-1.1.0.jar
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/mockito-core-1.8.5.LICENCE.txt
- copied unchanged from r1343305, xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.LICENCE.txt
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/mockito-core-1.8.5.NOTICE.txt
- copied unchanged from r1343305, xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.NOTICE.txt
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/mockito-core-1.8.5.jar
- copied unchanged from r1343305, xmlgraphics/commons/trunk/lib/build/mockito-core-1.8.5.jar
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/objenesis-1.0.0.LICENSE.txt
- copied unchanged from r1343305, xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.LICENSE.txt
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/lib/build/objenesis-1.0.0.jar
- copied unchanged from r1343305, xmlgraphics/commons/trunk/lib/build/objenesis-1.0.0.jar
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/DateFormatUtil.java
- copied unchanged from r1343305, xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/DateFormatUtil.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/util/DoubleFormatUtil.java
- copied unchanged from r1343305, xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/DoubleFormatUtil.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/java2d/ps/
- copied from r1343305, xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
- copied unchanged from r1343305, xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2DTestCase.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/util/DateFormatUtilTestCase.java
- copied unchanged from r1343305, xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/DateFormatUtilTestCase.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/util/DoubleFormatUtilTest.java
- copied unchanged from r1343305, xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/DoubleFormatUtilTest.java
Removed:
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/xmp/DateFormattingTest.java
Modified:
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/ (props changed)
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/KEYS
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/build.xml
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/fonts/Glyphs.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFEncodeParam.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageDecoder.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/TransformType.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/color/ICCColorSpaceWithIntent.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/color/profile/ColorProfileUtil.java (props changed)
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphicsConfiguration.java (props changed)
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphicsDevice.java (props changed)
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/PSGenerator.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPArray.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/resources/org/apache/xmlgraphics/image/codec/Messages.properties
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/status.xml
xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/test/java/org/apache/xmlgraphics/util/ServiceTest.java
Propchange: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/
------------------------------------------------------------------------------
Merged /xmlgraphics/commons/trunk:r1308327-1343305
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/KEYS
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/KEYS?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/KEYS (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/KEYS Mon May 28 16:05:29 2012
@@ -327,3 +327,39 @@ ZAiIYSaFU+YapzevSpCITwQYEQIADwUCRR41qQIb
JCaWAKCbFrAAM1xAOda4Wkn+NodF2EMosACeOEChn8Oeu4bPGP4DuLJgQH0jpSQ=
=geh1
-----END PGP PUBLIC KEY BLOCK-----
+pub 2048R/0ED3D317 2012-04-09 [expires: 2017-04-08]
+uid Glenn Adams <ga...@apache.org>
+sig 3 0ED3D317 2012-04-09 Glenn Adams <ga...@apache.org>
+sub 2048R/F23E86C1 2012-04-09 [expires: 2017-04-08]
+sig 0ED3D317 2012-04-09 Glenn Adams <ga...@apache.org>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.11 (Darwin)
+
+mQENBE+DFvEBCACwHesM5hkZrlgPiq588FbZPe7QGtDRVdh0YbgI2A4Ky2odbFmA
+/n7lF9v+yf+FUn/0H2igwDYqLFx4JsB7z+Nvj+hwExdGQxuDaGSwMjjpJeEiuEmf
+b1Er5KYgpeFNm1MVP+r5kW5962O+HGIEx1xQ85AskNbr/jQkAg/wbbwWLFBQRMER
+PqFs1rXL2aWip8XtNPKnKBLPlFPn9a7glgB5Whgbls44KpR0dplAVoCWMnZEYnTA
+JYITcaDTCGFQI7aYgbj986RpS80o/Wcsnb8rjHKRZG8TaDr9MbgmmK39KwiJCflJ
+9LvXR9g1j3addxgqEUuQBEtoLkWs/eDT/KQ7ABEBAAG0H0dsZW5uIEFkYW1zIDxn
+YWRhbXNAYXBhY2hlLm9yZz6JAT4EEwECACgFAk+DFvECGwMFCQlmAYAGCwkIBwMC
+BhUIAgkKCwQWAgMBAh4BAheAAAoJEGZUur4O09MXl7MH/jfeyE012/ABTTjvwvRw
+2evD3cfghrZOQVT3PVEcVnXIcnVlmznO2DDs8aWXlhJ94ZnNdw8iKE8weK1FGXdd
+qWA7vHrOI1UAo7h+CDaBt0TM6OEM3Mp3+5baOJMRXyrjhbv74sj88HYRtoPhA2+z
+5ilVNmmX4PEAc6wqt87ZfNQ2ZqX2YzR+OaT5OggSB12qU/uE7d4d0NcDozEKQFUP
+CMAuPJRNd4/J5yFy0DStfgsDKuUTir0oldlUElAjbhF8WtAgRwufIYuG/r4Cbuid
+Qc32yVAoy069ZcggwBpkzVPOpL2by1fzeSohjIkntDIL474KuSSoBKCuw2nYxpyw
+b0O5AQ0ET4MW8QEIAMFUAScm2Dw1fmBhmKMVc0mzqpR8TvSQvwJLiXRSP86NI1zc
+DtuiXCFfNZykOifFk50otMH1hd91hqeQ6HfsxxYtXLg2UDHG2gTKzlWefwA+1eFc
+M8fz/oV0CanGjqaOd6VZoYeg+LSD6YgrJZVjuoxNN/S0A9fNd8B3CXsG+92udkkW
+YMyiUpD5qjMEwcjmj6ITX3M9VLxDCKKhYwN+u5wokuAk3yKtvBpWhJDQbaJcuDaC
+rLH788gFybZDzyJ8Ug/95peV9Z57OCjMJLtn67ES7fB544EQRYVmDGnX5tTo9sYj
+0bDjlbKX9lqS1sCGSezPxYxGgeXlnQrt+Sm+gd0AEQEAAYkBJQQYAQIADwUCT4MW
+8QIbDAUJCWYBgAAKCRBmVLq+DtPTF2YbB/0Vo8Xr9N1adqlY1UAofvo5AoXZFxFJ
+jkB0Eb3z1V3iSBh8P921LD0gUQz6JXptXZPVGnwgm/44RdqXC+kX+4MxiVBtNAHp
+0ODjIXiabBrixAHnT7EcAJkWue0RP2J5wiYKklwWFbEetjl0QSmitz8Jh33eA76j
+kFYW+vgKUMA8UrJ6j2Hk+vMFi0Odtntbc7AXvLifSPSmSztNe/Mws69EbuBph6bQ
++zSmTQ6nt8PX+v3e0PnkXdGD8si9H6hj0K32pEMz86ttSnAtrhvsAdKPYOkY7/JD
+0Bl+bnb7FLxJjJGlGuO/Rn5SIR3fFNQGrE/zl2wsKtftUXse6kkZSue+
+=XDBB
+-----END PGP PUBLIC KEY BLOCK-----
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/build.xml?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/build.xml (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/build.xml Mon May 28 16:05:29 2012
@@ -35,6 +35,9 @@
<property name="javac.fork" value="no"/>
<property name="junit.fork" value="on"/>
+ <property name="junit.haltonfailure" value="off"/>
+ <property name="junit.printsummary" value="off"/>
+ <property name="junit.formatter.brief" value="on"/>
<property name="javadoc.packages" value="org.apache.xmlgraphics.*"/>
@@ -68,6 +71,12 @@
</fileset>
</path>
+ <path id="libs-tools-build-classpath">
+ <fileset dir="${lib.dir}/build">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
<path id="libs-run-classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
@@ -202,7 +211,7 @@
<mkdir dir="${build.classes.dir}"/>
<javac destdir="${build.classes.dir}" fork="${javac.fork}" debug="${javac.debug}"
deprecation="${javac.deprecation}" optimize="${javac.optimize}"
- source="${javac.source}" target="${javac.target}">
+ source="${javac.source}" target="${javac.target}" includeAntRuntime="true">
<src path="${src.java.dir}"/>
<patternset refid="compile-pattern"/>
<classpath refid="libs-build-classpath"/>
@@ -275,17 +284,23 @@
<!-- =================================================================== -->
<!-- Testing -->
<!-- =================================================================== -->
- <target name="junit-compile" depends="package" if="junit.present">
+ <target name="junit-init" depends="init-avail">
+ <condition property="junit.formatter.brief.use">
+ <istrue value="${junit.formatter.brief}"/>
+ </condition>
+ </target>
+ <target name="junit-compile" depends="package,junit-init" if="junit.present">
<mkdir dir="${build.dir}/test-classes"/>
<mkdir dir="${build.dir}/test-reports"/>
<javac destdir="${build.dir}/test-classes" fork="${javac.fork}"
debug="${javac.debug}" deprecation="${javac.deprecation}"
optimize="${javac.optimize}" source="${javac.source}"
- target="${javac.target}">
+ target="${javac.target}" includeAntRuntime="true">
<src path="${basedir}/test/java"/>
<patternset refid="compile-pattern"/>
<classpath>
<path refid="libs-build-classpath"/>
+ <path refid="libs-tools-build-classpath"/>
<fileset dir="${build.dir}">
<include name="${name}-${version}.jar"/>
</fileset>
@@ -299,19 +314,19 @@
</fileset>
</copy>
</target>
-
<target name="junit-basic" depends="junit-compile" description="Runs the standard JUnit test suite" if="junit.present">
<echo message="Running basic functionality tests"/>
- <junit haltonerror="no" fork="${junit.fork}" errorproperty="test.junit.error" failureproperty="test.junit.failure">
+ <junit haltonerror="no" haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" errorproperty="test.junit.error" failureproperty="test.junit.failure" printsummary="${junit.printsummary}">
<sysproperty key="basedir" value="${basedir}"/>
<sysproperty key="jawa.awt.headless" value="true"/>
<jvmarg value="-enableassertions"/>
- <formatter type="brief" usefile="false"/>
+ <formatter type="brief" usefile="false" if="junit.formatter.brief.use"/>
<formatter type="plain" usefile="true"/>
<formatter type="xml" usefile="true"/>
<classpath>
<pathelement location="${build.dir}/test-classes"/>
<path refid="libs-build-classpath"/>
+ <path refid="libs-tools-build-classpath"/>
<fileset dir="build">
<include name="${name}-${version}.jar"/>
</fileset>
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/fonts/Glyphs.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/fonts/Glyphs.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/fonts/Glyphs.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/fonts/Glyphs.java Mon May 28 16:05:29 2012
@@ -585,7 +585,7 @@ public class Glyphs {
List lines = new java.util.ArrayList();
InputStream in = Glyphs.class.getResourceAsStream(filename);
if (in == null) {
- throw new Error("Cannot load " + filename
+ throw new RuntimeException("Cannot load " + filename
+ ". The Glyphs class cannot properly be initialized!");
}
try {
@@ -597,10 +597,10 @@ public class Glyphs {
}
}
} catch (UnsupportedEncodingException uee) {
- throw new Error("Incompatible JVM! US-ASCII encoding is not supported."
+ throw new RuntimeException("Incompatible JVM! US-ASCII encoding is not supported."
+ " The Glyphs class cannot properly be initialized!");
} catch (IOException ioe) {
- throw new Error("I/O error while loading " + filename
+ throw new RuntimeException("I/O error while loading " + filename
+ ". The Glyphs class cannot properly be initialized!");
} finally {
IOUtils.closeQuietly(in);
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGEncodeParam.java Mon May 28 16:05:29 2012
@@ -307,7 +307,7 @@ public abstract class PNGEncodeParam imp
public void setBitDepth(int bitDepth) {
if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 &&
bitDepth != 8 && bitDepth != 16) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam2"));
}
this.bitDepth = bitDepth;
bitDepthSet = true;
@@ -391,7 +391,7 @@ public abstract class PNGEncodeParam imp
*/
public void setBitShift(int bitShift) {
if (bitShift < 0) {
- throw new RuntimeException();
+ throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam25"));
}
this.bitShift = bitShift;
bitShiftSet = true;
@@ -464,7 +464,7 @@ public abstract class PNGEncodeParam imp
*/
public void setBitDepth(int bitDepth) {
if (bitDepth != 8 && bitDepth != 16) {
- throw new RuntimeException();
+ throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam26"));
}
this.bitDepth = bitDepth;
bitDepthSet = true;
@@ -482,7 +482,7 @@ public abstract class PNGEncodeParam imp
*/
public void setBackgroundRGB(int[] rgb) {
if (rgb.length != 3) {
- throw new RuntimeException();
+ throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam27"));
}
backgroundRGB = rgb;
backgroundSet = true;
@@ -637,7 +637,7 @@ public abstract class PNGEncodeParam imp
*/
public void setChromaticity(float[] chromaticity) {
if (chromaticity.length != 8) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(PropertyUtil.getString("PNGEncodeParam28"));
}
this.chromaticity = (float[])(chromaticity.clone());
chromaticitySet = true;
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageEncoder.java Mon May 28 16:05:29 2012
@@ -39,6 +39,7 @@ import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
import org.apache.xmlgraphics.image.codec.util.ImageEncoderImpl;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
class CRC {
@@ -895,7 +896,7 @@ public class PNGImageEncoder extends Ima
// Ensure all channels have the same bit depth
for (int i = 1; i < sampleSize.length; i++) {
if (sampleSize[i] != bitDepth) {
- throw new RuntimeException();
+ throw new RuntimeException(PropertyUtil.getString("PNGImageEncoder0"));
}
}
@@ -907,7 +908,7 @@ public class PNGImageEncoder extends Ima
} else if (bitDepth > 8 && bitDepth < 16) {
bitDepth = 16;
} else if (bitDepth > 16) {
- throw new RuntimeException();
+ throw new RuntimeException(PropertyUtil.getString("PNGImageEncoder1"));
}
}
@@ -917,10 +918,10 @@ public class PNGImageEncoder extends Ima
ColorModel colorModel = image.getColorModel();
if (colorModel instanceof IndexColorModel) {
if (bitDepth < 1 || bitDepth > 8) {
- throw new RuntimeException();
+ throw new RuntimeException(PropertyUtil.getString("PNGImageEncoder2"));
}
if (sampleModel.getNumBands() != 1) {
- throw new RuntimeException();
+ throw new RuntimeException(PropertyUtil.getString("PNGImageEncoder3"));
}
IndexColorModel icm = (IndexColorModel)colorModel;
@@ -970,7 +971,7 @@ public class PNGImageEncoder extends Ima
redPalette = greenPalette = bluePalette = alphaPalette = null;
this.colorType = PNG_COLOR_GRAY;
} else {
- throw new RuntimeException();
+ throw new RuntimeException(PropertyUtil.getString("PNGImageEncoder4"));
}
} else if (numBands == 1) {
if (param == null) {
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java Mon May 28 16:05:29 2012
@@ -27,6 +27,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
import org.apache.xmlgraphics.image.codec.util.SeekableStream;
/**
@@ -98,15 +99,13 @@ public class TIFFDirectory implements Se
stream.seek(0L);
int endian = stream.readUnsignedShort();
if (!isValidEndianTag(endian)) {
- throw new
- IllegalArgumentException("TIFFDirectory1");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory1"));
}
isBigEndian = (endian == 0x4d4d);
int magic = readUnsignedShort(stream);
if (magic != 42) {
- throw new
- IllegalArgumentException("TIFFDirectory2");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory2"));
}
// Get the initial ifd offset as an unsigned int (using a long)
@@ -114,8 +113,7 @@ public class TIFFDirectory implements Se
for (int i = 0; i < directory; i++) {
if (ifd_offset == 0L) {
- throw new
- IllegalArgumentException("TIFFDirectory3");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory3"));
}
stream.seek(ifd_offset);
@@ -125,8 +123,7 @@ public class TIFFDirectory implements Se
ifd_offset = readUnsignedInt(stream);
}
if (ifd_offset == 0L) {
- throw new
- IllegalArgumentException("TIFFDirectory3");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory3"));
}
stream.seek(ifd_offset);
@@ -154,8 +151,7 @@ public class TIFFDirectory implements Se
stream.seek(0L);
int endian = stream.readUnsignedShort();
if (!isValidEndianTag(endian)) {
- throw new
- IllegalArgumentException("TIFFDirectory1");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory1"));
}
isBigEndian = (endian == 0x4d4d);
@@ -227,8 +223,7 @@ public class TIFFDirectory implements Se
stream.seek(value);
}
} catch (ArrayIndexOutOfBoundsException ae) {
-
- System.err.println(tag + " " + "TIFFDirectory4");
+ // System.err.println(tag + " " + "TIFFDirectory4"); TODO - log this message
// if the data type is unknown we should skip this TIFF Field
stream.seek(nextTagOffset);
continue;
@@ -338,8 +333,7 @@ public class TIFFDirectory implements Se
break;
default:
- System.err.println("TIFFDirectory0");
- break;
+ throw new RuntimeException(PropertyUtil.getString("TIFFDirectory0"));
}
fields[i] = new TIFFField(tag, type, count, obj);
@@ -580,14 +574,12 @@ public class TIFFDirectory implements Se
stream.seek(0L);
int endian = stream.readUnsignedShort();
if (!isValidEndianTag(endian)) {
- throw new
- IllegalArgumentException("TIFFDirectory1");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory1"));
}
boolean isBigEndian = (endian == 0x4d4d);
int magic = readUnsignedShort(stream, isBigEndian);
if (magic != 42) {
- throw new
- IllegalArgumentException("TIFFDirectory2");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory2"));
}
stream.seek(4L);
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFEncodeParam.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFEncodeParam.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFEncodeParam.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFEncodeParam.java Mon May 28 16:05:29 2012
@@ -23,6 +23,7 @@ import java.util.Iterator;
import java.util.zip.Deflater;
import org.apache.xmlgraphics.image.codec.util.ImageEncodeParam;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
/**
* An instance of <code>ImageEncodeParam</code> for encoding images in
@@ -149,7 +150,7 @@ public class TIFFEncodeParam implements
// Do nothing.
break;
default:
- throw new Error("TIFFEncodeParam0");
+ throw new RuntimeException(PropertyUtil.getString("TIFFEncodeParam0"));
}
this.compression = compression;
@@ -250,7 +251,7 @@ public class TIFFEncodeParam implements
if (deflateLevel < 1
&& deflateLevel > 9
&& deflateLevel != Deflater.DEFAULT_COMPRESSION) {
- throw new Error("TIFFEncodeParam1");
+ throw new RuntimeException(PropertyUtil.getString("TIFFEncodeParam1"));
}
this.deflateLevel = deflateLevel;
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFFaxDecoder.java Mon May 28 16:05:29 2012
@@ -19,6 +19,8 @@
package org.apache.xmlgraphics.image.codec.tiff;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
+
class TIFFFaxDecoder {
private int bitPointer, bytePointer;
@@ -614,9 +616,9 @@ class TIFFFaxDecoder {
updatePointer(4 - bits);
} else if (bits == 0) { // ERROR
- throw new Error("TIFFFaxDecoder0");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder0"));
} else if (bits == 15) { // EOL
- throw new Error("TIFFFaxDecoder1");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder1"));
} else {
// 11 bits - 0000 0111 1111 1111 = 0x07ff
code = (entry >>> 5) & 0x07ff;
@@ -672,7 +674,7 @@ class TIFFFaxDecoder {
updatePointer(4 - bits);
} else if (bits == 15) {
// EOL code
- throw new Error("TIFFFaxDecoder2");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder2"));
} else {
setToBlack(buffer, lineOffset, bitOffset, code);
bitOffset += code;
@@ -753,7 +755,7 @@ class TIFFFaxDecoder {
// The data must start with an EOL code
if (readEOL() != 1) {
- throw new Error("TIFFFaxDecoder3");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder3"));
}
int lineOffset = 0;
@@ -855,7 +857,7 @@ class TIFFFaxDecoder {
updatePointer(7 - bits);
} else {
- throw new Error("TIFFFaxDecoder4");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder4"));
}
}
@@ -1002,7 +1004,7 @@ class TIFFFaxDecoder {
updatePointer(7 - bits);
} else if (code == 11) {
if (nextLesserThan8Bits(3) != 7) {
- throw new Error("TIFFFaxDecoder5");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder5"));
}
int zeros = 0;
@@ -1068,7 +1070,7 @@ class TIFFFaxDecoder {
}
} else {
- throw new Error("TIFFFaxDecoder5");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder5"));
}
}
@@ -1144,9 +1146,9 @@ class TIFFFaxDecoder {
runLength += code;
updatePointer(4 - bits);
} else if (bits == 0) { // ERROR
- throw new Error("TIFFFaxDecoder0");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder0"));
} else if (bits == 15) { // EOL
- throw new Error("TIFFFaxDecoder1");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder1"));
} else {
// 11 bits - 0000 0111 1111 1111 = 0x07ff
code = (entry >>> 5) & 0x07ff;
@@ -1197,7 +1199,7 @@ class TIFFFaxDecoder {
updatePointer(4 - bits);
} else if (bits == 15) {
// EOL code
- throw new Error("TIFFFaxDecoder2");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder2"));
} else {
runLength += code;
updatePointer(9 - bits);
@@ -1228,7 +1230,7 @@ class TIFFFaxDecoder {
private int readEOL() {
if (fillBits == 0) {
if (nextNBits(12) != 1) {
- throw new Error("TIFFFaxDecoder6");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder6"));
}
} else if (fillBits == 1) {
@@ -1239,7 +1241,7 @@ class TIFFFaxDecoder {
int bitsLeft = 8 - bitPointer;
if (nextNBits(bitsLeft) != 0) {
- throw new Error("TIFFFaxDecoder8");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder8"));
}
// If the number of bitsLeft is less than 8, then to have a 12
@@ -1248,7 +1250,7 @@ class TIFFFaxDecoder {
// that.
if (bitsLeft < 4) {
if (nextNBits(8) != 0) {
- throw new Error("TIFFFaxDecoder8");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder8"));
}
}
@@ -1260,7 +1262,7 @@ class TIFFFaxDecoder {
// If not all zeros
if (n != 0) {
- throw new Error("TIFFFaxDecoder8");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder8"));
}
}
}
@@ -1337,7 +1339,7 @@ class TIFFFaxDecoder {
next2next = flipTable[data[bp + 2] & 0xff];
}
} else {
- throw new Error("TIFFFaxDecoder7");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder7"));
}
int bitsLeft = 8 - bitPointer;
@@ -1394,7 +1396,7 @@ class TIFFFaxDecoder {
next = flipTable[data[bp + 1] & 0xff];
}
} else {
- throw new Error("TIFFFaxDecoder7");
+ throw new RuntimeException(PropertyUtil.getString("TIFFFaxDecoder7"));
}
int bitsLeft = 8 - bitPointer;
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFField.java Mon May 28 16:05:29 2012
@@ -437,13 +437,13 @@ public class TIFFField implements Compar
* <p><b>Note: this class has a natural ordering that is inconsistent
* with <code>equals()</code>.</b>
*
- * @throws IllegalArgumentException if the parameter is <code>null</code>.
+ * @throws NullPointerException if the parameter is <code>null</code>.
* @throws ClassCastException if the parameter is not a
* <code>TIFFField</code>.
*/
public int compareTo(Object o) {
if(o == null) {
- throw new IllegalArgumentException();
+ throw new NullPointerException();
}
int oTag = ((TIFFField)o).getTag();
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImage.java Mon May 28 16:05:29 2012
@@ -41,6 +41,7 @@ import java.util.Map;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
import org.apache.xmlgraphics.image.codec.util.SeekableStream;
import org.apache.xmlgraphics.image.rendered.AbstractRed;
import org.apache.xmlgraphics.image.rendered.CachableRed;
@@ -122,7 +123,7 @@ public class TIFFImage extends AbstractR
try {
inflater.inflate(inflated);
} catch (DataFormatException dfe) {
- throw new RuntimeException("TIFFImage17" + ": " +
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage17") + ": " +
dfe.getMessage());
}
inflater.reset();
@@ -154,7 +155,8 @@ public class TIFFImage extends AbstractR
} else if (field.getType() == TIFFField.TIFF_LONG) {
value = field.getAsLongs();
} else {
- throw new RuntimeException();
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage18") + ": "
+ + field.getType());
}
return value;
@@ -200,7 +202,7 @@ public class TIFFImage extends AbstractR
// Support planar format (band sequential) only for 1 sample/pixel.
if (planarConfiguration[0] != 1 && samplesPerPixel != 1) {
- throw new RuntimeException("TIFFImage0");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage0"));
}
// Read the TIFF_BITS_PER_SAMPLE field
@@ -215,7 +217,7 @@ public class TIFFImage extends AbstractR
// Ensure that all samples have the same bit depth.
for (int i = 1; i < bitsPerSample.length; i++) {
if (bitsPerSample[i] != bitsPerSample[0]) {
- throw new RuntimeException("TIFFImage1");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage1"));
}
}
}
@@ -233,7 +235,7 @@ public class TIFFImage extends AbstractR
// Check that all the samples have the same format
for (int l = 1; l < sampleFormat.length; l++) {
if (sampleFormat[l] != sampleFormat[0]) {
- throw new RuntimeException("TIFFImage2");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage2"));
}
}
@@ -271,7 +273,7 @@ public class TIFFImage extends AbstractR
}
if (!isValidDataFormat) {
- throw new RuntimeException("TIFFImage3");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage3"));
}
// Figure out what compression if any, is being used.
@@ -338,7 +340,8 @@ public class TIFFImage extends AbstractR
// Bail out if not one of the supported types.
if (imageType == TYPE_UNSUPPORTED) {
- throw new RuntimeException("TIFFImage4");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage4") + ": "
+ + imageType);
}
// Set basic image layout
@@ -403,7 +406,7 @@ public class TIFFImage extends AbstractR
TIFFField tileOffsetsField =
dir.getField(TIFFImageDecoder.TIFF_STRIP_OFFSETS);
if (tileOffsetsField == null) {
- throw new RuntimeException("TIFFImage5");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage5"));
} else {
tileOffsets = getFieldAsLongs(tileOffsetsField);
}
@@ -411,7 +414,7 @@ public class TIFFImage extends AbstractR
TIFFField tileByteCountsField =
dir.getField(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS);
if (tileByteCountsField == null) {
- throw new RuntimeException("TIFFImage6");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage6"));
} else {
tileByteCounts = getFieldAsLongs(tileByteCountsField);
}
@@ -446,7 +449,7 @@ public class TIFFImage extends AbstractR
case COMP_FAX_G3_2D:
case COMP_FAX_G4_2D:
if (sampleSize != 1) {
- throw new RuntimeException("TIFFImage7");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage7"));
}
// Fax T.4 compression options
@@ -489,12 +492,11 @@ public class TIFFImage extends AbstractR
predictor = predictorField.getAsInt(0);
if (predictor != 1 && predictor != 2) {
- throw new RuntimeException("TIFFImage8");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage8"));
}
if (predictor == 2 && sampleSize != 8) {
- throw new RuntimeException(sampleSize +
- "TIFFImage9");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage9"));
}
}
@@ -503,11 +505,11 @@ public class TIFFImage extends AbstractR
break;
case COMP_JPEG_OLD:
- throw new RuntimeException("TIFFImage15");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage15"));
default:
- throw new RuntimeException("Compression not supported: " + compression);
- //throw new RuntimeException("TIFFImage10");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage10") + ": "
+ + compression);
}
ColorModel colorModel = null;
@@ -604,7 +606,7 @@ public class TIFFImage extends AbstractR
// Get the colormap
TIFFField cfield = dir.getField(TIFFImageDecoder.TIFF_COLORMAP);
if (cfield == null) {
- throw new RuntimeException("TIFFImage11");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage11"));
} else {
colormap = cfield.getAsChars();
}
@@ -701,7 +703,8 @@ public class TIFFImage extends AbstractR
break;
default:
- throw new RuntimeException("TIFFImage4");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage4") + ": "
+ + imageType);
}
Map properties = new HashMap();
@@ -736,7 +739,7 @@ public class TIFFImage extends AbstractR
public synchronized Raster getTile(int tileX, int tileY) {
if ((tileX < 0) || (tileX >= tilesX) ||
(tileY < 0) || (tileY >= tilesY)) {
- throw new IllegalArgumentException("TIFFImage12");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFImage12"));
}
// System.out.println("Called TIFF getTile:" + tileX + "," + tileY);
@@ -774,7 +777,8 @@ public class TIFFImage extends AbstractR
save_offset = stream.getFilePointer();
stream.seek(tileOffsets[tileY * tilesX + tileX]);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
// Number of bytes in this tile (strip) after compression.
@@ -835,7 +839,8 @@ public class TIFFImage extends AbstractR
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
} else if (imageType == TYPE_PALETTE) { // palette-RGB
if (sampleSize == 16) {
@@ -902,7 +907,8 @@ public class TIFFImage extends AbstractR
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
if (dataType == DataBuffer.TYPE_USHORT) {
@@ -1001,7 +1007,8 @@ public class TIFFImage extends AbstractR
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
}
@@ -1043,14 +1050,15 @@ public class TIFFImage extends AbstractR
tempData = new byte[byteCount];
stream.readFully(tempData, 0, byteCount);
} else {
- throw new RuntimeException(
- "Compression type not supported: " + compression);
+ throw new RuntimeException(PropertyUtil.getString("IFFImage10") + ": "
+ + compression);
}
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
// Expand the palette image into an rgb image with ushort
@@ -1098,14 +1106,15 @@ public class TIFFImage extends AbstractR
stream.readFully(bdata, 0, byteCount);
} else {
- throw new RuntimeException(
- "Compression type not supported: " + compression);
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage10")
+ + ": " + compression);
}
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
}
@@ -1123,7 +1132,8 @@ public class TIFFImage extends AbstractR
stream.readFully(data, 0, byteCount);
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
// If compressed, decode the data.
@@ -1209,7 +1219,8 @@ public class TIFFImage extends AbstractR
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
}
}
@@ -1248,7 +1259,8 @@ public class TIFFImage extends AbstractR
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
} else { // everything else
try {
@@ -1274,8 +1286,8 @@ public class TIFFImage extends AbstractR
inflate(data, bdata);
} else {
- throw new RuntimeException(
- "Compression type not supported: " + compression);
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage10")
+ + ": " + compression);
}
} else if (sampleSize == 16) {
@@ -1371,7 +1383,8 @@ public class TIFFImage extends AbstractR
stream.seek(save_offset);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
// Modify the data for certain special cases.
@@ -1531,7 +1544,8 @@ public class TIFFImage extends AbstractR
try {
stream.readFully(byteArray, 0, byteCount);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
interpretBytesAsShorts(byteArray, shortArray, shortCount);
@@ -1547,7 +1561,8 @@ public class TIFFImage extends AbstractR
try {
stream.readFully(byteArray, 0, byteCount);
} catch (IOException ioe) {
- throw new RuntimeException("TIFFImage13");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage13") + ": " +
+ ioe.getMessage());
}
interpretBytesAsInts(byteArray, intArray, intCount);
@@ -1645,7 +1660,8 @@ public class TIFFImage extends AbstractR
}
}
} catch (java.lang.ArrayIndexOutOfBoundsException ae) {
- throw new RuntimeException("TIFFImage14");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImage14") + ": " +
+ ae.getMessage());
}
return dst;
@@ -1668,7 +1684,8 @@ public class TIFFImage extends AbstractR
cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
break;
default:
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFImage19") + ": " +
+ numBands);
}
int componentSize = 0;
@@ -1684,7 +1701,8 @@ public class TIFFImage extends AbstractR
componentSize = 32;
break;
default:
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFImage20") + ": " +
+ dataType);
}
RGBBits = new int[numBands];
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageDecoder.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageDecoder.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageDecoder.java Mon May 28 16:05:29 2012
@@ -24,6 +24,7 @@ import java.io.IOException;
import org.apache.xmlgraphics.image.codec.util.ImageDecodeParam;
import org.apache.xmlgraphics.image.codec.util.ImageDecoderImpl;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
import org.apache.xmlgraphics.image.codec.util.SeekableStream;
/**
@@ -84,7 +85,7 @@ public class TIFFImageDecoder extends Im
public RenderedImage decodeAsRenderedImage(int page) throws IOException {
if ((page < 0) || (page >= getNumPages())) {
- throw new IOException("TIFFImageDecoder0");
+ throw new IOException(PropertyUtil.getString("TIFFImageDecoder0"));
}
return new TIFFImage(input, (TIFFDecodeParam)param, page);
}
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFImageEncoder.java Mon May 28 16:05:29 2012
@@ -45,6 +45,7 @@ import java.util.zip.Deflater;
import org.apache.xmlgraphics.image.codec.util.ImageEncodeParam;
import org.apache.xmlgraphics.image.codec.util.ImageEncoderImpl;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
import org.apache.xmlgraphics.image.codec.util.SeekableOutputStream;
/**
@@ -146,8 +147,7 @@ public class TIFFImageEncoder extends Im
// Get the encoding parameters.
TIFFEncodeParam encodeParam = (TIFFEncodeParam)param;
if (encodeParam.getExtraImages() != null) {
- throw new IllegalStateException(
- "Extra images may not be used when calling encodeMultiple!");
+ throw new IllegalStateException(PropertyUtil.getString("TIFFImageEncoder11"));
}
Context c = (Context)context;
@@ -171,7 +171,7 @@ public class TIFFImageEncoder extends Im
*/
public void finishMultiple(Object context) throws IOException {
if (context == null) {
- throw new NullPointerException("context must not be null");
+ throw new NullPointerException();
}
Context c = (Context)context;
// Get the encoding parameters.
@@ -194,7 +194,7 @@ public class TIFFImageEncoder extends Im
int compression = encodeParam.getCompression();
if (compression == COMP_JPEG_TTN2) {
- throw new IllegalArgumentException("JPEG compression is not supported");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFImageEncoder12"));
}
// Get tiled output preference.
@@ -213,14 +213,14 @@ public class TIFFImageEncoder extends Im
int[] sampleSize = sampleModel.getSampleSize();
for (int i = 1; i < sampleSize.length; i++) {
if (sampleSize[i] != sampleSize[0]) {
- throw new Error("TIFFImageEncoder0");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder0"));
}
}
// Check low bit limits.
int numBands = sampleModel.getNumBands();
if ((sampleSize[0] == 1 || sampleSize[0] == 4) && numBands != 1) {
- throw new Error("TIFFImageEncoder1");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder1"));
}
// Retrieve and verify data type.
@@ -229,23 +229,23 @@ public class TIFFImageEncoder extends Im
case DataBuffer.TYPE_BYTE:
if (sampleSize[0] != 1 && sampleSize[0] == 4 && // todo does this make sense??
sampleSize[0] != 8) { // we get error only for 4
- throw new Error("TIFFImageEncoder2");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder2"));
}
break;
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
if (sampleSize[0] != 16) {
- throw new Error("TIFFImageEncoder3");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder3"));
}
break;
case DataBuffer.TYPE_INT:
case DataBuffer.TYPE_FLOAT:
if (sampleSize[0] != 32) {
- throw new Error("TIFFImageEncoder4");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder4"));
}
break;
default:
- throw new Error("TIFFImageEncoder5");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder5"));
}
boolean dataTypeIsShort =
@@ -257,7 +257,7 @@ public class TIFFImageEncoder extends Im
colorModel instanceof IndexColorModel &&
dataType != DataBuffer.TYPE_BYTE) {
// Don't support (unsigned) short palette-color images.
- throw new Error("TIFFImageEncoder6");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder6"));
}
IndexColorModel icm = null;
int sizeOfColormap = 0;
@@ -274,8 +274,7 @@ public class TIFFImageEncoder extends Im
if (sampleSize[0] == 1 && numBands == 1) { // Bilevel image
if (mapSize != 2) {
- throw new IllegalArgumentException(
- "TIFFImageEncoder7");
+ throw new IllegalArgumentException(PropertyUtil.getString("TIFFImageEncoder7"));
}
byte[] r = new byte[mapSize];
@@ -365,7 +364,7 @@ public class TIFFImageEncoder extends Im
}
if (imageType == TIFF_UNSUPPORTED) {
- throw new Error("TIFFImageEncoder8");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder8"));
}
int photometricInterpretation = -1;
@@ -431,7 +430,7 @@ public class TIFFImageEncoder extends Im
break;
default:
- throw new Error("TIFFImageEncoder8");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder8"));
}
// Initialize tile dimensions.
@@ -1196,7 +1195,7 @@ public class TIFFImageEncoder extends Im
}
} else {
// This should never happen.
- throw new IllegalStateException();
+ throw new IllegalStateException(PropertyUtil.getString("TIFFImageEncoder13"));
}
}
@@ -1466,7 +1465,7 @@ public class TIFFImageEncoder extends Im
break;
default:
- throw new Error("TIFFImageEncoder10");
+ throw new RuntimeException(PropertyUtil.getString("TIFFImageEncoder10"));
}
@@ -1502,7 +1501,7 @@ public class TIFFImageEncoder extends Im
return ((SeekableOutputStream)out).getFilePointer();
} else {
// Shouldn't happen.
- throw new IllegalStateException();
+ throw new IllegalStateException(PropertyUtil.getString("TIFFImageEncoder13"));
}
}
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/codec/tiff/TIFFLZWDecoder.java Mon May 28 16:05:29 2012
@@ -19,10 +19,10 @@
package org.apache.xmlgraphics.image.codec.tiff;
+import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
+
/**
* A class for performing LZW decoding.
- *
- *
*/
public class TIFFLZWDecoder {
@@ -60,7 +60,7 @@ public class TIFFLZWDecoder {
public byte[] decode(byte[] data, byte[] uncompData, int h) {
if(data[0] == (byte)0x00 && data[1] == (byte)0x01) {
- throw new UnsupportedOperationException("TIFFLZWDecoder0");
+ throw new UnsupportedOperationException(PropertyUtil.getString("TIFFLZWDecoder0"));
}
initializeStringTable();
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/impl/imageio/ImageLoaderImageIO.java Mon May 28 16:05:29 2012
@@ -347,7 +347,8 @@ public class ImageLoaderImageIO extends
// Arbitrarily select a BufferedImage type.
int imageType;
- switch(raster.getNumBands()) {
+ int numBands = raster.getNumBands();
+ switch(numBands) {
case 1:
imageType = BufferedImage.TYPE_BYTE_GRAY;
break;
@@ -358,7 +359,7 @@ public class ImageLoaderImageIO extends
imageType = BufferedImage.TYPE_4BYTE_ABGR;
break;
default:
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException("Unsupported band count: " + numBands);
}
// Create a BufferedImage.
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/loader/spi/ImageImplRegistry.java Mon May 28 16:05:29 2012
@@ -104,19 +104,19 @@ public class ImageImplRegistry {
*/
public void discoverClasspathImplementations() {
//Dynamic registration of ImagePreloaders
- Iterator iter = Service.providers(ImagePreloader.class, true);
+ Iterator iter = Service.providers(ImagePreloader.class);
while (iter.hasNext()) {
registerPreloader((ImagePreloader)iter.next());
}
//Dynamic registration of ImageLoaderFactories
- iter = Service.providers(ImageLoaderFactory.class, true);
+ iter = Service.providers(ImageLoaderFactory.class);
while (iter.hasNext()) {
registerLoaderFactory((ImageLoaderFactory)iter.next());
}
//Dynamic registration of ImageConverters
- iter = Service.providers(ImageConverter.class, true);
+ iter = Service.providers(ImageConverter.class);
while (iter.hasNext()) {
registerConverter((ImageConverter)iter.next());
}
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/image/rendered/RenderedImageCachableRed.java Mon May 28 16:05:29 2012
@@ -53,7 +53,7 @@ public class RenderedImageCachableRed im
public RenderedImageCachableRed(RenderedImage src) {
if(src == null){
- throw new IllegalArgumentException();
+ throw new NullPointerException();
}
this.src = src;
}
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/AbstractGraphics2D.java Mon May 28 16:05:29 2012
@@ -906,7 +906,7 @@ public abstract class AbstractGraphics2D
} catch(NoninvertibleTransformException e){
// Should never happen since we checked the
// matrix determinant
- throw new Error();
+ throw new RuntimeException(e);
}
gc.transform(xform);
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/TransformType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/TransformType.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/TransformType.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/TransformType.java Mon May 28 16:05:29 2012
@@ -105,7 +105,7 @@ public class TransformType{
case TRANSFORM_GENERAL:
return TransformType.GENERAL;
default:
- throw new Error("Unknown TransformType value");
+ throw new RuntimeException("Unknown TransformType value");
}
}
}
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/color/ICCColorSpaceWithIntent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/color/ICCColorSpaceWithIntent.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/color/ICCColorSpaceWithIntent.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/color/ICCColorSpaceWithIntent.java Mon May 28 16:05:29 2012
@@ -85,7 +85,7 @@ public class ICCColorSpaceWithIntent ext
case SATURATION:
return saturationToRGB(values);
default:
- throw new Error("invalid intent:" + intent );
+ throw new RuntimeException("invalid intent:" + intent );
}
}
Propchange: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/color/profile/ColorProfileUtil.java
------------------------------------------------------------------------------
Merged /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/color/profile/ColorProfileUtil.java:r1034386-1343305
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphics2D.java Mon May 28 16:05:29 2012
@@ -456,8 +456,7 @@ public class PSGraphics2D extends Abstra
gen.saveGraphicsState();
AffineTransform trans = getTransform();
- boolean newTransform = gen.getCurrentState().checkTransform(trans)
- && !trans.isIdentity();
+ boolean newTransform = !trans.isIdentity();
if (newTransform) {
gen.concatMatrix(trans);
@@ -756,8 +755,7 @@ public class PSGraphics2D extends Abstra
gen.saveGraphicsState();
AffineTransform trans = getTransform();
- boolean newTransform = gen.getCurrentState().checkTransform(trans)
- && !trans.isIdentity();
+ boolean newTransform = !trans.isIdentity();
if (newTransform) {
gen.concatMatrix(trans);
Propchange: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphicsConfiguration.java
------------------------------------------------------------------------------
Merged /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphicsConfiguration.java:r1034386-1343305
Propchange: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphicsDevice.java
------------------------------------------------------------------------------
Merged /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/java2d/ps/PSGraphicsDevice.java:r1034386-1343305
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/PSGenerator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/PSGenerator.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/PSGenerator.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/PSGenerator.java Mon May 28 16:05:29 2012
@@ -27,10 +27,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
import java.util.Date;
-import java.util.Locale;
import java.util.Stack;
import javax.xml.transform.Source;
@@ -43,6 +40,7 @@ import org.apache.commons.logging.LogFac
import org.apache.xmlgraphics.java2d.color.ColorUtil;
import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives;
import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
+import org.apache.xmlgraphics.util.DoubleFormatUtil;
/**
* This class is used to output PostScript code to an OutputStream. This class assumes that
@@ -79,9 +77,8 @@ public class PSGenerator implements PSCo
private Stack<PSState> graphicsStateStack = new Stack<PSState>();
private PSState currentState;
- //private DecimalFormat df3 = new DecimalFormat("0.000", new DecimalFormatSymbols(Locale.US));
- private DecimalFormat df3 = new DecimalFormat("0.###", new DecimalFormatSymbols(Locale.US));
- private DecimalFormat df5 = new DecimalFormat("0.#####", new DecimalFormatSymbols(Locale.US));
+
+ private StringBuffer doubleBuffer = new StringBuffer(16);
private StringBuffer tempBuffer = new StringBuffer(256);
@@ -196,7 +193,9 @@ public class PSGenerator implements PSCo
* @return the formatted value
*/
public String formatDouble(double value) {
- return df3.format(value);
+ doubleBuffer.setLength(0);
+ DoubleFormatUtil.formatDouble(value, 3, 3, doubleBuffer);
+ return doubleBuffer.toString();
}
/**
@@ -206,7 +205,9 @@ public class PSGenerator implements PSCo
* @return the formatted value
*/
public String formatDouble5(double value) {
- return df5.format(value);
+ doubleBuffer.setLength(0);
+ DoubleFormatUtil.formatDouble(value, 5, 5, doubleBuffer);
+ return doubleBuffer.toString();
}
/**
@@ -439,7 +440,7 @@ public class PSGenerator implements PSCo
} else if (params[i] == DSCConstants.ATEND) {
tempBuffer.append(DSCConstants.ATEND);
} else if (params[i] instanceof Double) {
- tempBuffer.append(df3.format(params[i]));
+ tempBuffer.append(formatDouble(((Double)params[i]).doubleValue()));
} else if (params[i] instanceof Number) {
tempBuffer.append(params[i].toString());
} else if (params[i] instanceof Date) {
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/ps/dsc/DSCParser.java Mon May 28 16:05:29 2012
@@ -27,6 +27,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.xmlgraphics.ps.DSCConstants;
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.xmlgraphics.ps.dsc.events.DSCAtend;
@@ -44,6 +47,7 @@ import org.apache.xmlgraphics.ps.dsc.too
* DSCHandler interface.
*/
public class DSCParser implements DSCParserConstants {
+ private static final Log LOG = LogFactory.getLog(DSCParser.class);
private InputStream in;
private BufferedReader reader;
@@ -90,11 +94,11 @@ public class DSCParser implements DSCPar
/**
* This method is used to write out warning messages for the parsing process. Subclass to
- * override this method. The default implementation writes to System.err.
+ * override this method. The default implementation writes to logger.
* @param msg the warning message
*/
protected void warn(String msg) {
- System.err.println(msg);
+ LOG.warn(msg);
}
/**
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPArray.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPArray.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPArray.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPArray.java Mon May 28 16:05:29 2012
@@ -19,6 +19,8 @@
package org.apache.xmlgraphics.xmp;
+import java.net.URI;
+
import java.util.List;
import org.xml.sax.ContentHandler;
@@ -216,15 +218,19 @@ public class XMPArray extends XMPComplex
for (int i = 0, c = values.size(); i < c; i++) {
String lang = (String)xmllang.get(i);
atts.clear();
+ Object v = values.get(i);
if (lang != null) {
atts.addAttribute(XMPConstants.XML_NS, "lang", "xml:lang", "CDATA", lang);
}
+ if (v instanceof URI) {
+ atts.addAttribute(XMPConstants.RDF_NAMESPACE, "resource",
+ "rdf:resource", "CDATA", ((URI)v).toString());
+ }
handler.startElement(XMPConstants.RDF_NAMESPACE,
"li", "rdf:li", atts);
- Object v = values.get(i);
if (v instanceof XMPComplexValue) {
((XMPComplexValue)v).toSAX(handler);
- } else {
+ } else if (!(v instanceof URI)) {
String value = (String)values.get(i);
char[] chars = value.toCharArray();
handler.characters(chars, 0, chars.length);
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java Mon May 28 16:05:29 2012
@@ -19,6 +19,9 @@
package org.apache.xmlgraphics.xmp;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import java.util.Stack;
import org.xml.sax.Attributes;
@@ -227,6 +230,17 @@ public class XMPHandler extends DefaultH
} else {
getCurrentArray(true).add(s);
}
+ } else {
+ String res = atts.getValue(XMPConstants.RDF_NAMESPACE,
+ "resource");
+ if ( res != null ) {
+ try {
+ URI resource = new URI(res);
+ getCurrentArray(true).add(resource);
+ } catch (URISyntaxException e) {
+ throw new SAXException("rdf:resource value is not a well-formed URI", e);
+ }
+ }
}
}
} else if ("Description".equals(localName)) {
@@ -261,9 +275,18 @@ public class XMPHandler extends DefaultH
String s = content.toString().trim();
prop = new XMPProperty(name, s);
String lang = atts.getValue(XMPConstants.XML_NS, "lang");
+ String res = atts.getValue(XMPConstants.RDF_NAMESPACE, "resource");
if (lang != null) {
prop.setXMLLang(lang);
}
+ if (res != null) {
+ try {
+ URI resource = new URI(res);
+ prop.setValue(resource);
+ } catch (URISyntaxException e) {
+ throw new SAXException("rdf:resource value is not a well-formed URI", e);
+ }
+ }
}
if (prop.getName() == null) {
throw new IllegalStateException("No content in XMP property");
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java Mon May 28 16:05:29 2012
@@ -19,6 +19,8 @@
package org.apache.xmlgraphics.xmp;
+import java.net.URI;
+
import java.util.Iterator;
import java.util.Map;
@@ -38,6 +40,7 @@ public class XMPProperty implements XMLi
private Object value;
private String xmllang;
private Map qualifiers;
+ private boolean uri;
/**
* Creates a new XMP property.
@@ -47,6 +50,7 @@ public class XMPProperty implements XMLi
public XMPProperty(QName name, Object value) {
this.name = name;
this.value = value;
+ this.uri = false;
}
/** @return the qualified name of the property (namespace URI + local name) */
@@ -192,12 +196,15 @@ public class XMPProperty implements XMLi
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
String qName = getEffectiveQName();
+ if (value instanceof URI) {
+ atts.addAttribute(XMPConstants.RDF_NAMESPACE, "resource", "rdf:resource", "CDATA", ((URI)value).toString());
+ }
handler.startElement(getName().getNamespaceURI(),
getName().getLocalName(), qName, atts);
if (value instanceof XMPComplexValue) {
XMPComplexValue cv = ((XMPComplexValue)value);
cv.toSAX(handler);
- } else {
+ } else if (!(value instanceof URI)) {
char[] chars = value.toString().toCharArray();
handler.characters(chars, 0, chars.length);
}
Modified: xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java?rev=1343307&r1=1343306&r2=1343307&view=diff
==============================================================================
--- xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java (original)
+++ xmlgraphics/commons/branches/Temp_TrueTypeInPostScript/src/java/org/apache/xmlgraphics/xmp/XMPSchemaAdapter.java Mon May 28 16:05:29 2012
@@ -19,14 +19,10 @@
package org.apache.xmlgraphics.xmp;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
import java.util.Date;
-import java.util.Locale;
import java.util.TimeZone;
+import org.apache.xmlgraphics.util.DateFormatUtil;
import org.apache.xmlgraphics.util.QName;
/**
@@ -160,13 +156,6 @@ public class XMPSchemaAdapter {
return formatISO8601Date(dt, TimeZone.getDefault());
}
- private static DateFormat createPseudoISO8601DateFormat() {
- DateFormat df = new SimpleDateFormat(
- "yyyy'-'MM'-'dd'T'HH':'mm':'ss", Locale.ENGLISH);
- df.setTimeZone(TimeZone.getTimeZone("GMT"));
- return df;
- }
-
/**
* Formats a Date using ISO 8601 format in the given time zone.
* @param dt the date
@@ -174,79 +163,7 @@ public class XMPSchemaAdapter {
* @return the formatted date
*/
public static String formatISO8601Date(Date dt, TimeZone tz) {
- //ISO 8601 cannot be expressed directly using SimpleDateFormat
- Calendar cal = Calendar.getInstance(tz, Locale.ENGLISH);
- cal.setTime(dt);
- int offset = cal.get(Calendar.ZONE_OFFSET);
- offset += cal.get(Calendar.DST_OFFSET);
-
- //DateFormat is operating on GMT so adjust for time zone offset
- Date dt1 = new Date(dt.getTime() + offset);
- StringBuffer sb = new StringBuffer(createPseudoISO8601DateFormat().format(dt1));
-
- offset /= (1000 * 60); //Convert to minutes
-
- if (offset == 0) {
- sb.append('Z');
- } else {
- int zoneOffsetHours = offset / 60;
- int zoneOffsetMinutes = Math.abs(offset % 60);
- if (zoneOffsetHours > 0) {
- sb.append('+');
- } else {
- sb.append('-');
- }
- if (Math.abs(zoneOffsetHours) < 10) {
- sb.append('0');
- }
- sb.append(Math.abs(zoneOffsetHours));
- sb.append(':');
- if (zoneOffsetMinutes < 10) {
- sb.append('0');
- }
- sb.append(zoneOffsetMinutes);
- }
-
- return sb.toString();
- }
-
- /**
- * Parses an ISO 8601 date and time value.
- * @param dt the date and time value as an ISO 8601 string
- * @return the parsed date/time
- */
- public static Date parseISO8601Date(final String dt) {
- //TODO Parse formats other than yyyy-mm-ddThh:mm:ssZ
- int offset = 0;
- String parsablePart;
- if (dt.endsWith("Z")) {
- parsablePart = dt.substring(0, dt.length() - 1);
- } else {
- int pos;
- int neg = 1;
- pos = dt.lastIndexOf('+');
- if (pos < 0) {
- pos = dt.lastIndexOf('-');
- neg = -1;
- }
- if (pos >= 0) {
- String timeZonePart = dt.substring(pos);
- parsablePart = dt.substring(0, pos);
- offset = Integer.parseInt(timeZonePart.substring(1, 3)) * 60;
- offset += Integer.parseInt(timeZonePart.substring(4, 6));
- offset *= neg;
- } else {
- parsablePart = dt;
- }
- }
- Date d;
- try {
- d = createPseudoISO8601DateFormat().parse(parsablePart);
- } catch (ParseException e) {
- throw new IllegalArgumentException("Invalid ISO 8601 date format: " + dt);
- }
- d.setTime(d.getTime() - offset * 60 * 1000);
- return d;
+ return DateFormatUtil.formatISO8601(dt, tz);
}
/**
@@ -279,7 +196,7 @@ public class XMPSchemaAdapter {
if (dt == null) {
return null;
} else {
- return parseISO8601Date(dt);
+ return DateFormatUtil.parseISO8601Date(dt);
}
}
@@ -514,9 +431,9 @@ public class XMPSchemaAdapter {
for (int i = 0, c = res.length; i < c; i++) {
Object obj = arr[i];
if (obj instanceof Date) {
- res[i] = (Date)((Date)obj).clone();
+ res[i] = (Date) ((Date) obj).clone();
} else {
- res[i] = parseISO8601Date(obj.toString());
+ res[i] = DateFormatUtil.parseISO8601Date(obj.toString());
}
}
return res;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org