This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 3c03101 Abbreviate and only call readLine() once in the loop.
3c03101 is described below
commit 3c031018539e7caad8aca67948b83a86b9a6cc5c
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Aug 20 16:45:26 2020 -0400
Abbreviate and only call readLine() once in the loop.
---
src/main/java/org/apache/commons/io/IOUtils.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/IOUtils.java
b/src/main/java/org/apache/commons/io/IOUtils.java
index 0f8c4e1..55885b8 100644
--- a/src/main/java/org/apache/commons/io/IOUtils.java
+++ b/src/main/java/org/apache/commons/io/IOUtils.java
@@ -1816,10 +1816,9 @@ public class IOUtils {
public static List<String> readLines(final Reader input) throws
IOException {
final BufferedReader reader = toBufferedReader(input);
final List<String> list = new ArrayList<>();
- String line = reader.readLine();
- while (line != null) {
+ String line;
+ while ((line = reader.readLine()) != null) {
list.add(line);
- line = reader.readLine();
}
return list;
}