From a63a14400d4462d174133f8691a1219c06ad9bba Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Wed, 6 Apr 2005 15:49:29 +0000 Subject: [PATCH] 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 --- .../apache/tools/ant/taskdefs/VerifyJar.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java b/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java index 655eeb9ac..e442cb179 100644 --- a/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java +++ b/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java @@ -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); } }