protected void validateHeader(List<String> headers) throws IOException { if (factory.isMultiTypeRecordSet()) { throw new IOException("Cannot validate the 'header' field of a Multi-Type Record Set. Reader fields definition defines multiple record definitions."); } RecordMetaData recordMetaData = factory.getRecordMetaData(); if (headers == null) { throw new IOException("Null header."); } if (validateHeader(headers, recordMetaData.getFields())) { return; } throw new IOException("Invalid header."); }
protected void validateHeader(List<String> headers) throws IOException { if (factory.isMultiTypeRecordSet()) { throw new IOException("Cannot validate the 'header' field of a Multi-Type Record Set. Reader fields definition defines multiple record definitions."); } RecordMetaData recordMetaData = factory.getRecordMetaData(); if (headers == null) { throw new IOException("Null header."); } if (validateHeader(headers, recordMetaData.getFields())) { return; } throw new IOException("Invalid header."); }
@Override protected void validateHeader(List<String> headers) { // For backward compatibility with pre v1.5.... try { super.validateHeader(headers); } catch (IOException e) { throw new CSVHeaderValidationException(getFactory().getRecordMetaData().getFieldNames(), headers); } } }
@Override protected void validateHeader(List<String> headers) { // For backward compatibility with pre v1.5.... try { super.validateHeader(headers); } catch (IOException e) { throw new CSVHeaderValidationException(getFactory().getRecordMetaData().getFieldNames(), headers); } } }
/** * {@inheritDoc} */ public void initialize() throws IOException { int skipLines = factory.getSkipLines(); // Move past the lines to be skipped ... while (lineNumber < skipLines) { _nextRecordFieldValues(); } // If the fields are defined in the message... read the next record if (factory.fieldsInMessage() || factory.validateHeader()) { List<String> fields = _nextRecordFieldValues(); if (factory.validateHeader()) { validateHeader(fields); } if (factory.fieldsInMessage()) { // In message field definitions do not support variable field definitions... just one record type supported... inMessageRecordMetaData = VariableFieldRecordMetaData.buildRecordMetaData(factory.getRecordElementName(), fields); } } }
/** * {@inheritDoc} */ public void initialize() throws IOException { int skipLines = factory.getSkipLines(); // Move past the lines to be skipped ... while (lineNumber < skipLines) { _nextRecordFieldValues(); } // If the fields are defined in the message... read the next record if (factory.fieldsInMessage() || factory.validateHeader()) { List<String> fields = _nextRecordFieldValues(); if (factory.validateHeader()) { validateHeader(fields); } if (factory.fieldsInMessage()) { // In message field definitions do not support variable field definitions... just one record type supported... inMessageRecordMetaData = VariableFieldRecordMetaData.buildRecordMetaData(factory.getRecordElementName(), fields); } } }