You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (JIRA)" <ji...@apache.org> on 2018/03/19 10:49:00 UTC

[jira] [Commented] (SLING-7516) ResourceRuntimeExtension: Selectors containing a comma are not treated correctly

    [ https://issues.apache.org/jira/browse/SLING-7516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16404627#comment-16404627 ] 

Radu Cotescu commented on SLING-7516:
-------------------------------------

There are some errors in the PR related to how the {{RequestDispatcherOptions}} are created:
{noformat}
cd org-apache-sling-scripting-sightly-testing
mvncv -Pstable
[...]
Running org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT
Tests run: 28, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 12.406 sec <<< FAILURE! - in org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT
testDataSlyResourceResolution(org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT)  Time elapsed: 0.255 sec  <<< ERROR!
io.sightly.tck.http.ClientException: Received status code 500, expected 200 - url http://localhost:65500//sightly/resource.html
	at org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT.testDataSlyResourceResolution(SlingSpecificsSightlyIT.java:133)

testRequestAttributes(org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT)  Time elapsed: 0.151 sec  <<< ERROR!
io.sightly.tck.http.ClientException: Received status code 500, expected 200 - url http://localhost:65500//sightly/requestattributes.html
	at org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT.testRequestAttributes(SlingSpecificsSightlyIT.java:312)

testDataSlyResourceArraySelectors(org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT)  Time elapsed: 0.204 sec  <<< ERROR!
io.sightly.tck.http.ClientException: Received status code 500, expected 200 - url http://localhost:65500//sightly/resource.html
	at org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT.testDataSlyResourceArraySelectors(SlingSpecificsSightlyIT.java:118)

actualResource(org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT)  Time elapsed: 0.121 sec  <<< ERROR!
io.sightly.tck.http.ClientException: Received status code 500, expected 200 - url http://localhost:65500//sightly/actualresource.html
	at org.apache.sling.scripting.sightly.it.SlingSpecificsSightlyIT.actualResource(SlingSpecificsSightlyIT.java:301)
{noformat}

I'm correcting them and pushing a new commit to the branch.

> ResourceRuntimeExtension: Selectors containing a comma are not treated correctly
> --------------------------------------------------------------------------------
>
>                 Key: SLING-7516
>                 URL: https://issues.apache.org/jira/browse/SLING-7516
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: Scripting HTL Engine 1.0.48-1.3.1
>            Reporter: Konrad Windszus
>            Assignee: Radu Cotescu
>            Priority: Major
>              Labels: patch-available
>
> Due to the way how the request dispatcher options are serialized into one big string in https://github.com/apache/sling-org-apache-sling-scripting-sightly/blob/cd7d67e66f624c66fe88dd208c4d2b8f7e85c8ec/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java#L214 you cannot use e.g. selectors which contain a comma. This is a problem because currently selectors are the only way to propagate parameters from one HTL script to another script/servlet (compare with SLING-7515).
> The method {{createDispatcherOptions}} generates a String from a Map where the entries are separated by {{,}} i.e. comma. If either the map key or the map value contain a comma itself the tokenization in https://github.com/apache/sling-org-apache-sling-api/blob/ec3dcf291b26e833b07a1f9c485bbe713a7ad4d5/src/main/java/org/apache/sling/api/request/RequestDispatcherOptions.java#L100 works incorrectly! 
> Therefore instead of using the constructor with a string (with very simple/incorrect parsing) the {{RequestDispatcherOptions}} should rather be created with an empty string and then the map should be filled with the according put/set methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)