Author: jkf Date: Sat Nov 11 14:05:54 2006 New Revision: 473806 URL: http://svn.apache.org/viewvc?view=rev&rev=473806 Log: br 40949: Test of several resources on 1.3 showed that the compareTo method in the CompressedResource was defective. HashMap on 1.4+ apparently checks using == before equals. When equals is used the compareTo on the CompressedResource would be called
Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java?view=diff&rev=473806&r1=473805&r2=473806 ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java Sat Nov 11 14:05:54 2006 @@ -159,7 +159,14 @@ * is less than, equal to, or greater than the specified Resource. */ public int compareTo(Object other) { + if (other == this) { + return 0; + } + if (other instanceof CompressedResource) { + return getResource().compareTo(((CompressedResource)other).getResource()); + } return getResource().compareTo(other); + } /** @@ -169,7 +176,7 @@ public int hashCode() { return getResource().hashCode(); } - + /** * Get an InputStream for the Resource. * @return an InputStream containing this Resource's content. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]