From df14817adf88edd88b908cc4d5a8fc5fd3330feb Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 18 May 2018 08:13:40 +0000 Subject: [PATCH] "Applied fix from trunk for revision: 1831831" ------------------------------------------------------------------------ r1831831 | jleroux | 2018-05-18 10:11:55 +0200 (ven. 18 mai 2018) | 11 lignes Fixed:: Dynamic values not rendering properly in property tag of fail-property attribute (OFBIZ-10406) While calling checkProductRelatedPermission, if permission is failed ten fail-property tag uses ${checkActionLabel} which is not handled properly in MessageElement.java. There are 2-3 other occurrences as well of such type but not in working condition. Thanks: Suraj ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1831832 13f79535-47bb-0310-9956-ffa450edef68 --- .../minilang/product/product/ProductServices.xml | 1 + .../minilang/product/store/ProductStoreServices.xml | 1 + .../ofbiz/minilang/method/MessageElement.java | 13 ++++++------- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/applications/product/minilang/product/product/ProductServices.xml b/applications/product/minilang/product/product/ProductServices.xml index 72766b565d..84063c5a25 100644 --- a/applications/product/minilang/product/product/ProductServices.xml +++ b/applications/product/minilang/product/product/ProductServices.xml @@ -686,6 +686,7 @@ under the License. + diff --git a/applications/product/minilang/product/store/ProductStoreServices.xml b/applications/product/minilang/product/store/ProductStoreServices.xml index b763b242a1..ac8297e196 100644 --- a/applications/product/minilang/product/store/ProductStoreServices.xml +++ b/applications/product/minilang/product/store/ProductStoreServices.xml @@ -478,6 +478,7 @@ under the License. + diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MessageElement.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MessageElement.java index 4d2809a497..7e99cf40d5 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MessageElement.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MessageElement.java @@ -29,7 +29,6 @@ import org.w3c.dom.Element; /** * Implements the <fail-message> and <fail-property> elements. - * * @see Mini-language Reference */ public final class MessageElement extends MiniLangElement { @@ -49,7 +48,7 @@ public final class MessageElement extends MiniLangElement { } private final FlexibleStringExpander messageFse; - private final String propertykey; + private final FlexibleStringExpander propertyFse; private final String propertyResource; public MessageElement(Element element, SimpleMethod simpleMethod) throws MiniLangException { @@ -61,7 +60,7 @@ public final class MessageElement extends MiniLangElement { MiniLangValidate.constantPlusExpressionAttributes(simpleMethod, element, "message"); } this.messageFse = FlexibleStringExpander.getInstance(element.getAttribute("message")); - this.propertykey = null; + this.propertyFse = null; this.propertyResource = null; } else { if (MiniLangValidate.validationOn()) { @@ -70,7 +69,7 @@ public final class MessageElement extends MiniLangElement { MiniLangValidate.constantAttributes(simpleMethod, element, "property", "resource"); } this.messageFse = null; - this.propertykey = element.getAttribute("property"); + this.propertyFse = FlexibleStringExpander.getInstance(element.getAttribute("property")); this.propertyResource = element.getAttribute("resource"); } } @@ -79,7 +78,7 @@ public final class MessageElement extends MiniLangElement { if (messageFse != null) { return messageFse.expandString(methodContext.getEnvMap()); } else { - return UtilProperties.getMessage(propertyResource, propertykey, methodContext.getEnvMap(), methodContext.getLocale()); + return UtilProperties.getMessage(propertyResource, propertyFse.expandString(methodContext.getEnvMap()), methodContext.getEnvMap(), methodContext.getLocale()); } } @@ -89,8 +88,8 @@ public final class MessageElement extends MiniLangElement { if (this.messageFse != null) { sb.append(""); } - if (this.propertykey != null) { - sb.append(""); + if (this.propertyFse != null) { + sb.append(""); } return sb.toString(); }