Applied fix from trunk for revision: 1500772
===
Removed support for runtime nested expressions in FlexibleStringExpander.java.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/branches/release11.04@1502568 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java b/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
index f71c7e9..1a41d9a 100644
--- a/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
+++ b/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
@@ -715,19 +715,6 @@
} catch (Exception e) {
Debug.logError("Error evaluating expression " + this + ": " + e, module);
}
- if (obj != null) {
- try {
- // Check for runtime nesting
- String str = (String) obj;
- if (str.contains(openBracket)) {
- FlexibleStringExpander fse = FlexibleStringExpander.getInstance(str);
- if (containsScript(fse)) {
- throw new UnsupportedOperationException("Nested scripts are not supported");
- }
- return fse.get(context, timeZone, locale);
- }
- } catch (ClassCastException e) {}
- }
return obj;
}
}
diff --git a/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java b/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
index bb30f09..2686b91 100644
--- a/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
+++ b/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
@@ -286,16 +286,6 @@
List<String> testList = new ArrayList<String>();
testList.add("World");
testMap.put("testList", testList);
- testMap.put("testScript", "${groovy:return null;}");
- UnsupportedOperationException caught = null;
- try {
- FlexibleStringExpander fse = FlexibleStringExpander.getInstance("${testScript}");
- fse.expandString(testMap);
- } catch (UnsupportedOperationException e) {
- caught = e;
- } finally {
- assertNotNull("UnsupportedOperationException thrown for nested script", caught);
- }
fseTest("null FlexibleStringExpander, null map", null, null, null, null, "", null, true);
fseTest("null FlexibleStringExpander", null, testMap, null, null, "", null, true);
fseTest("null context", "Hello World!", null, null, null, "Hello World!", null, false);
@@ -305,9 +295,6 @@
fseTest("empty FlexibleStringExpander", "", testMap, null, null, "", null, true);
fseTest("UEL integration(nested): throw Exception", "${${throwException.value}}", testMap, "", false);
fseTest("UEL integration: throw Exception", "${throwException.value}", testMap, null, null, "", null, false);
- fseTest("hidden (runtime) nested replacement", "${nested}!", testMap, "Hello World!", false);
- fseTest("hidden (runtime) nested null replacement", "Hello ${${nullVar}}World!", testMap, "Hello World!", false);
- fseTest("hidden (runtime) nested null callreplacement", "Hello ${${groovy:" + FlexibleStringExpanderTests.class.getName() + ".StaticReturnNull()}}World!", testMap, "Hello World!", false);
fseTest("UEL integration(nested): throw Exception", "${throw${exc}.value}", testMap, "", false);
fseTest("UEL integration(nested): throw NPE", "${throwNPE${blank}.value}", testMap, "", false);
fseTest("visible nested replacement", "${'Hello ${var}'}!", testMap, "Hello World!", false);