sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1625487 - /sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java
Date Wed, 17 Sep 2014 08:35:52 GMT
Author: cziegeler
Date: Wed Sep 17 08:35:52 2014
New Revision: 1625487

URL: http://svn.apache.org/r1625487
Log:
SLING-3941 : NPE in org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory

Modified:
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java?rev=1625487&r1=1625486&r2=1625487&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java
Wed Sep 17 08:35:52 2014
@@ -126,9 +126,14 @@ public class CommonResourceResolverFacto
      * Make sure to remove it from the current thread context.
      */
     public void closed(final ResourceResolverImpl resourceResolverImpl) {
-        final Stack<ResourceResolver> resolverStack = resolverStackHolder.get();
-        if ( resolverStack != null ) {
-            resolverStack.remove(resourceResolverImpl);
+        // on shutdown, the factory might already be closed before the resolvers close
+        // therefore we have to check for null
+        final ThreadLocal<Stack<ResourceResolver>> tl = resolverStackHolder;
+        if ( tl != null ) {
+            final Stack<ResourceResolver> resolverStack = tl.get();
+            if ( resolverStack != null ) {
+                resolverStack.remove(resourceResolverImpl);
+            }
         }
     }
 



Mime
View raw message