You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by je...@apache.org on 2010/06/13 18:27:19 UTC
svn commit: r954256 - in /xmlgraphics/commons/trunk:
src/java/org/apache/xmlgraphics/image/codec/png/
src/java/org/apache/xmlgraphics/image/codec/util/
src/resources/org/apache/xmlgraphics/image/codec/
test/java/org/apache/xmlgraphics/image/codec/png/
Author: jeremias
Date: Sun Jun 13 16:27:18 2010
New Revision: 954256
URL: http://svn.apache.org/viewvc?rev=954256&view=rev
Log:
Bugzilla #49412:
Added missing message resources for internal codecs.
Added:
xmlgraphics/commons/trunk/src/resources/org/apache/xmlgraphics/image/codec/
xmlgraphics/commons/trunk/src/resources/org/apache/xmlgraphics/image/codec/Messages.properties
- copied, changed from r378232, xmlgraphics/batik/trunk/resources/org/apache/batik/ext/awt/image/codec/properties
xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/CodecResourcesTest.java (with props)
Modified:
xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java
xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/util/PropertyUtil.java
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java?rev=954256&r1=954255&r2=954256&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/png/PNGImageDecoder.java Sun Jun 13 16:27:18 2010
@@ -39,12 +39,12 @@ import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.SequenceInputStream;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
-import java.util.TimeZone;
import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
+import java.util.TimeZone;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
@@ -393,8 +393,8 @@ class PNGImage extends SimpleRenderedIma
String msg = PropertyUtil.getString("PNGImageDecoder0");
throw new RuntimeException(msg);
}
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
String msg = PropertyUtil.getString("PNGImageDecoder1");
throw new RuntimeException(msg);
}
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/util/PropertyUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/util/PropertyUtil.java?rev=954256&r1=954255&r2=954256&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/util/PropertyUtil.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/codec/util/PropertyUtil.java Sun Jun 13 16:27:18 2010
@@ -25,7 +25,7 @@ import org.apache.xmlgraphics.util.i18n.
public class PropertyUtil {
protected static final String RESOURCES =
- "org.apache.xmlgraphics.image.codec.resources.Messages";
+ "org.apache.xmlgraphics.image.codec.Messages";
protected static LocalizableSupport localizableSupport =
Copied: xmlgraphics/commons/trunk/src/resources/org/apache/xmlgraphics/image/codec/Messages.properties (from r378232, xmlgraphics/batik/trunk/resources/org/apache/batik/ext/awt/image/codec/properties)
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/resources/org/apache/xmlgraphics/image/codec/Messages.properties?p2=xmlgraphics/commons/trunk/src/resources/org/apache/xmlgraphics/image/codec/Messages.properties&p1=xmlgraphics/batik/trunk/resources/org/apache/batik/ext/awt/image/codec/properties&r1=378232&r2=954256&rev=954256&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/resources/org/apache/batik/ext/awt/image/codec/properties (original)
+++ xmlgraphics/commons/trunk/src/resources/org/apache/xmlgraphics/image/codec/Messages.properties Sun Jun 13 16:27:18 2010
@@ -25,7 +25,7 @@ PNGEncodeParam15=ICC profile has not bee
PNGEncodeParam16=Physical dimension information has not been set.
PNGEncodeParam17=Suggested palette information has not been set.
PNGEncodeParam18=Significant bits values have not been set.
-PNGEncodeParam19=sRGB rendereding intent has not been set.
+PNGEncodeParam19=sRGB rendering intent has not been set.
PNGEncodeParam1=Not divisible by 3.
PNGEncodeParam20=Uncompressed text strings have not been set.
PNGEncodeParam21=Modification time has not been set.
Added: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/CodecResourcesTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/CodecResourcesTest.java?rev=954256&view=auto
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/CodecResourcesTest.java (added)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/CodecResourcesTest.java Sun Jun 13 16:27:18 2010
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+/* $Id$ */
+
+package org.apache.xmlgraphics.image.codec.png;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.io.IOUtils;
+
+import org.apache.xmlgraphics.image.codec.util.MemoryCacheSeekableStream;
+import org.apache.xmlgraphics.image.codec.util.SeekableStream;
+
+/**
+ * Checks for the presence of message resources for the internal codecs.
+ */
+public class CodecResourcesTest extends TestCase {
+
+ public void testResources() throws Exception {
+
+ InputStream in = new java.io.FileInputStream("test/images/barcode.eps");
+ SeekableStream seekStream = new MemoryCacheSeekableStream(in);
+ try {
+ new PNGImage(seekStream, null);
+ fail("Exception expected");
+ } catch (RuntimeException re) {
+ String msg = re.getMessage();
+ if ("PNGImageDecoder0".equals(msg)) {
+ re.printStackTrace();
+ fail("Message resource don't seem to be present! Message is: " + msg);
+ } else if (msg.toLowerCase().indexOf("magic") < 0) {
+ fail("Message not as expected! Message is: " + msg);
+ }
+ } finally {
+ IOUtils.closeQuietly(seekStream);
+ IOUtils.closeQuietly(in);
+ }
+
+ }
+
+}
Propchange: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/CodecResourcesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/image/codec/png/CodecResourcesTest.java
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org