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
commit a3b4e89203f73a18114ab6fd43c431e4c714a88a Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Mar 14 15:41:32 2025 -0400 Remove extra vertical whitespace --- src/main/java/org/apache/commons/csv/CSVParser.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java b/src/main/java/org/apache/commons/csv/CSVParser.java index 29e4bc73..954af79c 100644 --- a/src/main/java/org/apache/commons/csv/CSVParser.java +++ b/src/main/java/org/apache/commons/csv/CSVParser.java @@ -243,7 +243,6 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable { if (current == null) { current = getNextRecord(); } - return current != null; } @@ -254,7 +253,6 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable { } CSVRecord next = current; current = null; - if (next == null) { // hasNext() wasn't called before next = getNextRecord(); @@ -262,7 +260,6 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable { throw new NoSuchElementException("No more CSV records available"); } } - return next; } @@ -624,7 +621,6 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable { } headerRecord = formatHeader; } - // build the name to index mappings if (headerRecord != null) { // Track an occurrence of a null, empty or blank header. @@ -633,18 +629,14 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable { final String header = headerRecord[i]; final boolean blankHeader = CSVFormat.isBlank(header); if (blankHeader && !format.getAllowMissingColumnNames()) { - throw new IllegalArgumentException( - "A header name is missing in " + Arrays.toString(headerRecord)); + throw new IllegalArgumentException("A header name is missing in " + Arrays.toString(headerRecord)); } - final boolean containsHeader = blankHeader ? observedMissing : headerMap.containsKey(header); final DuplicateHeaderMode headerMode = format.getDuplicateHeaderMode(); final boolean duplicatesAllowed = headerMode == DuplicateHeaderMode.ALLOW_ALL; final boolean emptyDuplicatesAllowed = headerMode == DuplicateHeaderMode.ALLOW_EMPTY; - if (containsHeader && !duplicatesAllowed && !(blankHeader && emptyDuplicatesAllowed)) { - throw new IllegalArgumentException( - String.format( + throw new IllegalArgumentException(String.format( "The header contains a duplicate name: \"%s\" in %s. If this is valid then use CSVFormat.Builder.setDuplicateHeaderMode().", header, Arrays.toString(headerRecord))); }