diff --git a/F-Droid/build.gradle b/F-Droid/build.gradle index ef1fc2593..0e26dca10 100644 --- a/F-Droid/build.gradle +++ b/F-Droid/build.gradle @@ -36,7 +36,9 @@ if (!hasProperty('sourceDeps')) { // yet (seems to be a little unsupported as of late), so not using mavenCentral/jcenter. 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') // Project semi-abandoned, 3.4.1 is from 2011 and we use trunk from 2013 diff --git a/F-Droid/libs/binaryDeps/zipsigner.jar b/F-Droid/libs/binaryDeps/zipsigner.jar index 1e741d758..1a870774e 100644 Binary files a/F-Droid/libs/binaryDeps/zipsigner.jar and b/F-Droid/libs/binaryDeps/zipsigner.jar differ diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java b/F-Droid/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java index e404db88d..c23278e83 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java @@ -345,11 +345,13 @@ public class LocalRepoManager { 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.startDocument(null, null); tagFdroid(); serializer.endDocument(); + output.close(); } private void tagFdroid() throws IOException, LocalRepoKeyStore.InitException { @@ -485,7 +487,7 @@ public class LocalRepoManager { public void writeIndexJar() throws IOException { try { - new IndexXmlBuilder(context, apps).build(new FileWriter(xmlIndex)); + new IndexXmlBuilder(context, apps).build(xmlIndex); } catch (Exception e) { Log.e(TAG, "Could not write index jar", e); Toast.makeText(context, R.string.failed_to_create_index, Toast.LENGTH_LONG).show(); diff --git a/extern/zipsigner/src/main/java/kellinwood/security/zipsigner/ZipSigner.java b/extern/zipsigner/src/main/java/kellinwood/security/zipsigner/ZipSigner.java index d5c0604b2..8bc9aea5c 100644 --- a/extern/zipsigner/src/main/java/kellinwood/security/zipsigner/ZipSigner.java +++ b/extern/zipsigner/src/main/java/kellinwood/security/zipsigner/ZipSigner.java @@ -378,8 +378,10 @@ public class ZipSigner Manifest input = null; ZioEntry manifestEntry = entries.get(JarFile.MANIFEST_NAME); if (manifestEntry != null) { + InputStream is = manifestEntry.getInputStream(); input = new Manifest(); - input.read( manifestEntry.getInputStream()); + input.read(is); + is.close(); } Manifest output = new Manifest(); Attributes main = output.getMainAttributes(); @@ -645,6 +647,7 @@ public class ZipSigner ZipInput input = ZipInput.read( inputZipFilename); signZip( input.getEntries(), new FileOutputStream( outputZipFilename), outputZipFilename); + input.close(); } /** Sign the