[
https://jira.jboss.org/jira/browse/RF-7396?page=com.atlassian.jira.plugin...
]
Sondre Eikanger Kvalø reopened RF-7396:
---------------------------------------
The original bug report contains a bug ;-) Sorry for that!
As noted the list of sverity strings is always uppercase. However, the label used in
FacesMessage$Severity is camel case (i.e. "Info", "Warn",
"Error", "Fatal") .
See comments below
{code}
protected boolean isApplicableMessage(List<String> severenities,
FacesMessage message) {
// The Strings in the "severenities" list is always uppercase
if (severenities.size() == 0 || severenities.contains("ALL")) {
return true;
}
// Returns a FacesMessage$Severenity object
Severity severity = message.getSeverity();
for (Object key : FacesMessage.VALUES_MAP.keySet()) {
// gets a Severity object using the camel case "key"
from FacesMessage$Severity as key
Severity sev = (Severity) FacesMessage.VALUES_MAP.get(key);
if (0 == sev.compareTo(severity)) {
// search through the severenities list containing
upper-case strings using the camel case key. This will never return true.
return severenities.contains(key);
}
}
return false;
}
{code}
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: Tsikhon Kuprevich
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:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira