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