Author: adrianc
Date: Mon Jul 8 14:37:37 2013
New Revision: 1500772
URL: http://svn.apache.org/r1500772
Log:
Removed support for runtime nested expressions in FlexibleStringExpander.java.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=1500772&r1=1500771&r2=1500772&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
Mon Jul 8 14:37:37 2013
@@ -724,19 +724,6 @@ public abstract class FlexibleStringExpa
} 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;
}
}
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java?rev=1500772&r1=1500771&r2=1500772&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
Mon Jul 8 14:37:37 2013
@@ -286,16 +286,6 @@ public class FlexibleStringExpanderTests
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 @@ public class FlexibleStringExpanderTests
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);