You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ma...@apache.org on 2008/08/25 10:59:59 UTC

svn commit: r688665 - in /xmlgraphics/commons/trunk: src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java test/java/org/apache/xmlgraphics/util/uri/CommonURIResolverTestCase.java

Author: maxberger
Date: Mon Aug 25 01:59:58 2008
New Revision: 688665

URL: http://svn.apache.org/viewvc?rev=688665&view=rev
Log:
CommonURIResolver is no longer a singleton

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java
    xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/uri/CommonURIResolverTestCase.java

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java?rev=688665&r1=688664&r2=688665&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/util/uri/CommonURIResolver.java Mon Aug 25 01:59:58 2008
@@ -35,17 +35,22 @@
  * <p>
  * This resolver will try all resolvers registered as an {@link URIResolver}
  * class. For proper operation, the registers URIResolvers must return null if
- * they cannot handle the given URI.
+ * they cannot handle the given URI and fail fast. 
  */
-public final class CommonURIResolver implements URIResolver {
+public class CommonURIResolver implements URIResolver {
 
     private final List uriResolvers = new LinkedList();
 
-    private final static class SingletonHolder {
+    private final static class DefaultInstanceHolder {
         private static final CommonURIResolver INSTANCE = new CommonURIResolver();
     }
 
-    private CommonURIResolver() {
+    /**
+     * Creates a new CommonURIResolver. Use this if you need support for
+     * resolvers in the current context.
+     * @see CommonURIResolver#getDefaultURIResolver()
+     */
+    public CommonURIResolver() {
         Iterator iter = Service.providers(URIResolver.class);
         while (iter.hasNext()) {
             URIResolver resolver = (URIResolver) iter.next();
@@ -53,8 +58,13 @@
         }
     }
 
-    public static CommonURIResolver getInstance() {
-        return SingletonHolder.INSTANCE;
+    /**
+     * Retrieve the default resolver instance.
+     * 
+     * @return the default resolver instance.
+     */
+    public static CommonURIResolver getDefaultURIResolver() {
+        return DefaultInstanceHolder.INSTANCE;
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/uri/CommonURIResolverTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/uri/CommonURIResolverTestCase.java?rev=688665&r1=688664&r2=688665&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/uri/CommonURIResolverTestCase.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/util/uri/CommonURIResolverTestCase.java Mon Aug 25 01:59:58 2008
@@ -35,7 +35,7 @@
      *             if an error occurs
      */
     public void testDataURLHandling() throws Exception {
-        URIResolver resolver = CommonURIResolver.getInstance();
+        URIResolver resolver = CommonURIResolver.getDefaultURIResolver();
         DataURIResolverTestCase.actualURLHAndlingTest(resolver);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org