You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jk...@apache.org on 2006/11/11 23:05:54 UTC

svn commit: r473806 - /ant/core/trunk/src/main/org/apache/tools/ant/types/resources/CompressedResource.java

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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org