incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r618573 - /incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java
Date Tue, 05 Feb 2008 08:23:10 GMT
Author: cziegeler
Date: Tue Feb  5 00:23:09 2008
New Revision: 618573

URL: http://svn.apache.org/viewvc?rev=618573&view=rev
Log:
Fix NPE in shutdown (SLING-216)

Modified:
    incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java

Modified: incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java?rev=618573&r1=618572&r2=618573&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java
(original)
+++ incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java
Tue Feb  5 00:23:09 2008
@@ -66,7 +66,7 @@
 
 /**
  * The <code>SlingServletResolver</code> TODO
- * 
+ *
  * @scr.component label="%servletresolver.name"
  *                description="%servletresolver.description"
  * @scr.property name="service.description" value="Sling Servlet Resolver and
@@ -100,8 +100,6 @@
     /** @scr.reference */
     private ServletContext servletContext;
 
-    private Map<String, Servlet> servlets = new HashMap<String, Servlet>();
-
     private Map<ServiceReference, ServiceRegistration> servletsByReference = new HashMap<ServiceReference,
ServiceRegistration>();
 
     private List<ServiceReference> pendingServlets = new ArrayList<ServiceReference>();
@@ -133,7 +131,7 @@
                 return resourceServlet;
             }
         }
-        
+
         ResourceResolver resolver = request.getResourceResolver();
         String baseName = PathSupport.getScriptBaseName(request);
 
@@ -341,12 +339,12 @@
                     result = resource.adaptTo(Servlet.class);
                 }
             }
-            
+
             // there is no child node with the basename, try without
             if (result == null) {
                 result = scriptRoot.adaptTo(Servlet.class);
             }
-            
+
         } else {
             // check alternative variant using location/basename directly
             Resource scriptResource = resolver.getResource(location + "/"
@@ -480,11 +478,10 @@
         Collection<ServiceReference> refs;
         synchronized (this) {
             refs = new ArrayList<ServiceReference>(servletsByReference.keySet());
+            // destroy all servlets
+            destroyAllServlets(refs);
             this.context = null;
         }
-
-        // destroy all servlets
-        destroyAllServlets(refs);
     }
 
     protected synchronized void bindServlet(ServiceReference reference) {
@@ -580,7 +577,7 @@
             } else {
                 String name = servlet.getServletConfig().getServletName();
                 log.debug("unbindServlet: Servlet {} removed", name);
-    
+
                 try {
                     servlet.destroy();
                 } catch (Throwable t) {



Mime
View raw message