]
Alexander Dubovsky closed RF-7396.
----------------------------------
Assignee: Nick Belaevski (was: Tsikhon Kuprevich)
Verified
The level attribute on <richfaces:messages /> does not work
properly
--------------------------------------------------------------------
Key: RF-7396
URL:
https://jira.jboss.org/jira/browse/RF-7396
Project: RichFaces
Issue Type: Bug
Components: component, component-output
Affects Versions: 3.3.1
Environment: Windows XPSP3, Tomcat 6, Myfaces 1.2.7
Reporter: Sondre Eikanger Kvalø
Assignee: Nick Belaevski
Fix For: 3.3.2.CR1
We're trying to limit the messages rendered using the level attribute on the
<rich:messages /> tag.
However, no matter what values we specify for the level attribute it renders no messages.
Leaving out the attribute renders all messages.
Looking through the source we observed that the attribute value was
"uppercased" before it was compared with the severity property on the message in
the isApplicableMessages method in the UIRichMessages class. After comparing the value of
the severity property on the message with an object from the list of severities the method
returns with the statement severenities.contains(key) and this will never return true as
the "key" parameter is camel case (eg: Error) while the severenities list
(retrieved from the tag attribute) use upper case string values (eg: INFO, ERROR).
See comments below! :-)
protected boolean isApplicableMessage(List<String> severenities,
FacesMessage message) {
if (severenities.size() == 0 || severenities.contains("ALL")) {
return true;
}
Severity severity = message.getSeverity();
for (Object key : FacesMessage.VALUES_MAP.keySet()) {
Severity sev = (Severity) FacesMessage.VALUES_MAP.get(key);
if (0 == sev.compareTo(severity)) {
// Make the value of the "key" uppercase before invoking "contains"
return severenities.contains(key.toString().toUpperCase());
// original source
return severenities.contains(key);
}
}
return false;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: