You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ss...@apache.org on 2019/09/23 14:01:13 UTC

svn commit: r1867375 - in /xmlgraphics/batik/trunk: batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/ batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/ test-resources/org/apache/batik/ext/awt/image/spi/ test-resources/org/...

Author: ssteiner
Date: Mon Sep 23 14:01:13 2019
New Revision: 1867375

URL: http://svn.apache.org/viewvc?rev=1867375&view=rev
Log:
BATIK-1203: ImageTagRegistry forgets to reinitialize cache

Added:
    xmlgraphics/batik/trunk/batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/
    xmlgraphics/batik/trunk/batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistryTest.java   (with props)
    xmlgraphics/batik/trunk/test-resources/org/apache/batik/ext/awt/image/spi/
    xmlgraphics/batik/trunk/test-resources/org/apache/batik/ext/awt/image/spi/unitTesting.xml   (with props)
Modified:
    xmlgraphics/batik/trunk/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
    xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/regard.xml

Modified: xmlgraphics/batik/trunk/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java?rev=1867375&r1=1867374&r2=1867375&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java (original)
+++ xmlgraphics/batik/trunk/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java Mon Sep 23 14:01:13 2019
@@ -276,8 +276,7 @@ public class ImageTagRegistry implements
             RegistryEntry re = (RegistryEntry)li.next();
             if (re.getPriority() > priority) {
                 li.previous();
-                li.add(newRE);
-                return;
+                break; // Insertion point found.
             }
         }
         li.add(newRE);

Added: xmlgraphics/batik/trunk/batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistryTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistryTest.java?rev=1867375&view=auto
==============================================================================
--- xmlgraphics/batik/trunk/batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistryTest.java (added)
+++ xmlgraphics/batik/trunk/batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistryTest.java Mon Sep 23 14:01:13 2019
@@ -0,0 +1,43 @@
+/*
+
+   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.batik.ext.awt.image.spi;
+
+import org.apache.batik.test.AbstractTest;
+
+public class ImageTagRegistryTest extends AbstractTest {
+    @Override
+    public boolean runImplBasic() throws Exception {
+        ImageTagRegistry ir = new ImageTagRegistry();
+        // Add a new registry entry with a HIGHER priority first
+        ir.register(new AbstractRegistryEntry("Unit test", 100, "working", "application/working") {
+        });
+        // Ensure the first one is present:
+        assertTrue(ir.getRegisteredMimeTypes().contains("application/working"));
+        // Ensure the second is NOT YET present:
+        assertTrue(!ir.getRegisteredMimeTypes().contains("application/missing"));
+        // Add a new registry entry with a LOW priority later
+        ir.register(new AbstractRegistryEntry("Unit test", 1, "missing", "application/missing") {
+        });
+        // This one still works - this is expected:
+        assertTrue(ir.getRegisteredMimeTypes().contains("application/working"));
+        // The second was not added because of BATIK-1203.
+        assertTrue(ir.getRegisteredMimeTypes().contains("application/missing"));
+        return true;
+    }
+}

Propchange: xmlgraphics/batik/trunk/batik-test-old/src/test/java/org/apache/batik/ext/awt/image/spi/ImageTagRegistryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/batik/trunk/test-resources/org/apache/batik/ext/awt/image/spi/unitTesting.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/test-resources/org/apache/batik/ext/awt/image/spi/unitTesting.xml?rev=1867375&view=auto
==============================================================================
--- xmlgraphics/batik/trunk/test-resources/org/apache/batik/ext/awt/image/spi/unitTesting.xml (added)
+++ xmlgraphics/batik/trunk/test-resources/org/apache/batik/ext/awt/image/spi/unitTesting.xml Mon Sep 23 14:01:13 2019
@@ -0,0 +1,26 @@
+<!--
+   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.
+-->
+
+<!-- ========================================================================= -->
+<!-- @version $Id$ -->
+<!-- ========================================================================= -->
+<testSuite id="ext.awt.image.codec.unitTesting" name="org.apache.batik.ext.awt.image.spi package - Unit Testing">
+    <!-- ========================================================================== -->
+    <!-- Validates that ImageTagRegistry is operating as expected                        -->
+    <!-- ========================================================================== -->
+    <test id="ImageTagRegistryTest" class="org.apache.batik.ext.awt.image.spi.ImageTagRegistryTest" />
+</testSuite>

Propchange: xmlgraphics/batik/trunk/test-resources/org/apache/batik/ext/awt/image/spi/unitTesting.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/regard.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/regard.xml?rev=1867375&r1=1867374&r2=1867375&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/regard.xml (original)
+++ xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/regard.xml Mon Sep 23 14:01:13 2019
@@ -56,6 +56,7 @@
     <testSuite href="file:test-resources/org/apache/batik/apps/rasterizer/unitTesting.xml" />
     <testSuite href="file:test-resources/org/apache/batik/test/unitTesting.xml" />  
     <testSuite href="file:test-resources/org/apache/batik/ext/awt/image/codec/unitTesting.xml" />
+    <testSuite href="file:test-resources/org/apache/batik/ext/awt/image/spi/unitTesting.xml" />
     <testSuite href="file:test-resources/org/apache/batik/ext/awt/geom/unitTesting.xml" /> 
     <testSuite href="file:test-resources/org/apache/batik/util/unitTesting.xml" />
     <testSuite href="file:test-resources/org/apache/batik/bridge/unitTesting.xml" />