[Reproducible-builds] [sortjar] 02/05: Added build.xml, removed some unnecessary cleanup code.

Drew Fisher zarvox-guest at moszumanska.debian.org
Sat Aug 30 18:43:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

zarvox-guest pushed a commit to branch master
in repository sortjar.

commit 778ba640268f3719a088c083052fe237eb5ab1eb
Author: akwizgran <akwizgran at users.sourceforge.net>
Date:   Sat Apr 12 20:09:57 2014 +0100

    Added build.xml, removed some unnecessary cleanup code.
---
 build.xml                                 | 18 ++++++++++++++++++
 src/org/briarproject/sortjar/SortJar.java | 20 ++++----------------
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..230b359
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,18 @@
+<project name='SortJar' default='jar'>
+	<target name='clean'>
+		<delete dir='bin' />
+		<delete file='SortJar.jar' />
+	</target>
+	<target name='compile'>
+		<mkdir dir='bin' />
+		<javac srcdir='src' destdir='bin' source='1.5' target='1.5'
+			includeantruntime='false' debug='off' />
+	</target>
+	<target name='jar' depends='compile'>
+		<mkdir dir='bin/META-INF' />
+		<echo message='Main-Class: org.briarproject.sortjar.SortJar'
+			file='bin/META-INF/MANIFEST.MF' />
+		<jar basedir='bin' manifest='bin/META-INF/MANIFEST.MF'
+			destfile='SortJar.jar' />
+	</target>
+</project>
diff --git a/src/org/briarproject/sortjar/SortJar.java b/src/org/briarproject/sortjar/SortJar.java
index 2ebf082..db39bb1 100644
--- a/src/org/briarproject/sortjar/SortJar.java
+++ b/src/org/briarproject/sortjar/SortJar.java
@@ -17,18 +17,16 @@ public class SortJar {
 			System.err.println("Usage: SortJar <input.jar> <output.jar>");
 			System.exit(1);
 		}
-		String input = args[0];
-		String output = args[1];
-		ZipFile in = null;
-		ZipOutputStream out = null;
+		String input = args[0], output = args[1];
 		try {
 			// Read and sort the entries
 			Map<String, ZipEntry> entries = new TreeMap<String, ZipEntry>();
-			in = new ZipFile(input);
+			ZipFile in = new ZipFile(input);
 			for(ZipEntry e : Collections.list(in.entries()))
 				entries.put(e.getName(), e);
 			// Write the sorted entries
-			out = new ZipOutputStream(new FileOutputStream(output));
+			ZipOutputStream out = new ZipOutputStream(
+					new FileOutputStream(output));
 			for(ZipEntry e : entries.values()) {
 				ZipEntry e1 = new ZipEntry(e.getName());
 				e1.setTime(0);
@@ -44,16 +42,6 @@ public class SortJar {
 			out.close();
 			in.close();
 		} catch(IOException e) {
-			if(in != null) {
-				try {
-					in.close();
-				} catch(IOException ignored) {}
-			}
-			if(out != null) {
-				try {
-					out.close();
-				} catch(IOException ignored) {}
-			}
 			e.printStackTrace();
 			System.exit(2);
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/sortjar.git



More information about the Reproducible-builds mailing list