sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r613148 - /incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
Date Fri, 18 Jan 2008 12:55:12 GMT
Author: fmeschbe
Date: Fri Jan 18 04:55:11 2008
New Revision: 613148

URL: http://svn.apache.org/viewvc?rev=613148&view=rev
Log:
Catch IllegalStateException thrown when registering a duplicate root path.
Added a TODO to prevent unregistering a path in case the registration of
the respective provider for that path failed.

Modified:
    incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java

Modified: incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java?rev=613148&r1=613147&r2=613148&view=diff
==============================================================================
--- incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
(original)
+++ incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
Fri Jan 18 04:55:11 2008
@@ -333,7 +333,13 @@
                 prefixes);
             String[] rootPaths = brp.getRoots();
             for (String rootPath : rootPaths) {
-                rootProviderEntry.addResourceProvider(rootPath, brp);
+                try {
+                    rootProviderEntry.addResourceProvider(rootPath, brp);
+                } catch (IllegalStateException ise) {
+                    log.error(
+                        "addBundleResourceProvider: A ResourceProvider for {} is already
registered",
+                        rootPath);
+                }
             }
             bundleResourceProviderMap.put(bundle.getBundleId(), brp);
         }
@@ -344,6 +350,9 @@
         if (brp != null) {
             String[] rootPaths = brp.getRoots();
             for (String rootPath : rootPaths) {
+                // TODO: Do not remove this path, if another resource
+                //       owns it. This may be the case if adding the provider
+                //       yielded an IllegalStateException
                 rootProviderEntry.removeResourceProvider(rootPath);
             }
         }
@@ -436,7 +445,13 @@
                 "ResourceProvider", reference);
             
             for (String root : roots) {
-                rootProviderEntry.addResourceProvider(root, provider);
+                try {
+                    rootProviderEntry.addResourceProvider(root, provider);
+                } catch (IllegalStateException ise) {
+                    log.error(
+                        "bindResourceProvider: A ResourceProvider for {} is already registered",
+                        root);
+                }
             }
         }
     }
@@ -445,6 +460,9 @@
         String[] roots = OsgiUtil.toStringArray(reference.getProperty(ResourceProvider.ROOTS));
         if (roots != null && roots.length > 0) {
             for (String root : roots) {
+                // TODO: Do not remove this path, if another resource
+                //       owns it. This may be the case if adding the provider
+                //       yielded an IllegalStateException
                 rootProviderEntry.removeResourceProvider(root);
             }
         }



Mime
View raw message