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/release10.04@1502572 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 6caa570..4771529 100644
--- a/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
+++ b/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
@@ -711,19 +711,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 ae503f0..2923614 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
@@ -283,16 +283,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);
@@ -302,9 +292,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);