mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8230342: LineNumberReader.getLineNumber() returns inconsistent results after EOF
Reviewed-by: rriggs, dfuchs
This commit is contained in:
parent
c920b4a5c0
commit
4285853d91
3 changed files with 66 additions and 9 deletions
|
@ -25,7 +25,6 @@
|
|||
|
||||
package java.io;
|
||||
|
||||
|
||||
/**
|
||||
* A buffered character-input stream that keeps track of line numbers. This
|
||||
* class defines methods {@link #setLineNumber(int)} and {@link
|
||||
|
@ -200,9 +199,10 @@ public class LineNumberReader extends BufferedReader {
|
|||
*/
|
||||
public String readLine() throws IOException {
|
||||
synchronized (lock) {
|
||||
String l = super.readLine(skipLF);
|
||||
boolean[] term = new boolean[1];
|
||||
String l = super.readLine(skipLF, term);
|
||||
skipLF = false;
|
||||
if (l != null)
|
||||
if (l != null && term[0])
|
||||
lineNumber++;
|
||||
return l;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue