Search in sources :

Example 1 with FileReaderException

use of org.knime.base.node.io.filereader.FileReaderException in project knime-core by knime.

the class FixedWidthRowIterator method prepareForException.

/*
     * !!!!!!!!!! Creates the exception object (storing the last read items in
     * the row of the exception), sets the global "exception thrown" flag, and
     * closes the input stream. !!!!!!!!!!
     */
private FileReaderException prepareForException(final String msg, final int lineNumber, final String rowHeader, final DataCell[] cellsRead) {
    /*
         * indicate we have thrown (actually will throw...) an exception, and
         * close the stream as we will not read anymore from the stream after
         * the exception.
         */
    m_exceptionThrown = true;
    DataCell[] errCells = new DataCell[cellsRead.length];
    System.arraycopy(cellsRead, 0, errCells, 0, errCells.length);
    for (int c = 0; c < errCells.length; c++) {
        if (errCells[c] == null) {
            errCells[c] = DataType.getMissingCell();
        }
    }
    String errRowHeader = "ERROR_ROW (" + rowHeader.toString() + ")";
    DataRow errRow = new DefaultRow(errRowHeader, errCells);
    return new FileReaderException(msg, errRow, lineNumber);
}
Also used : FileReaderException(org.knime.base.node.io.filereader.FileReaderException) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow) DataRow(org.knime.core.data.DataRow)

Aggregations

FileReaderException (org.knime.base.node.io.filereader.FileReaderException)1 DataCell (org.knime.core.data.DataCell)1 DataRow (org.knime.core.data.DataRow)1 DefaultRow (org.knime.core.data.def.DefaultRow)1