This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag 
org.apache.sling.jcr.resourcesecurity-1.0.2
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resourcesecurity.git

commit 138271c673130893906b59a7c3f150b98ad5909c
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri Jan 9 11:56:46 2015 +0000

    SLING-4291 : NPE if optional prefix is not configured
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/contrib/jcr/resourcesecurity@1650508
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jcr/resourcesecurity/impl/ResourceAccessGateFactory.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java
 
b/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java
index 2b7d253..4cfe4eb 100644
--- 
a/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java
+++ 
b/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java
@@ -73,8 +73,11 @@ public class ResourceAccessGateFactory
     protected void activate(final Map<String, Object> props) {
         this.jcrPath = PropertiesUtil.toString(props.get(PROP_JCR_PATH), null);
         this.prefix = PropertiesUtil.toString(props.get(PROP_PREFIX), null);
-        if ( !this.prefix.endsWith("/") ) {
-            this.prefix = this.prefix + "/";
+        if ( this.prefix != null ) {
+            if ( !this.prefix.endsWith("/") ) {
+                this.prefix = this.prefix + "/";
+            }
+            this.jcrPath = this.jcrPath + "/";
         }
     }
 
@@ -89,7 +92,7 @@ public class ResourceAccessGateFactory
         if ( session != null ) {
             String checkPath = this.jcrPath;
             if ( this.prefix != null && path.startsWith(this.prefix) ) {
-                checkPath = this.jcrPath + path.substring(this.prefix.length() 
- 1);
+                checkPath = this.jcrPath + 
path.substring(this.prefix.length());
             }
             try {
                 granted = session.hasPermission(checkPath, permission);

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to