From 5c189cfe154e0bb75e70b748576b555692aa6348 Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Tue, 10 Mar 2015 20:39:28 +0300 Subject: [PATCH] Fix bug in InputStream.read implementation --- .../src/main/java/org/teavm/classlib/java/io/TInputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java index 8e0255e65..b920d370f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java @@ -36,7 +36,7 @@ public abstract class TInputStream extends TObject implements TCloseable { for (int i = 0; i < len; ++i) { int bt = read(); if (bt < 0) { - return i; + return i == 0 ? -1 : i; } b[off++] = (byte)bt; }