Skip to content

Commit ea9d689

Browse files
committed
sonarcloud_severity_low_1
Refactored the code in order to not assign to this loop counter from within the loop body.
1 parent 1a5d639 commit ea9d689

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public int read(final char[] buf, final int offset, final int length) throws IOE
174174

175175
final int len = super.read(buf, offset, length);
176176

177-
int eolCount;
177+
int eolCount = 0;
178178

179179
if (len > 0) {
180180
for (int i = offset; i < offset + len; i++) {
@@ -187,14 +187,13 @@ public int read(final char[] buf, final int offset, final int length) throws IOE
187187
eolCount++;
188188
}
189189
}
190-
eolCounter += eolCount;
191-
}
192-
else if (len == -1) {
190+
} else if (len == -1) {
193191
lastChar = END_OF_STREAM;
194192
} else {
195193
throw new IOException("Unexpected read length");
196194
}
197-
195+
eolCounter += eolCount;
196+
198197
position += len;
199198
return len;
200199
}

0 commit comments

Comments
 (0)