I created http://issues.apache.org/jira/browse/TOMAHAWK-605 and fixed the issue.
On 7/28/06, MT3 MTCube <[EMAIL PROTECTED]> wrote:
We have used the <s:validateCompareTo> with the "comparator" attribute, we
have inserted a value binding (like comparator=#{bean.myComparator}) in the
attribute but we have received this exception:
java.lang.ClassCastException: comparator must be type interface
java.util.Comparator but is type class java.lang.String
at
org.apache.myfaces.custom.comparetovalidator.CompareToValidator.createComparator(CompareToValidator.java:347)
at
org.apache.myfaces.custom.comparetovalidator.CompareToValidator.validate(CompareToValidator.java:292)
even if we get a java.util.Comparator from the bean.
We have solved the problem with this patch:
Index:
C:/current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/ValidateCompareToTag.java
===================================================================
---
C:/current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/ValidateCompareToTag.java
(revision 425405)
+++
C:/current/tomahawk/sandbox/core/src/main/java/org/apache/myfaces/custom/comparetovalidator/ValidateCompareToTag.java
(working copy)
@@ -71,7 +71,7 @@
if (_comparator != null)
{
ValueBinding vb =
facesContext.getApplication().createValueBinding(_comparator);
- validator.setComparator(vb.getValue(facesContext).toString());
+ validator.setComparator(vb.getValue(facesContext));
}
if (_foreignComponentName != null)
with this correction the "comparator" property receives the object instead
at first it receives a String (the cause of the later exception).
Is it correct or we have used the comparator attribute in a wrong way?
Thanks to all,
Mt3