myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: ValidateCompareToTag
Date Fri, 28 Jul 2006 19:44:55 GMT
On 7/28/06, Mike Kienenberger <mkienenb@gmail.com> wrote:
> Thanks.
>
> That looks like the correct fix to me.   I never used the comparator
> attribute myself, and I created the accessors by copying the String
> accessors.
>
> Can you open a JIRA issue in Tomahawk for this and attach your patch?
> Feel free to assign the issue to me.

that is not possible :)
which is not bad ;)



>
> On 7/28/06, MT3 MTCube <mt3.mtcube@gmail.com> 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
>


-- 
Matthias Wessendorf

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Mime
View raw message