commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (BEANUTILS-390) BeanComparator throws exception for null property values
Date Sat, 12 Mar 2011 00:20:59 GMT

     [ https://issues.apache.org/jira/browse/BEANUTILS-390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Niall Pemberton resolved BEANUTILS-390.
---------------------------------------

    Resolution: Won't Fix

There is no need for NullSafeBeanComparator - you can construct a BeanComparator with any
Comparator implementation, so you just need to do that with a null-safe flavour. As you point
out, the NullPointerException is in ComparableComparator - which isn't even part of BeanUtils

> BeanComparator throws exception for null property values
> --------------------------------------------------------
>
>                 Key: BEANUTILS-390
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-390
>             Project: Commons BeanUtils
>          Issue Type: Improvement
>          Components: Bean-Collections
>    Affects Versions: 1.8.3
>            Reporter: Matthew Toso
>            Priority: Minor
>         Attachments: NullSafeBeanComparator.java
>
>
> When using a BeanComparator to sort on a bean property that may contain null values,
an exception is thrown. By default, the BeanComparator uses a ComparableComparator internally.
ComparableComparator in turn throws a NullPointerException when it attempts to compare to
a null value. My proposed solution is extending BeanComparator with a new class, NullSafeBeanComparator,
that incorporates logic from NullComparator. I have a working example and will attach it.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message