Handle case where a file cannot be unzipped.

This commit is contained in:
CalDescent 2022-02-11 14:35:46 +00:00
parent fc82f0b622
commit 2343e739d1

View File

@ -468,12 +468,18 @@ public class ArbitraryDataReader {
throw new DataException(String.format("Unable to unzip file: %s", e.getMessage())); throw new DataException(String.format("Unable to unzip file: %s", e.getMessage()));
} }
// Replace filePath pointer with the uncompressed file path if (!this.uncompressedPath.toFile().exists()) {
throw new DataException(String.format("Unable to unzip file: %s", this.filePath));
}
// Delete original compressed file
if (FilesystemUtils.pathInsideDataOrTempPath(this.filePath)) { if (FilesystemUtils.pathInsideDataOrTempPath(this.filePath)) {
if (Files.exists(this.filePath)) { if (Files.exists(this.filePath)) {
Files.delete(this.filePath); Files.delete(this.filePath);
} }
} }
// Replace filePath pointer with the uncompressed file path
this.filePath = this.uncompressedPath; this.filePath = this.uncompressedPath;
} }