Kev Jackson wrote:
I've just bene browsing the code and I noticed that IsSigned uses the
java.util.zip classes not the org.apache.tools.zip classes.
Now considering that apache zip has a nice closeQuietly method I thought
I'd change the IsSigned code to use that, but before I commit anything -
does anyone know of any reason why the following would fail?
I'd do the change. Its not a very good test anyway, as there is no easy
way to verify the integrity of a JAR (to an extent, you can't, you can
only verify the integrity of every class/resource within the JAR, but
there is no easy way to do that)
(don't want to break anything...)
Index:
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java
===================================================================
---
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java
(revision 372105)
+++
D:/java_projects/ant-core-trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java
(working copy)
@@ -19,12 +19,12 @@
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.DataType;
+import org.apache.tools.zip.ZipEntry;
+import org.apache.tools.zip.ZipFile;
/**
* Checks whether a jarfile is signed: if the name of the
@@ -39,7 +39,7 @@
private String name;
private File file;
-
+ /**
* The jarfile that is to be tested for the presence
* of a signature.
@@ -72,7 +72,7 @@
try {
jarFile = new ZipFile(zipFile);
if (null == name) {
- Enumeration entries = jarFile.entries();
+ Enumeration entries = jarFile.getEntries();
while (entries.hasMoreElements()) {
String eName = ((ZipEntry)
entries.nextElement()).getName();
if (eName.startsWith(SIG_START)
@@ -95,13 +95,7 @@
return shortSig || longSig;
} finally {
- if (jarFile != null) {
- try {
- jarFile.close();
- } catch (IOException e) {
- // Ignored
- }
- }
+ ZipFile.closeQuietly(jarFile);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]