Add a finalize() method to StrictJarFile

Bug: 25896372
Test: Booted device, installed CTS apps
Test: run cts --class android.util.cts.StrictJarFileTest
Change-Id: I35e238dadd48d2c4ca53ac37a4c5aacdd471a93a
This commit is contained in:
Neil Fuller
2015-12-03 17:31:18 +00:00
parent e40ab18590
commit b69f61472a

View File

@@ -175,6 +175,18 @@ public final class StrictJarFile {
}
}
@Override
protected void finalize() throws Throwable {
try {
if (guard != null) {
guard.warnIfOpen();
}
close();
} finally {
super.finalize();
}
}
private InputStream getZipInputStream(ZipEntry ze) {
if (ze.getMethod() == ZipEntry.STORED) {
return new RAFStream(raf, ze.getDataOffset(),