org.eobjects.metamodel.csv
Class InconsistentRowLengthException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.eobjects.metamodel.MetaModelException
org.eobjects.metamodel.InconsistentRowFormatException
org.eobjects.metamodel.csv.InconsistentRowLengthException
- All Implemented Interfaces:
- Serializable
public final class InconsistentRowLengthException
- extends InconsistentRowFormatException
Exception thrown when a line in a CSV file has an inconsistent amount of
columns compared to the previous lines (and headers). The exception will be
thrown when 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());
}
}
- Author:
- Kasper Sørensen
- See Also:
- Serialized Form
InconsistentRowLengthException
public InconsistentRowLengthException(int columnsInTable,
Row proposedRow,
String[] line,
int rowNumber)
getMessage
public String getMessage()
- Overrides:
getMessage in class InconsistentRowFormatException
getSourceLine
public String[] getSourceLine()
- Gets the source line, as parsed by the CSV parser (regardless of table
metadata).
- Returns:
- an array of string values.
getColumnsInLine
public int getColumnsInLine()
- Gets the amount of columns in the parsed line.
- Returns:
- an int representing the amount of values in the inconsistent
line.
getColumnsInTable
public int getColumnsInTable()
- Gets the expected amounts of columns, as defined by the table metadata.
- Returns:
- an int representing the amount of columns defined in the table.
Copyright © 2007-2012. All Rights Reserved.