swap: close resources reported by StrictMode
This required rebuilding the zipsigner.jar, since there was once issue to be fixed in kellingwood.security.zipsigner.ZipSigner. Here are the stacktraces: StrictMode E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. E java.lang.Throwable: Explicit termination method 'close' not called E at dalvik.system.CloseGuard.open(CloseGuard.java:184) E at java.io.FileOutputStream.<init>(FileOutputStream.java:90) E at java.io.FileOutputStream.<init>(FileOutputStream.java:73) E at java.io.FileWriter.<init>(FileWriter.java:42) E at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:488) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645) E at android.os.AsyncTask$2.call(AsyncTask.java:288) E at java.util.concurrent.FutureTask.run(FutureTask.java:237) E at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E at java.lang.Thread.run(Thread.java:841) E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. E java.lang.Throwable: Explicit termination method 'close' not called E at dalvik.system.CloseGuard.open(CloseGuard.java:184) E at java.io.RandomAccessFile.<init>(RandomAccessFile.java:128) E at kellinwood.zipio.ZipInput.<init>(ZipInput.java:57) E at kellinwood.zipio.ZipInput.read(ZipInput.java:75) E at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:646) E at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218) E at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645) E at android.os.AsyncTask$2.call(AsyncTask.java:288) E at java.util.concurrent.FutureTask.run(FutureTask.java:237) E at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E at java.lang.Thread.run(Thread.java:841) E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. E java.lang.Throwable: Explicit termination method 'end' not called E at dalvik.system.CloseGuard.open(CloseGuard.java:184) E at java.util.zip.Inflater.<init>(Inflater.java:82) E at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:475) E at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:445) E at kellinwood.security.zipsigner.ZipSigner.addDigestsToManifest(ZipSigner.java:418) E at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:713) E at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:647) E at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218) E at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645) E at android.os.AsyncTask$2.call(AsyncTask.java:288) E at java.util.concurrent.FutureTask.run(FutureTask.java:237) E at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E at java.lang.Thread.run(Thread.java:841) StrictMode E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. E java.lang.Throwable: Explicit termination method 'close' not called E at dalvik.system.CloseGuard.open(CloseGuard.java:184) E at java.io.FileOutputStream.<init>(FileOutputStream.java:90) E at java.io.FileOutputStream.<init>(FileOutputStream.java:73) E at java.io.FileWriter.<init>(FileWriter.java:42) E at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:488) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645) E at android.os.AsyncTask$2.call(AsyncTask.java:288) E at java.util.concurrent.FutureTask.run(FutureTask.java:237) E at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E at java.lang.Thread.run(Thread.java:841) E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. E java.lang.Throwable: Explicit termination method 'close' not called E at dalvik.system.CloseGuard.open(CloseGuard.java:184) E at java.io.RandomAccessFile.<init>(RandomAccessFile.java:128) E at kellinwood.zipio.ZipInput.<init>(ZipInput.java:57) E at kellinwood.zipio.ZipInput.read(ZipInput.java:75) E at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:646) E at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218) E at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645) E at android.os.AsyncTask$2.call(AsyncTask.java:288) E at java.util.concurrent.FutureTask.run(FutureTask.java:237) E at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E at java.lang.Thread.run(Thread.java:841) E A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. E java.lang.Throwable: Explicit termination method 'end' not called E at dalvik.system.CloseGuard.open(CloseGuard.java:184) E at java.util.zip.Inflater.<init>(Inflater.java:82) E at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:475) E at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:445) E at kellinwood.security.zipsigner.ZipSigner.addDigestsToManifest(ZipSigner.java:418) E at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:713) E at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:647) E at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218) E at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698) E at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645) E at android.os.AsyncTask$2.call(AsyncTask.java:288) E at java.util.concurrent.FutureTask.run(FutureTask.java:237) E at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E at java.lang.Thread.run(Thread.java:841)
This commit is contained in:
parent
2f06bf8b47
commit
8d20135779
@ -36,7 +36,9 @@ if (!hasProperty('sourceDeps')) {
|
|||||||
// yet (seems to be a little unsupported as of late), so not using mavenCentral/jcenter.
|
// yet (seems to be a little unsupported as of late), so not using mavenCentral/jcenter.
|
||||||
compile(name: 'nanohttpd-2.1.0')
|
compile(name: 'nanohttpd-2.1.0')
|
||||||
|
|
||||||
// Upstream doesn't have a binary on mavenCentral. Looks discontinued.
|
// Upstream doesn't have a binary on mavenCentral, and it is an SVN repo on
|
||||||
|
// Google Code. We include this code directly in this repo, and have made
|
||||||
|
// modifications that should be pushed to anyone who wants to maintain it.
|
||||||
compile(name: 'zipsigner')
|
compile(name: 'zipsigner')
|
||||||
|
|
||||||
// Project semi-abandoned, 3.4.1 is from 2011 and we use trunk from 2013
|
// Project semi-abandoned, 3.4.1 is from 2011 and we use trunk from 2013
|
||||||
|
Binary file not shown.
@ -345,11 +345,13 @@ public class LocalRepoManager {
|
|||||||
serializer = XmlPullParserFactory.newInstance().newSerializer();
|
serializer = XmlPullParserFactory.newInstance().newSerializer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build(Writer output) throws IOException, LocalRepoKeyStore.InitException {
|
public void build(File file) throws IOException, LocalRepoKeyStore.InitException {
|
||||||
|
Writer output = new FileWriter(file);
|
||||||
serializer.setOutput(output);
|
serializer.setOutput(output);
|
||||||
serializer.startDocument(null, null);
|
serializer.startDocument(null, null);
|
||||||
tagFdroid();
|
tagFdroid();
|
||||||
serializer.endDocument();
|
serializer.endDocument();
|
||||||
|
output.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tagFdroid() throws IOException, LocalRepoKeyStore.InitException {
|
private void tagFdroid() throws IOException, LocalRepoKeyStore.InitException {
|
||||||
@ -485,7 +487,7 @@ public class LocalRepoManager {
|
|||||||
|
|
||||||
public void writeIndexJar() throws IOException {
|
public void writeIndexJar() throws IOException {
|
||||||
try {
|
try {
|
||||||
new IndexXmlBuilder(context, apps).build(new FileWriter(xmlIndex));
|
new IndexXmlBuilder(context, apps).build(xmlIndex);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Could not write index jar", e);
|
Log.e(TAG, "Could not write index jar", e);
|
||||||
Toast.makeText(context, R.string.failed_to_create_index, Toast.LENGTH_LONG).show();
|
Toast.makeText(context, R.string.failed_to_create_index, Toast.LENGTH_LONG).show();
|
||||||
|
@ -378,8 +378,10 @@ public class ZipSigner
|
|||||||
Manifest input = null;
|
Manifest input = null;
|
||||||
ZioEntry manifestEntry = entries.get(JarFile.MANIFEST_NAME);
|
ZioEntry manifestEntry = entries.get(JarFile.MANIFEST_NAME);
|
||||||
if (manifestEntry != null) {
|
if (manifestEntry != null) {
|
||||||
|
InputStream is = manifestEntry.getInputStream();
|
||||||
input = new Manifest();
|
input = new Manifest();
|
||||||
input.read( manifestEntry.getInputStream());
|
input.read(is);
|
||||||
|
is.close();
|
||||||
}
|
}
|
||||||
Manifest output = new Manifest();
|
Manifest output = new Manifest();
|
||||||
Attributes main = output.getMainAttributes();
|
Attributes main = output.getMainAttributes();
|
||||||
@ -645,6 +647,7 @@ public class ZipSigner
|
|||||||
|
|
||||||
ZipInput input = ZipInput.read( inputZipFilename);
|
ZipInput input = ZipInput.read( inputZipFilename);
|
||||||
signZip( input.getEntries(), new FileOutputStream( outputZipFilename), outputZipFilename);
|
signZip( input.getEntries(), new FileOutputStream( outputZipFilename), outputZipFilename);
|
||||||
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sign the
|
/** Sign the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user