mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Log an error if a DeletingFileInputStream is open at finalization
This commit is contained in:
parent
55cb41f5b2
commit
ddc524b588
1 changed files with 19 additions and 0 deletions
|
@ -38,4 +38,23 @@ public class DeletingFileInputStream extends FileInputStream {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We shouldn't rely on this for correctness!
|
||||
*/
|
||||
@Override
|
||||
protected void finalize() throws IOException {
|
||||
try {
|
||||
super.finalize();
|
||||
} finally {
|
||||
if(file != null) {
|
||||
Log.warn("File open at finalization time: {}", file.getCanonicalPath());
|
||||
try {
|
||||
close();
|
||||
} catch (IOException e) {
|
||||
Log.error("Failed to delete file", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue