sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1777118 - in /sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl: ResourceResolverImpl.java params/ParsedParameters.java params/PathParser.java
Date Tue, 03 Jan 2017 13:18:21 GMT
Author: cziegeler
Date: Tue Jan  3 13:18:21 2017
New Revision: 1777118

URL: http://svn.apache.org/viewvc?rev=1777118&view=rev
Log:
SLING-6432 : Avoid path parameter parsing with paths containing a dot

Modified:
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/ParsedParameters.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/PathParser.java

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java?rev=1777118&r1=1777117&r2=1777118&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
Tue Jan  3 13:18:21 2017
@@ -683,7 +683,7 @@ public class ResourceResolverImpl extend
         if ( path != null ) {
             // if the path is absolute, normalize . and .. segments and get res
             if (path.startsWith("/")) {
-                ParsedParameters parsedPath = new ParsedParameters(path);
+                final ParsedParameters parsedPath = new ParsedParameters(path);
                 path = ResourceUtil.normalize(parsedPath.getRawPath());
                 result = (path != null) ? getAbsoluteResourceInternal(parent, path, parsedPath.getParameters(),
false) : null;
                 if (result != null) {

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/ParsedParameters.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/ParsedParameters.java?rev=1777118&r1=1777117&r2=1777118&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/ParsedParameters.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/ParsedParameters.java
Tue Jan  3 13:18:21 2017
@@ -18,14 +18,13 @@
 
 package org.apache.sling.resourceresolver.impl.params;
 
-import java.util.Collections;
 import java.util.Map;
 
 /**
  * Parses path looking for semicolon-separated parameters. Parameters are extracted and exposed
as an
  * immutable map. The path without parameters is available as raw path.
  * 
- * Parameters should be added immedietaly before or after selectors and extension:
+ * Parameters should be added immediately before or after selectors and extension:
  * {@code /content/test;v='1.0'.html} or {@code /content/test.html;v=1.0}. Quotes can be
used to escape the
  * parameter value (it is necessary if the value contains dot and parameter is added before
extension).
  */
@@ -47,7 +46,7 @@ public class ParsedParameters {
         parser.parse(fullPath);
 
         parametersString = parser.getParametersString();
-        parameters = Collections.unmodifiableMap(parser.getParameters());
+        parameters = parser.getParameters();
         path = parser.getPath();
     }
 

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/PathParser.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/PathParser.java?rev=1777118&r1=1777117&r2=1777118&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/PathParser.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/params/PathParser.java
Tue Jan  3 13:18:21 2017
@@ -74,12 +74,12 @@ class PathParser {
         }
 
         // indexOf shortcut for the most common case
-        final int di = path.indexOf('.');
         final int si = path.indexOf(';');
-        if (di == -1 && si == -1) {
+        if (si == -1) {
             return;
         }
 
+        final int di = path.indexOf('.');
         final char[] chars = path.toCharArray();
         final ParametersParser parametersParser = new ParametersParser();
 
@@ -150,7 +150,7 @@ class PathParser {
             paramsStart = paramsEnd = -1;
         } else {
             cutPath(path, paramsStart, paramsEnd);
-            parameters = parametersParser.getParameters();
+            parameters = Collections.unmodifiableMap(parametersParser.getParameters());
         }
     }
 



Mime
View raw message