Browse Source

Delete reader cache directories if a resource is unable to be built.

qdn
CalDescent 3 years ago
parent
commit
c4a782301d
  1. 13
      src/main/java/org/qortal/arbitrary/ArbitraryDataReader.java

13
src/main/java/org/qortal/arbitrary/ArbitraryDataReader.java

@ -157,6 +157,10 @@ public class ArbitraryDataReader {
this.uncompress(); this.uncompress();
this.validate(); this.validate();
} catch (DataException e) {
this.deleteWorkingDirectory();
throw new DataException(e.getMessage());
} finally { } finally {
this.postExecute(); this.postExecute();
} }
@ -187,6 +191,15 @@ public class ArbitraryDataReader {
} }
} }
/**
* Working directory should only be deleted on failure, since it is currently used to
* serve a cached version of the resource for subsequent requests.
* @throws IOException
*/
private void deleteWorkingDirectory() throws IOException {
FilesystemUtils.safeDeleteDirectory(this.workingPath, true);
}
private void createUncompressedDirectory() throws DataException { private void createUncompressedDirectory() throws DataException {
try { try {
// Create parent directory // Create parent directory

Loading…
Cancel
Save