run Deflator.end() to get rid of StrictMode errors:
java.lang.Throwable: Explicit termination method 'end' not called at dalvik.system.CloseGuard.open(CloseGuard.java:180) at java.util.zip.Deflater.<init>(Deflater.java:171) at kellinwood.zipio.ZioEntryOutputStream.<init>(ZioEntryOutputStream.java:35) at kellinwood.zipio.ZioEntry.getOutputStream(ZioEntry.java:482) at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:759) at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:664) at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:213) at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:492) at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:759) at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:709) at android.os.AsyncTask$2.call(AsyncTask.java:304) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) E StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
This commit is contained in:
parent
2ddf94a9f0
commit
558dde5f77
@ -28,18 +28,25 @@ public class ZioEntryOutputStream extends OutputStream {
|
|||||||
int crcValue = 0;
|
int crcValue = 0;
|
||||||
OutputStream wrapped;
|
OutputStream wrapped;
|
||||||
OutputStream downstream;
|
OutputStream downstream;
|
||||||
|
Deflater deflater;
|
||||||
|
|
||||||
public ZioEntryOutputStream(int compression, OutputStream wrapped) {
|
public ZioEntryOutputStream(int compression, OutputStream wrapped) {
|
||||||
this.wrapped = wrapped;
|
this.wrapped = wrapped;
|
||||||
if (compression != 0)
|
if (compression != 0) {
|
||||||
downstream = new DeflaterOutputStream(wrapped, new Deflater(Deflater.BEST_COMPRESSION, true));
|
deflater = new Deflater(Deflater.BEST_COMPRESSION, true);
|
||||||
else downstream = wrapped;
|
downstream = new DeflaterOutputStream(wrapped, deflater);
|
||||||
|
} else {
|
||||||
|
downstream = wrapped;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
downstream.flush();
|
downstream.flush();
|
||||||
downstream.close();
|
downstream.close();
|
||||||
crcValue = (int) crc.getValue();
|
crcValue = (int) crc.getValue();
|
||||||
|
if (deflater != null) {
|
||||||
|
deflater.end();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCRC() {
|
public int getCRC() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user