You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2018/03/19 12:36:30 UTC

[sling-org-apache-sling-scripting-sightly] 02/02: SLING-7516 - ResourceRuntimeExtension: Selectors containing a comma are not treated correctly

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

radu pushed a commit to branch bugfix/support-selectors-with-comma
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly.git

commit 7353d6025bc08b0c20006b8838a87651b434fe21
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 19 13:35:44 2018 +0100

    SLING-7516 - ResourceRuntimeExtension: Selectors containing a comma are not treated correctly
    
    * corrected RequestDispatcherOptions overrides
---
 .../impl/engine/extension/ResourceRuntimeExtension.java     | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java
index c46365b..924f9ea 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java
@@ -119,19 +119,19 @@ public class ResourceRuntimeExtension implements RuntimeExtension {
             selectors.addAll(Arrays.asList(request.getRequestPathInfo().getSelectors()));
         }
         requestDispatcherOptions.setAddSelectors(getSelectorString(selectors));
-        requestDispatcherOptions.setReplaceSelectors(" ");
+        requestDispatcherOptions.setReplaceSelectors("");
         if (options.containsKey(OPTION_SELECTORS)) {
             Object selectorsObject = getAndRemoveOption(options, OPTION_SELECTORS);
             selectors.clear();
             addSelectors(selectors, selectorsObject, runtimeObjectModel);
             requestDispatcherOptions.setAddSelectors(getSelectorString(selectors));
-            requestDispatcherOptions.setReplaceSelectors(" ");
+            requestDispatcherOptions.setReplaceSelectors("");
         }
         if (options.containsKey(OPTION_ADD_SELECTORS)) {
             Object selectorsObject = getAndRemoveOption(options, OPTION_ADD_SELECTORS);
             addSelectors(selectors, selectorsObject, runtimeObjectModel);
             requestDispatcherOptions.setAddSelectors(getSelectorString(selectors));
-            requestDispatcherOptions.setReplaceSelectors(" ");
+            requestDispatcherOptions.setReplaceSelectors("");
         }
         if (options.containsKey(OPTION_REMOVE_SELECTORS)) {
             Object selectorsObject = getAndRemoveOption(options, OPTION_REMOVE_SELECTORS);
@@ -153,10 +153,10 @@ public class ResourceRuntimeExtension implements RuntimeExtension {
             }
             String selectorString = getSelectorString(selectors);
             if (StringUtils.isEmpty(selectorString)) {
-                requestDispatcherOptions.setReplaceSelectors(" ");
+                requestDispatcherOptions.setReplaceSelectors("");
             } else {
                 requestDispatcherOptions.setAddSelectors(getSelectorString(selectors));
-                requestDispatcherOptions.setReplaceSelectors(" ");
+                requestDispatcherOptions.setReplaceSelectors("");
             }
         }
         return requestDispatcherOptions;
@@ -228,7 +228,8 @@ public class ResourceRuntimeExtension implements RuntimeExtension {
                 i++;
             }
         }
-        return sb.toString();
+        String selectorString = sb.toString();
+        return StringUtils.isNotEmpty(selectorString) ? selectorString : null;
     }
 
     private void includeResource(final Bindings bindings, PrintWriter out, String path, RequestDispatcherOptions requestDispatcherOptions, String resourceType) {

-- 
To stop receiving notification emails like this one, please contact
radu@apache.org.