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 2017/08/31 08:54:17 UTC
svn commit: r1806769 -
/sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/jsapi/SlyBindingsValuesProvider.java
Author: radu
Date: Thu Aug 31 08:54:17 2017
New Revision: 1806769
URL: http://svn.apache.org/viewvc?rev=1806769&view=rev
Log:
SLING-7094 - The script factories in the JS Use Provider are not always installed in the correct order
* switched to a LinkedHashMap for storing the factories and the namespaces they define
Modified:
sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/jsapi/SlyBindingsValuesProvider.java
Modified: sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/jsapi/SlyBindingsValuesProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/jsapi/SlyBindingsValuesProvider.java?rev=1806769&r1=1806768&r2=1806769&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/jsapi/SlyBindingsValuesProvider.java (original)
+++ sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/jsapi/SlyBindingsValuesProvider.java Thu Aug 31 08:54:17 2017
@@ -23,6 +23,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import javax.script.Bindings;
import javax.script.ScriptEngine;
@@ -86,7 +87,8 @@ public class SlyBindingsValuesProvider {
@AttributeDefinition(
name = "Script Factories",
description = "Script factories to load in the bindings map. The entries should be in the form " +
- "'namespace:/path/from/repository'."
+ "'namespace:/path/from/repository'. If the factories depend on each other, add them in the correct order of their" +
+ " dependency chain."
)
String[] org_apache_sling_scripting_sightly_js_bindings() default "sightly:" + SlyBindingsValuesProvider.SLING_NS_PATH;
@@ -157,7 +159,7 @@ public class SlyBindingsValuesProvider {
configuration.org_apache_sling_scripting_sightly_js_bindings(),
new String[]{SLING_NS_PATH}
);
- scriptPaths = new HashMap<>(factories.length);
+ scriptPaths = new LinkedHashMap<>(factories.length);
for (String f : factories) {
String[] parts = f.split(":");
if (parts.length == 2) {