ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r887838 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW contributors.xml src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
Date Mon, 07 Dec 2009 05:28:50 GMT
Author: bodewig
Date: Mon Dec  7 05:28:50 2009
New Revision: 887838

URL: http://svn.apache.org/viewvc?rev=887838&view=rev
Log:
Make sure hashvalue algorithm of modified selector reads the files completely.  Submitted
by Nathan Beyer.  PR 48313.

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=887838&r1=887837&r2=887838&view=diff
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=887838&r1=887837&r2=887838&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Dec  7 05:28:50 2009
@@ -530,6 +530,10 @@
    overwrite each others attributes/nested elements.
    Bugzilla Report 41602.
 
+ * The Hashvalue algortihm implementation of the modified task could
+   fail to read the file(s) completely.
+   Bugzilla Report 48313.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=887838&r1=887837&r2=887838&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Mon Dec  7 05:28:50 2009
@@ -930,6 +930,10 @@
     <last>mnowostawski</last>
   </name>
   <name>
+    <first>Nathan</first>
+    <last>Beyer</last>
+  </name>
+  <name>
     <first>Nick</first>
     <last>Chalko</last>
   </name>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java?rev=887838&r1=887837&r2=887838&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
Mon Dec  7 05:28:50 2009
@@ -56,11 +56,14 @@
                 return null;
             }
             java.io.FileInputStream fis = new java.io.FileInputStream(file);
-            byte[] content = new byte[fis.available()];
-            fis.read(content);
+            StringBuffer content = new StringBuffer();
+            byte[] buffer = new byte[256];            
+            int len = 0;
+            while ((len = fis.read(buffer, 0, len)) != -1) {
+                content.append(new String(buffer, 0, len));
+            }
             fis.close();
-            String s = new String(content);
-            int hash = s.hashCode();
+            int hash = content.toString().hashCode();
             return Integer.toString(hash);
         } catch (Exception e) {
             return null;



Mime
View raw message