Browse Source

Work around jdk 1.4.2(no _version) jarsigner bug.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278109 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
a63a14400d
1 changed files with 20 additions and 4 deletions
  1. +20
    -4
      src/main/org/apache/tools/ant/taskdefs/VerifyJar.java

+ 20
- 4
src/main/org/apache/tools/ant/taskdefs/VerifyJar.java View File

@@ -17,6 +17,7 @@

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.filters.ChainableReader;
@@ -134,10 +135,25 @@ public class VerifyJar extends AbstractJarSignerTask {
log("Verifying JAR: " +
jar.getAbsolutePath());
outputCache.clear();
cmd.execute();
String results=outputCache.toString();
if(results.indexOf(VERIFIED_TEXT)<0) {
throw new BuildException(ERROR_NO_VERIFY+jar);
BuildException ex = null;
try {
cmd.execute();
} catch (BuildException e) {
ex = e;
}
String results = outputCache.toString();
//deal with jdk1.4.2 bug:
if (ex != null) {
if (results.indexOf("zip file closed") >= 0) {
log("You are running " + JARSIGNER_COMMAND + " against a JVM with"
+ " a known bug that manifests as an IllegalStateException.",
Project.MSG_WARN);
} else {
throw ex;
}
}
if (results.indexOf(VERIFIED_TEXT) < 0) {
throw new BuildException(ERROR_NO_VERIFY + jar);
}
}



Loading…
Cancel
Save