incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1207950 - /sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java
Date Tue, 29 Nov 2011 16:30:04 GMT
Author: fmeschbe
Date: Tue Nov 29 16:30:03 2011
New Revision: 1207950

URL: http://svn.apache.org/viewvc?rev=1207950&view=rev
Log:
SLING-2307 Prevent NullPointerException when called before the ContentData is setup like for
example when handling request processing start in the RequestLogger.

Modified:
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java?rev=1207950&r1=1207949&r2=1207950&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingHttpServletRequestImpl.java
Tue Nov 29 16:30:03 2011
@@ -47,6 +47,7 @@ import org.apache.sling.api.resource.Res
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.engine.impl.helper.NullResourceBundle;
 import org.apache.sling.engine.impl.parameters.ParameterSupport;
+import org.apache.sling.engine.impl.request.ContentData;
 import org.apache.sling.engine.impl.request.RequestData;
 import org.apache.sling.engine.impl.request.SlingRequestDispatcher;
 import org.osgi.service.http.HttpContext;
@@ -95,7 +96,8 @@ public class SlingHttpServletRequestImpl
     }
 
     public Resource getResource() {
-        return getRequestData().getContentData().getResource();
+        final ContentData cd = getRequestData().getContentData();
+        return (cd == null) ? null : cd.getResource();
     }
 
     public ResourceResolver getResourceResolver() {
@@ -206,7 +208,8 @@ public class SlingHttpServletRequestImpl
      * @see org.apache.sling.api.SlingHttpServletRequest#getRequestPathInfo()
      */
     public RequestPathInfo getRequestPathInfo() {
-        return getRequestData().getContentData().getRequestPathInfo();
+        final ContentData cd = getRequestData().getContentData();
+        return (cd == null) ? null : cd.getRequestPathInfo();
     }
 
     /**



Mime
View raw message