@Override Map<String, List<Map<String, String>>> loadDataSet() throws DataSetException { Map<String, List<Map<String, String>>> dataset; try { dataset = new ObjectMapper().readValue(input, Map.class); } catch (JsonParseException e) { throw new DataSetException("Error parsing json data set", e); } catch (JsonMappingException e) { throw new DataSetException("Error mapping json data set", e); } catch (IOException e) { throw new DataSetException("Error opening json data set", e); } return dataset; } }
@Override Map<String, List<Map<String, String>>> loadDataSet() throws DataSetException { Map<String, List<Map<String, String>>> dataset; try { dataset = new ObjectMapper().readValue(input, Map.class); } catch (JsonParseException e) { throw new DataSetException("Error parsing json data set", e); } catch (JsonMappingException e) { throw new DataSetException("Error mapping json data set", e); } catch (IOException e) { throw new DataSetException("Error opening json data set", e); } return dataset; } }
@Override Map<String, List<Map<String, String>>> loadDataSet() throws DataSetException { Map<String, List<Map<String, String>>> dataset; try { dataset = new ObjectMapper().readValue(input, Map.class); } catch (JsonParseException e) { throw new DataSetException("Error parsing json data set", e); } catch (JsonMappingException e) { throw new DataSetException("Error mapping json data set", e); } catch (IOException e) { throw new DataSetException("Error opening json data set", e); } return dataset; }
@Override Map<String, List<Map<String, String>>> loadDataSet() throws DataSetException { Map<String, List<Map<String, String>>> dataset = Collections.emptyMap(); try { dataset = new ObjectMapper().readValue(input, Map.class); } catch (JsonParseException e) { throw new DataSetException("Error parsing json data set", e); } catch (JsonMappingException e) { throw new DataSetException("Error mapping json data set", e); } catch (IOException e) { throw new DataSetException("Error opening json data set", e); } return dataset; }
/** * Wraps a {@link SAXException} into a {@link DataSetException} * * @param cause The cause to be wrapped into a {@link DataSetException} * @return A {@link DataSetException} that wraps the given {@link SAXException} */ protected final static DataSetException buildException(SAXException cause) { int lineNumber = -1; if (cause instanceof SAXParseException) { lineNumber = ((SAXParseException) cause).getLineNumber(); } Exception exception = cause.getException() == null ? cause : cause.getException(); String message; if (lineNumber >= 0) { message = "Line " + lineNumber + ": " + exception.getMessage(); } else { message = exception.getMessage(); } if (exception instanceof DataSetException) { return (DataSetException) exception; } else { return new DataSetException(message, exception); } } }
public void produce() throws DataSetException { logger.debug("produce() - start"); File file = new File(this.filePath); this._consumer.startDataSet(); try { produceFromFile(file); } catch (CsvParserException e) { throw new DataSetException("error producing dataset for table '" + file.getName() + "'", e); } catch (DataSetException e) { throw new DataSetException("error producing dataset for table '" + file.getName() + "'", e); } this._consumer.endDataSet(); }
public void endDataSet() throws DataSetException { logger.debug("endDataSet() - start"); try { _xmlWriter.endElement(); _xmlWriter.close(); } catch (IOException e) { throw new DataSetException(e); } }
@Override public void produce() throws DataSetException { logger.debug("produce() - start"); try { SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); saxParserFactory.setValidating(_validating); XMLReader xmlReader = saxParserFactory.newSAXParser().getXMLReader(); if (_dtdHandler != null) { FlatDtdProducer.setLexicalHandler(xmlReader, _dtdHandler); FlatDtdProducer.setDeclHandler(xmlReader, _dtdHandler); } xmlReader.setContentHandler(this); xmlReader.setErrorHandler(this); xmlReader.setEntityResolver(_resolver); xmlReader.parse(_inputSource); } catch (ParserConfigurationException e) { throw new DataSetException(e); } catch (SAXException e) { DataSetException exceptionToRethrow = buildException(e); throw exceptionToRethrow; } catch (IOException e) { throw new DataSetException(e); } }
public void endTable() throws DataSetException { logger.debug("endTable() - start"); if (_includeEmptyTable && _activeRowCount == 0) { try { String tableName = _activeMetaData.getTableName(); _xmlWriter.writeEmptyElement(tableName); } catch (IOException e) { throw new DataSetException(e); } } _activeMetaData = null; }
throw new DataSetException(e); } catch (IllegalInputCharacterException e) { throw new DataSetException(e); } catch (IOException e) { throw new DataSetException(e);
public void startDataSet() throws DataSetException { logger.debug("startDataSet() - start"); try { _xmlWriter.writeDeclaration(); _xmlWriter.writeDoctype(_systemId, null); _xmlWriter.writeElement(DATASET); } catch (IOException e) { throw new DataSetException(e); } }
throw new DataSetException("table=" + _activeMetaData.getTableName() + ", row=" + i + ", column=" + columnName + throw new DataSetException(e);