You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Serge Knystautas <se...@lokitech.com> on 2004/08/06 20:51:28 UTC

Null-safe bean comparator

I've started using BeanComparator to sort on a date bean property, but 
I'm having an issue where sometimes that property is null.  It then 
gives me a ClassCastException:

java.lang.ClassCastException: java.lang.ClassCastException: There were 
nulls in the arguments for this method: compare(Sat Sep 04 00:00:00 CDT 
2004, null)
	 at 
org.apache.commons.beanutils.BeanComparator.compare(BeanComparator.java:145)

I'm only using 1.6, but I didn't see anything in the release notes 1.6.1 
or 1.7 that address this.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Null-safe bean comparator

Posted by Serge Knystautas <se...@lokitech.com>.
robert burrell donkin wrote:
> bean comparator's pretty easy so you not submit a patch!
> 
> please include a test case :)
> 
> see http://jakarta.apache.org/commons/patches.html (and the page linked  
> off it).

Sure, I was just wondering if this was intended behavior and there was a 
wrapper I should be calling for null-possible beans.  I'll upgrade first 
and then patch appropriately.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Null-safe bean comparator

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
bean comparator's pretty easy so you not submit a patch!

please include a test case :)

see http://jakarta.apache.org/commons/patches.html (and the page linked  
off it).

- robert

On 6 Aug 2004, at 19:51, Serge Knystautas wrote:

> I've started using BeanComparator to sort on a date bean property, but  
> I'm having an issue where sometimes that property is null.  It then  
> gives me a ClassCastException:
>
> java.lang.ClassCastException: java.lang.ClassCastException: There were  
> nulls in the arguments for this method: compare(Sat Sep 04 00:00:00  
> CDT 2004, null)
> 	 at  
> org.apache.commons.beanutils.BeanComparator.compare(BeanComparator.java 
> :145)
>
> I'm only using 1.6, but I didn't see anything in the release notes  
> 1.6.1 or 1.7 that address this.
>
> -- 
> Serge Knystautas
> Lokitech >> software . strategy . design >> http://www.lokitech.com
> p. 301.656.5501
> e. sergek@lokitech.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org