mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 05:11:34 +02:00
Log an error if a DeletingFileInputStream is open at finalization
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user