mirror of
https://github.com/corda/corda.git
synced 2025-06-17 06:38:21 +00:00
fix various bugs in BufferedReader.readLine
This commit is contained in:
@ -38,16 +38,18 @@ public class BufferedReader extends Reader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (position >= limit) {
|
if (position >= limit) {
|
||||||
return sb.toString();
|
return sb.length() == 0 ? null : sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = position; i < limit; ++i) {
|
for (int i = position; i < limit; ++i) {
|
||||||
if (buffer[i] == '\n') {
|
if (buffer[i] == '\n') {
|
||||||
sb.append(buffer, position, i);
|
sb.append(buffer, position, i - position);
|
||||||
position = i + 1;
|
position = i + 1;
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sb.append(buffer, position, limit-position);
|
||||||
|
position = limit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user