Avoid NPEs when FeatureComparators.Name hits a null value that it should compare
--------------------------------------------------------------------------------

                 Key: GEOT-3230
                 URL: http://jira.codehaus.org/browse/GEOT-3230
             Project: GeoTools
          Issue Type: Improvement
          Components: core main
    Affects Versions: 2.7-M2, 2.6.4
            Reporter: Stefan Alfons Tzeggai
            Assignee: Stefan Alfons Tzeggai
             Fix For: 2.6.5, 2.7-M3
         Attachments: npeInFeatureComparator.diff

I was just stumbling over a NPE in org.geotools.feature.FeatureComparators.Name 
it happens if one value of the attributes to compare is null. 

A standard "A".compareTo(null);  gives an NPE, too but when iteration over a 
featurecollection, we should be more relaxed about null attribute values. 
Andrea recommended to look at how PostgreSQL does it, and there 
"A".compareTo(null) would return 1

The attached patch contains a unit test against the NPE and changes the 
behaviour to not throw NPEs but rather sort null values to the bottom.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to