You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/09/16 11:47:48 UTC
svn commit: r695797 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW
contributors.xml src/main/org/apache/tools/ant/taskdefs/SignJar.java
src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
Author: bodewig
Date: Tue Sep 16 02:47:47 2008
New Revision: 695797
URL: http://svn.apache.org/viewvc?rev=695797&view=rev
Log:
use sigfile attribute when checking whether a jar is already signed. PR 44805. Submitted by Clemens Hammacher.
Modified:
ant/core/trunk/CONTRIBUTORS
ant/core/trunk/WHATSNEW
ant/core/trunk/contributors.xml
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=695797&r1=695796&r2=695797&view=diff
==============================================================================
Binary files - no diff available.
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=695797&r1=695796&r2=695797&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Sep 16 02:47:47 2008
@@ -214,6 +214,10 @@
the link's target.
Bugzilla Report 41525.
+ * when checking whether a jar is signed, <signjar> ignored the
+ sigfile attribute.
+ Bugzilla Report 44805.
+
Other changes:
--------------
Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=695797&r1=695796&r2=695797&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Tue Sep 16 02:47:47 2008
@@ -195,6 +195,10 @@
<last>Charlier</last>
</name>
<name>
+ <first>Clemens</first>
+ <last>Hammacher</last>
+ </name>
+ <name>
<first>Conor</first>
<last>MacNeill</last>
</name>
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java?rev=695797&r1=695796&r2=695797&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java Tue Sep 16 02:47:47 2008
@@ -474,7 +474,7 @@
/**
* 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
* @return true if the file is signed
@@ -482,7 +482,7 @@
*/
protected boolean isSigned(File file) {
try {
- return IsSigned.isSigned(file, alias);
+ return IsSigned.isSigned(file, sigfile == null ? alias : sigfile);
} catch (IOException e) {
//just log this
log(e.toString(), Project.MSG_VERBOSE);
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java?rev=695797&r1=695796&r2=695797&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java Tue Sep 16 02:47:47 2008
@@ -18,6 +18,7 @@
package org.apache.tools.ant.taskdefs;
+import java.io.File;
import org.apache.tools.ant.BuildFileTest;
import org.apache.tools.ant.util.JavaEnvUtils;
@@ -56,6 +57,27 @@
public void testSigFile() {
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() {