git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@695797 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -43,6 +43,7 @@ Christoph Wilhelms | |||||
| Christophe Labouisse | Christophe Labouisse | ||||
| Christopher A. Longo | Christopher A. Longo | ||||
| Christopher Charlier | Christopher Charlier | ||||
| Clemens Hammacher | |||||
| Conor MacNeill | Conor MacNeill | ||||
| Craeg Strong | Craeg Strong | ||||
| Craig Cottingham | Craig Cottingham | ||||
| @@ -214,6 +214,10 @@ Fixed bugs: | |||||
| the link's target. | the link's target. | ||||
| Bugzilla Report 41525. | Bugzilla Report 41525. | ||||
| * when checking whether a jar is signed, <signjar> ignored the | |||||
| sigfile attribute. | |||||
| Bugzilla Report 44805. | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| @@ -194,6 +194,10 @@ | |||||
| <first>Christopher</first> | <first>Christopher</first> | ||||
| <last>Charlier</last> | <last>Charlier</last> | ||||
| </name> | </name> | ||||
| <name> | |||||
| <first>Clemens</first> | |||||
| <last>Hammacher</last> | |||||
| </name> | |||||
| <name> | <name> | ||||
| <first>Conor</first> | <first>Conor</first> | ||||
| <last>MacNeill</last> | <last>MacNeill</last> | ||||
| @@ -474,7 +474,7 @@ public class SignJar extends AbstractJarSignerTask { | |||||
| /** | /** | ||||
| * test for a file being signed, by looking for a signature in the META-INF | * test for a file being signed, by looking for a signature in the META-INF | ||||
| * directory with our alias. | |||||
| * directory with our alias/sigfile. | |||||
| * | * | ||||
| * @param file the file to be checked | * @param file the file to be checked | ||||
| * @return true if the file is signed | * @return true if the file is signed | ||||
| @@ -482,7 +482,7 @@ public class SignJar extends AbstractJarSignerTask { | |||||
| */ | */ | ||||
| protected boolean isSigned(File file) { | protected boolean isSigned(File file) { | ||||
| try { | try { | ||||
| return IsSigned.isSigned(file, alias); | |||||
| return IsSigned.isSigned(file, sigfile == null ? alias : sigfile); | |||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| //just log this | //just log this | ||||
| log(e.toString(), Project.MSG_VERBOSE); | log(e.toString(), Project.MSG_VERBOSE); | ||||
| @@ -18,6 +18,7 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import java.io.File; | |||||
| import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
| import org.apache.tools.ant.util.JavaEnvUtils; | import org.apache.tools.ant.util.JavaEnvUtils; | ||||
| @@ -56,6 +57,27 @@ public class SignJarTest extends BuildFileTest { | |||||
| public void testSigFile() { | public void testSigFile() { | ||||
| executeTarget("sigfile"); | executeTarget("sigfile"); | ||||
| SignJarChild sj = new SignJarChild(); | |||||
| sj.setAlias("testonly"); | |||||
| sj.setKeystore("testkeystore"); | |||||
| sj.setStorepass("apacheant"); | |||||
| File jar = new File(getProject().getProperty("test.jar")); | |||||
| sj.setJar(jar); | |||||
| assertFalse("mustn't find signature without sigfile attribute", | |||||
| sj.isSigned()); | |||||
| sj.setSigfile("TEST"); | |||||
| assertTrue("must find signature with sigfile attribute", | |||||
| sj.isSigned()); | |||||
| } | |||||
| /** | |||||
| * subclass in order to get access to protected isSigned method if | |||||
| * tests and task come from different classloaders. | |||||
| */ | |||||
| private static class SignJarChild extends SignJar { | |||||
| public boolean isSigned() { | |||||
| return isSigned(jar); | |||||
| } | |||||
| } | } | ||||
| public void testMaxMemory() { | public void testMaxMemory() { | ||||