You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:49:27 UTC
[sling-org-apache-sling-jcr-resourcesecurity] 02/05: SLING-4291 :
NPE if optional prefix is not configured
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 <cz...@apache.org>
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
"commits@sling.apache.org" <co...@sling.apache.org>.