You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2012/07/27 01:09:35 UTC
[jira] [Commented] (COLLECTIONS-331) CollatingIterator NPE when
Comparator is null
[ https://issues.apache.org/jira/browse/COLLECTIONS-331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423542#comment-13423542 ]
Hudson commented on COLLECTIONS-331:
------------------------------------
Integrated in commons-collections #69 (See [https://builds.apache.org/job/commons-collections/69/])
Add change for 3.2.2 also for 4.0 release, fix javadoc for COLLECTIONS-331. (Revision 1366195)
Result = SUCCESS
tn : http://svn.apache.org/viewvc/?view=rev&rev=1366195
Files :
* /commons/proper/collections/trunk/src/changes/changes.xml
* /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/iterators/CollatingIterator.java
> CollatingIterator NPE when Comparator is null
> ---------------------------------------------
>
> Key: COLLECTIONS-331
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-331
> Project: Commons Collections
> Issue Type: Bug
> Components: Iterator
> Affects Versions: 3.2
> Reporter: Michael Krkoska
> Assignee: Jochen Wiedmann
> Priority: Minor
> Fix For: 3.2.2, 4.0
>
> Attachments: COLLECTIONS-331.patch, CollatingIteratorTest.java
>
> Original Estimate: 5m
> Remaining Estimate: 5m
>
> Run the attached Test against commons-collections-3.2.1. While the JavaDoc for CollatingIterator claims
> {{@param comp the comparator to use to sort, or null to use natural sort order}}
> the test fails, because the comparator is null.
> Fixing this requires a change in {{org.apache.commons.collections.iterators.CollatingIterator.least()}}:
> {code}
> if (comparator.compare(curObject,leastObject) < 0) { ...
> {code}
> could be replaced with
> {code}
> int c = comparator==null?((Comparable)curObject).compareTo(leastObject):comparator.compare(curObject,leastObject);
> if (c < 0) { ...
> {code}
> The workaround is to provide a comparator, of course.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira