"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
This commit is contained in:
+6
-7
@@ -29,7 +29,6 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Implements the <fail-message> and <fail-property> elements.
|
||||
*
|
||||
* @see <a href="https://cwiki.apache.org/confluence/display/OFBIZ/Mini+Language+-+minilang+-+simple-method+-+Reference">Mini-language Reference</a>
|
||||
*/
|
||||
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("<fail-message message=\"").append(this.messageFse).append("\" />");
|
||||
}
|
||||
if (this.propertykey != null) {
|
||||
sb.append("<fail-property property=\"").append(this.propertykey).append(" resource=\"").append(this.propertyResource).append("\" />");
|
||||
if (this.propertyFse != null) {
|
||||
sb.append("<fail-property property=\"").append(this.propertyFse).append(" resource=\"").append(this.propertyResource).append("\" />");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user