Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Applied fix from trunk for revision: 1500772
Browse files Browse the repository at this point in the history
===

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
  • Loading branch information
jacopoc committed Jul 12, 2013
1 parent b4b24c5 commit 89f8964
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,19 +711,6 @@ protected Object get(Map<String, ? extends Object> context, TimeZone timeZone, L
} 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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,6 @@ private void everythingTest() {
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);
Expand All @@ -302,9 +292,6 @@ private void everythingTest() {
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);
Expand Down

0 comments on commit 89f8964

Please sign in to comment.