use of nl.knaw.dans.common.dataperfect.DataPerfectLibException in project timbuctoo by HuygensING.
the class DataPerfectLoader method loadData.
@Override
public void loadData(List<Tuple<String, File>> files, Importer importer) throws InvalidFileException, IOException {
Database dbPerfectdb = null;
try {
File output = writeZipToTempDir(files.get(0).getRight());
File dirWithDb = unwrapToplevelDirIfNeeded(output);
File structureFile = getStructureFile(dirWithDb);
dbPerfectdb = new Database(structureFile);
importDbPerfect(importer, dbPerfectdb);
delete(output);
} catch (DataPerfectLibException e) {
throw new InvalidFileException("Not a valid dataperfect file", e);
} finally {
try {
if (dbPerfectdb != null) {
dbPerfectdb.close();
}
} catch (IOException e) {
LOG.error("Something went wrong while closing the resources in the data import", e);
}
}
}
Aggregations