You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2012/05/05 22:52:36 UTC
svn commit: r1334501 - in
/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang:
MiniLangValidate.java method/callops/SetServiceFields.java
method/envops/SetOperation.java
Author: adrianc
Date: Sat May 5 20:52:35 2012
New Revision: 1334501
URL: http://svn.apache.org/viewvc?rev=1334501&view=rev
Log:
Mini-language validation bug fix - allow nested expressions.
Modified:
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java?rev=1334501&r1=1334500&r2=1334501&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/MiniLangValidate.java Sat May 5 20:52:35 2012
@@ -148,7 +148,7 @@ public final class MiniLangValidate {
String attributeValue = element.getAttribute(name);
if (attributeValue.length() > 0) {
if (attributeValue.startsWith("${") && attributeValue.endsWith("}")) {
- handleError("Expression attribute \"" + name + "\" enclosed in \"${}\" (remove enclosing ${}).", method, element);
+ attributeValue = attributeValue.substring(2, attributeValue.length() - 1);
}
if (MiniLangUtil.containsScript(attributeValue)) {
handleError("Expression attribute \"" + name + "\" cannot contain a script (remove script).", method, element);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java?rev=1334501&r1=1334500&r2=1334501&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java Sat May 5 20:52:35 2012
@@ -65,6 +65,7 @@ public final class SetServiceFields exte
MiniLangValidate.attributeNames(simpleMethod, element, "service-name", "map", "to-map");
MiniLangValidate.requiredAttributes(simpleMethod, element, "service-name", "map", "to-map");
MiniLangValidate.constantPlusExpressionAttributes(simpleMethod, element, "service-name");
+ MiniLangValidate.expressionAttributes(simpleMethod, element, "map", "to-map");
MiniLangValidate.noChildElements(simpleMethod, element);
}
boolean elementModified = autoCorrect(element);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java?rev=1334501&r1=1334500&r2=1334501&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java Sat May 5 20:52:35 2012
@@ -60,15 +60,6 @@ public final class SetOperation extends
element.removeAttribute("from-field");
elementModified = true;
}
- fromAttr = element.getAttribute("from").trim();
- // Correct from attribute wrapped in ${}
- if (fromAttr.startsWith("${") && fromAttr.endsWith("}")) {
- fromAttr = fromAttr.substring(2, fromAttr.length() - 1);
- if (!fromAttr.contains("${")) {
- element.setAttribute("from", fromAttr);
- elementModified = true;
- }
- }
// Correct value attribute expression that belongs in from attribute
String valueAttr = element.getAttribute("value").trim();
if (valueAttr.startsWith("${") && valueAttr.endsWith("}")) {
@@ -103,6 +94,7 @@ public final class SetOperation extends
MiniLangValidate.requireAnyAttribute(simpleMethod, element, "from-field", "from", "value");
MiniLangValidate.constantPlusExpressionAttributes(simpleMethod, element, "value");
MiniLangValidate.constantAttributes(simpleMethod, element, "type", "set-if-null", "set-if-empty");
+ MiniLangValidate.expressionAttributes(simpleMethod, element, "field", "from-field", "from");
MiniLangValidate.noChildElements(simpleMethod, element);
}
boolean elementModified = autoCorrect(element);