diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 720327c80..f2165d9d7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -226,6 +226,7 @@ Miha
Mike Davis
Mike Roberts
mnowostawski
+Nathan Beyer
Nick Chalko
Nick Fortescue
Nick Crossley
diff --git a/WHATSNEW b/WHATSNEW
index bed08bd10..204af08f7 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -530,6 +530,10 @@ Fixed bugs:
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:
--------------
diff --git a/contributors.xml b/contributors.xml
index 0dabc047d..44b5cb193 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -929,6 +929,10 @@
mnowostawski
+
+ Nathan
+ Beyer
+
Nick
Chalko
diff --git a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
index 10b7470d7..7f73de6be 100644
--- a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
+++ b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/HashvalueAlgorithm.java
@@ -56,11 +56,14 @@ public class HashvalueAlgorithm implements Algorithm {
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;