diff --git a/classpath/java/io/BufferedReader.java b/classpath/java/io/BufferedReader.java index 9c77a3246a..236a086b80 100644 --- a/classpath/java/io/BufferedReader.java +++ b/classpath/java/io/BufferedReader.java @@ -42,13 +42,18 @@ public class BufferedReader extends Reader { } for (int i = position; i < limit; ++i) { - if (buffer[i] == '\n' || buffer[i] == '\r') { + if(buffer[i] == '\r') { sb.append(buffer, position, i - position); position = i + 1; if(i+1 < limit && buffer[i+1] == '\n') { position = i + 1; + return sb.toString(); } return sb.toString(); + } else if (buffer[i] == '\n') { + sb.append(buffer, position, i - position); + position = i + 1; + return sb.toString(); } } sb.append(buffer, position, limit-position);