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-csv.git
The following commit(s) were added to refs/heads/master by this push:
new e5c8f49d Inline single use local variable
e5c8f49d is described below
commit e5c8f49d3cd60c6147a87df69a2e7ed1f6162bc2
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jun 6 09:12:52 2025 -0400
Inline single use local variable
---
src/main/java/org/apache/commons/csv/CSVParser.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java
b/src/main/java/org/apache/commons/csv/CSVParser.java
index 33ae7856..4d74bc96 100644
--- a/src/main/java/org/apache/commons/csv/CSVParser.java
+++ b/src/main/java/org/apache/commons/csv/CSVParser.java
@@ -886,7 +886,7 @@ public final class CSVParser implements
Iterable<CSVRecord>, Closeable {
recordList.clear();
StringBuilder sb = null;
final long startCharPosition = lexer.getCharacterPosition() +
characterOffset;
- final long startBytePosition = lexer.getBytesRead() +
this.characterOffset;
+ final long startBytePosition = lexer.getBytesRead() + characterOffset;
do {
reusableToken.reset();
lexer.nextToken(reusableToken);
@@ -919,12 +919,10 @@ public final class CSVParser implements
Iterable<CSVRecord>, Closeable {
throw new CSVException("Unexpected Token type: %s",
reusableToken.type);
}
} while (reusableToken.type == TOKEN);
-
if (!recordList.isEmpty()) {
recordNumber++;
- final String comment = Objects.toString(sb, null);
- result = new CSVRecord(this,
recordList.toArray(Constants.EMPTY_STRING_ARRAY), comment,
- recordNumber, startCharPosition, startBytePosition);
+ result = new CSVRecord(this,
recordList.toArray(Constants.EMPTY_STRING_ARRAY), Objects.toString(sb, null),
recordNumber, startCharPosition,
+ startBytePosition);
}
return result;
}