Browse Source

-swap to org.apache.tools.zip instead of jdk zip

-use closeQuietly

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@372176 13f79535-47bb-0310-9956-ffa450edef68
master
Kevin Jackson 19 years ago
parent
commit
eb92f9de45
1 changed files with 5 additions and 11 deletions
  1. +5
    -11
      src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java

+ 5
- 11
src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java View File

@@ -19,12 +19,12 @@ package org.apache.tools.ant.taskdefs.condition;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration; 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.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.DataType; 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 * Checks whether a jarfile is signed: if the name of the
@@ -39,7 +39,7 @@ public class IsSigned extends DataType implements Condition {


private String name; private String name;
private File file; private File file;
/** /**
* The jarfile that is to be tested for the presence * The jarfile that is to be tested for the presence
* of a signature. * of a signature.
@@ -72,7 +72,7 @@ public class IsSigned extends DataType implements Condition {
try { try {
jarFile = new ZipFile(zipFile); jarFile = new ZipFile(zipFile);
if (null == name) { if (null == name) {
Enumeration entries = jarFile.entries();
Enumeration entries = jarFile.getEntries();
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
String eName = ((ZipEntry) entries.nextElement()).getName(); String eName = ((ZipEntry) entries.nextElement()).getName();
if (eName.startsWith(SIG_START) if (eName.startsWith(SIG_START)
@@ -95,13 +95,7 @@ public class IsSigned extends DataType implements Condition {
return shortSig || longSig; return shortSig || longSig;
} finally { } finally {
if (jarFile != null) {
try {
jarFile.close();
} catch (IOException e) {
// Ignored
}
}
ZipFile.closeQuietly(jarFile);
} }
} }




Loading…
Cancel
Save