diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4c9fdc9ab..f1f480c98 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -230,6 +230,7 @@ Steve Morin Steven E. Newton Takashi Okamoto Tariq Master +Trejkaz Xaoza Thomas Butz Thomas Christen Thomas Christensen diff --git a/WHATSNEW b/WHATSNEW index 45039138a..4426f7790 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -18,6 +18,7 @@ Fixed bugs: * Exception reporting in was broken. Bugzilla report 40300. * Handling of corrupt tar files, TarInputStream.read() never returns EOF. Bugzilla report 39924. +* Some bugs in ReaderInputStream. Bugzilla report 39635. Other changes: -------------- diff --git a/contributors.xml b/contributors.xml index 6aa1f4288..e7b3cf20d 100644 --- a/contributors.xml +++ b/contributors.xml @@ -958,6 +958,10 @@ Tom Eugelink + + Trejkaz + Xaoz + Ulrich Schmidt diff --git a/src/main/org/apache/tools/ant/util/ReaderInputStream.java b/src/main/org/apache/tools/ant/util/ReaderInputStream.java index 3a9065673..95c2071f0 100755 --- a/src/main/org/apache/tools/ant/util/ReaderInputStream.java +++ b/src/main/org/apache/tools/ant/util/ReaderInputStream.java @@ -85,16 +85,13 @@ public class ReaderInputStream extends InputStream { } else { byte[] buf = new byte[1]; if (read(buf, 0, 1) <= 0) { - result = -1; + return -1; + } else { + result = buf[0]; } - result = buf[0]; - } - - if (result < -1) { - result += 256; } - return result; + return result & 0xFF; } /** @@ -112,7 +109,9 @@ public class ReaderInputStream extends InputStream { if (in == null) { throw new IOException("Stream Closed"); } - + if (len == 0) { + return 0; + } while (slack == null) { char[] buf = new char[len]; // might read too much int n = in.read(buf);