forked from Qortal/qortal
Delete reader cache directories if a resource is unable to be built.
This commit is contained in:
parent
17fe94fa46
commit
c4a782301d
@ -157,6 +157,10 @@ public class ArbitraryDataReader {
|
||||
this.uncompress();
|
||||
this.validate();
|
||||
|
||||
} catch (DataException e) {
|
||||
this.deleteWorkingDirectory();
|
||||
throw new DataException(e.getMessage());
|
||||
|
||||
} finally {
|
||||
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 {
|
||||
try {
|
||||
// Create parent directory
|
||||
|
Loading…
x
Reference in New Issue
Block a user