You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2013/07/12 16:18:55 UTC
svn commit: r1502572 - in /ofbiz/branches/release10.04: ./
framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
Author: jacopoc
Date: Fri Jul 12 14:18:54 2013
New Revision: 1502572
URL: http://svn.apache.org/r1502572
Log:
Applied fix from trunk for revision: 1500772
===
Removed support for runtime nested expressions in FlexibleStringExpander.java.
Modified:
ofbiz/branches/release10.04/ (props changed)
ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
Propchange: ofbiz/branches/release10.04/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1500772
Modified: ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=1502572&r1=1502571&r2=1502572&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java (original)
+++ ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java Fri Jul 12 14:18:54 2013
@@ -711,19 +711,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/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java?rev=1502572&r1=1502571&r2=1502572&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java (original)
+++ ofbiz/branches/release10.04/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java Fri Jul 12 14:18:54 2013
@@ -283,16 +283,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);
@@ -302,9 +292,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);