Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X b8613dd43 -> 145082417
GROOVY-8467: IOGroovyMethods readLine(Reader) method works in unexpected way Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/14508241 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/14508241 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/14508241 Branch: refs/heads/GROOVY_2_6_X Commit: 1450824170e8f58ce82d731c0c8ffd05e27b60f9 Parents: 83012c7 Author: paulk <pa...@asert.com.au> Authored: Thu Feb 8 22:57:28 2018 +1000 Committer: paulk <pa...@asert.com.au> Committed: Thu Feb 8 23:03:21 2018 +1000 ---------------------------------------------------------------------- .../java/org/codehaus/groovy/runtime/IOGroovyMethods.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/14508241/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java index 5fd2ef1..f65c85f 100644 --- a/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java +++ b/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java @@ -636,11 +636,19 @@ public class IOGroovyMethods extends DefaultGroovyMethodsSupport { } /** - * Read a single, whole line from the given Reader. + * Read a single, whole line from the given Reader. This method is designed for use with + * Readers that support the {@code mark()} operation like BufferReader. It has a fallback + * behavior for Readers that don't support mark() but the behavior doesn't correctly + * detect multi-character line termination (e.g. carriage return followed by linefeed). + * We recommend for Readers that don't support mark() you consider using one of the + * following methods instead: eachLine, readLines, or iterator. * * @param self a Reader * @return a line * @throws IOException if an IOException occurs. + * @see #readLines(java.io.Reader) + * @see #iterator(java.io.Reader) + * @see #eachLine(java.io.Reader, groovy.lang.Closure) * @since 1.0 */ public static String readLine(Reader self) throws IOException {