@@ -243,7 +243,6 @@ public boolean hasNext() {
243243 if (current == null ) {
244244 current = getNextRecord ();
245245 }
246-
247246 return current != null ;
248247 }
249248
@@ -254,15 +253,13 @@ public CSVRecord next() {
254253 }
255254 CSVRecord next = current ;
256255 current = null ;
257-
258256 if (next == null ) {
259257 // hasNext() wasn't called before
260258 next = getNextRecord ();
261259 if (next == null ) {
262260 throw new NoSuchElementException ("No more CSV records available" );
263261 }
264262 }
265-
266263 return next ;
267264 }
268265
@@ -624,7 +621,6 @@ private Headers createHeaders() throws IOException {
624621 }
625622 headerRecord = formatHeader ;
626623 }
627-
628624 // build the name to index mappings
629625 if (headerRecord != null ) {
630626 // Track an occurrence of a null, empty or blank header.
@@ -633,18 +629,14 @@ private Headers createHeaders() throws IOException {
633629 final String header = headerRecord [i ];
634630 final boolean blankHeader = CSVFormat .isBlank (header );
635631 if (blankHeader && !format .getAllowMissingColumnNames ()) {
636- throw new IllegalArgumentException (
637- "A header name is missing in " + Arrays .toString (headerRecord ));
632+ throw new IllegalArgumentException ("A header name is missing in " + Arrays .toString (headerRecord ));
638633 }
639-
640634 final boolean containsHeader = blankHeader ? observedMissing : headerMap .containsKey (header );
641635 final DuplicateHeaderMode headerMode = format .getDuplicateHeaderMode ();
642636 final boolean duplicatesAllowed = headerMode == DuplicateHeaderMode .ALLOW_ALL ;
643637 final boolean emptyDuplicatesAllowed = headerMode == DuplicateHeaderMode .ALLOW_EMPTY ;
644-
645638 if (containsHeader && !duplicatesAllowed && !(blankHeader && emptyDuplicatesAllowed )) {
646- throw new IllegalArgumentException (
647- String .format (
639+ throw new IllegalArgumentException (String .format (
648640 "The header contains a duplicate name: \" %s\" in %s. If this is valid then use CSVFormat.Builder.setDuplicateHeaderMode()." ,
649641 header , Arrays .toString (headerRecord )));
650642 }
0 commit comments