You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by MT3 MTCube <mt...@gmail.com> on 2006/07/28 20:06:49 UTC
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
Re: ValidateCompareToTag
Posted by Mike Kienenberger <mk...@gmail.com>.
Ok. I don't always keep track of which issue trackers allow which actions.
In any case, when I see the issue created in JIRA, I'll take ownership
of it and assign it to myself.
On 7/28/06, Matthias Wessendorf <ma...@apache.org> wrote:
> * Feel free to assign the issue to me. *
>
> only we can assign task to devs ;)
> you to me.
> me to you
>
>
>
> On 7/28/06, Mike Kienenberger <mk...@gmail.com> wrote:
> > > On 7/28/06, Mike Kienenberger <mk...@gmail.com> wrote:
> > > > 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.
> >
> > On 7/28/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > > that is not possible :)
> > > which is not bad ;)
> >
> > Matthias, what's not possible?
> >
>
>
> --
> Matthias Wessendorf
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>
Re: ValidateCompareToTag
Posted by Matthias Wessendorf <ma...@apache.org>.
* Feel free to assign the issue to me. *
only we can assign task to devs ;)
you to me.
me to you
On 7/28/06, Mike Kienenberger <mk...@gmail.com> wrote:
> > On 7/28/06, Mike Kienenberger <mk...@gmail.com> wrote:
> > > 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.
>
> On 7/28/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > that is not possible :)
> > which is not bad ;)
>
> Matthias, what's not possible?
>
--
Matthias Wessendorf
further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com
Re: ValidateCompareToTag
Posted by Mike Kienenberger <mk...@gmail.com>.
> On 7/28/06, Mike Kienenberger <mk...@gmail.com> wrote:
> > 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.
On 7/28/06, Matthias Wessendorf <ma...@apache.org> wrote:
> that is not possible :)
> which is not bad ;)
Matthias, what's not possible?
Re: ValidateCompareToTag
Posted by Matthias Wessendorf <ma...@apache.org>.
On 7/28/06, Mike Kienenberger <mk...@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 <mt...@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
Re: ValidateCompareToTag
Posted by Mike Kienenberger <mk...@gmail.com>.
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.
On 7/28/06, MT3 MTCube <mt...@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
Re: ValidateCompareToTag
Posted by Mike Kienenberger <mk...@gmail.com>.
I created http://issues.apache.org/jira/browse/TOMAHAWK-605 and fixed the issue.
On 7/28/06, MT3 MTCube <mt...@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