kwin commented on a change in pull request #42:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/42#discussion_r583485646
##########
File path:
src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
##########
@@ -313,10 +314,11 @@ protected void activate(final BundleContext
bundleContext, final ResourceResolve
String value = prefix.trim();
if (!value.isEmpty()) {
if (value.startsWith("/")) { // absolute path should be
given
+ // path must not end with "/" to be valid absolute path
if (value.endsWith("/")) {
- prefixSet.add(value);
+ prefixSet.add(StringUtils.removeEnd(value, "/"));
Review comment:
`StringUtils.removeEnd` already has a check so you can remove the
surrounding if
##########
File path:
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
##########
@@ -1036,8 +1037,9 @@ private String updateAliasQuery(){
baseQuery.append(" ").append("WHERE");
if(allowedLocations.isEmpty()){
+ String jcrSystemPath = StringUtils.removeEnd(JCR_SYSTEM_PREFIX,
"/");
Review comment:
The check performed by
http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#removeEnd-java.lang.String-java.lang.String-
is not really necessary here, because you know that the constant ends with
"/", right? I would just use `jcrSystemPath.substring(0, jcrSystemPath.length()
- 1);` in this case.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]