public final class InconsistentRowLengthException extends InconsistentRowFormatException
DataSet.next()
is called.
Note that this exception is only thrown if the
CsvConfiguration.isFailOnInconsistentRowLength()
property is true.
Enabling it allows a somewhat different approach to iterating through a
resulting DataSet. For example something like:
while (true) { try { if (!dataSet.next) { break; } Row row = dataSet.getRow(); handleRegularRow(row); } catch (InconsistentRowLengthException e) { handleIrregularRow(e.getSourceLine()); } }
Constructor and Description |
---|
InconsistentRowLengthException(int columnsInTable,
Row proposedRow,
String[] line,
int rowNumber) |
Modifier and Type | Method and Description |
---|---|
int |
getColumnsInLine()
Gets the amount of columns in the parsed line.
|
int |
getColumnsInTable()
Gets the expected amounts of columns, as defined by the table metadata.
|
String |
getMessage() |
String[] |
getSourceLine()
Gets the source line, as parsed by the CSV parser (regardless of table
metadata).
|
getProposedRow, getRowNumber
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public String getMessage()
getMessage
in class InconsistentRowFormatException
public String[] getSourceLine()
public int getColumnsInLine()
public int getColumnsInTable()
Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.