compareToValidator JSP tag converts "comparator" property to string instead of
Comparator
-----------------------------------------------------------------------------------------
Key: TOMAHAWK-605
URL: http://issues.apache.org/jira/browse/TOMAHAWK-605
Project: MyFaces Tomahawk
Issue Type: Bug
Components: Validators
Affects Versions: 1.1.5-SNAPSHOT
Reporter: Mike Kienenberger
Assigned To: Mike Kienenberger
Fix For: 1.1.5-SNAPSHOT
Date: Fri, 28 Jul 2006 20:06:49 +0200
From: "MT3 MTCube" <[EMAIL PROTECTED]>
To: [email protected]
Subject: ValidateCompareToTag
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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira