diff options
author | bpb <unknown> | 2019-04-29 07:39:16 -0700 |
---|---|---|
committer | bell-sw <liberica@bell-sw.com> | 2019-10-24 17:19:47 +0300 |
commit | b260ba78b83f81a091effb8e46422024039c4ae7 (patch) | |
tree | 6e3e1cd35344e11e8c0bc8bedbb436506104c219 /src/share | |
parent | 2f6724eebbb02b0bc001305f16ba9a666098c5a4 (diff) | |
download | jdk8u_jdk-b260ba78b83f81a091effb8e46422024039c4ae7.tar.gz |
8218280: LineNumberReader throws "Mark invalid" exception if CRLF straddles buffer.
Reviewed-by: dfuchs, prappo
Diffstat (limited to 'src/share')
-rw-r--r-- | src/share/classes/java/io/LineNumberReader.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/share/classes/java/io/LineNumberReader.java b/src/share/classes/java/io/LineNumberReader.java index 29884fdaa6..8cd6c14596 100644 --- a/src/share/classes/java/io/LineNumberReader.java +++ b/src/share/classes/java/io/LineNumberReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -259,6 +259,11 @@ public class LineNumberReader extends BufferedReader { */ public void mark(int readAheadLimit) throws IOException { synchronized (lock) { + // If the most recently read character is '\r', then increment the + // read ahead limit as in this case if the next character is '\n', + // two characters would actually be read by the next read(). + if (skipLF) + readAheadLimit++; super.mark(readAheadLimit); markedLineNumber = lineNumber; markedSkipLF = skipLF; |