Browse Source

stylecheck

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277094 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
99055de433
1 changed files with 24 additions and 5 deletions
  1. +24
    -5
      src/main/org/apache/tools/ant/taskdefs/SignJar.java

+ 24
- 5
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -18,10 +18,7 @@ package org.apache.tools.ant.taskdefs;


import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector; import java.util.Vector;
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.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
@@ -95,6 +92,7 @@ public class SignJar extends Task {


/** /**
* the jar file to sign; required * the jar file to sign; required
* @param jar the jar file to sign
*/ */
public void setJar(final File jar) { public void setJar(final File jar) {
this.jar = jar; this.jar = jar;
@@ -102,6 +100,7 @@ public class SignJar extends Task {


/** /**
* the alias to sign under; required * the alias to sign under; required
* @param alias the alias to sign under
*/ */
public void setAlias(final String alias) { public void setAlias(final String alias) {
this.alias = alias; this.alias = alias;
@@ -109,6 +108,7 @@ public class SignJar extends Task {


/** /**
* keystore location; required * keystore location; required
* @param keystore the keystore location
*/ */
public void setKeystore(final String keystore) { public void setKeystore(final String keystore) {
this.keystore = keystore; this.keystore = keystore;
@@ -116,6 +116,7 @@ public class SignJar extends Task {


/** /**
* password for keystore integrity; required * password for keystore integrity; required
* @param storepass the password for the keystore
*/ */
public void setStorepass(final String storepass) { public void setStorepass(final String storepass) {
this.storepass = storepass; this.storepass = storepass;
@@ -123,6 +124,7 @@ public class SignJar extends Task {


/** /**
* keystore type; optional * keystore type; optional
* @param storetype the keystore type
*/ */
public void setStoretype(final String storetype) { public void setStoretype(final String storetype) {
this.storetype = storetype; this.storetype = storetype;
@@ -130,6 +132,7 @@ public class SignJar extends Task {


/** /**
* password for private key (if different); optional * password for private key (if different); optional
* @param keypass the password for the key (if different)
*/ */
public void setKeypass(final String keypass) { public void setKeypass(final String keypass) {
this.keypass = keypass; this.keypass = keypass;
@@ -137,6 +140,7 @@ public class SignJar extends Task {


/** /**
* name of .SF/.DSA file; optional * name of .SF/.DSA file; optional
* @param sigfile the name of the .SF/.DSA file
*/ */
public void setSigfile(final String sigfile) { public void setSigfile(final String sigfile) {
this.sigfile = sigfile; this.sigfile = sigfile;
@@ -144,6 +148,7 @@ public class SignJar extends Task {


/** /**
* name of signed JAR file; optional * name of signed JAR file; optional
* @param signedjar the name of the signed jar file
*/ */
public void setSignedjar(final File signedjar) { public void setSignedjar(final File signedjar) {
this.signedjar = signedjar; this.signedjar = signedjar;
@@ -152,6 +157,7 @@ public class SignJar extends Task {
/** /**
* Enable verbose output when signing * Enable verbose output when signing
* ; optional: default false * ; optional: default false
* @param verbose if true enable verbose output
*/ */
public void setVerbose(final boolean verbose) { public void setVerbose(final boolean verbose) {
this.verbose = verbose; this.verbose = verbose;
@@ -160,6 +166,7 @@ public class SignJar extends Task {
/** /**
* Flag to include the .SF file inside the signature; * Flag to include the .SF file inside the signature;
* optional; default false * optional; default false
* @param internalsf if true include the .SF file inside the signature
*/ */
public void setInternalsf(final boolean internalsf) { public void setInternalsf(final boolean internalsf) {
this.internalsf = internalsf; this.internalsf = internalsf;
@@ -168,6 +175,7 @@ public class SignJar extends Task {
/** /**
* flag to compute hash of entire manifest; * flag to compute hash of entire manifest;
* optional, default false * optional, default false
* @param sectionsonly flag to compute hash of entire manifest
*/ */
public void setSectionsonly(final boolean sectionsonly) { public void setSectionsonly(final boolean sectionsonly) {
this.sectionsonly = sectionsonly; this.sectionsonly = sectionsonly;
@@ -177,6 +185,7 @@ public class SignJar extends Task {
* flag to control whether the presence of a signature * flag to control whether the presence of a signature
* file means a JAR is signed; * file means a JAR is signed;
* optional, default false * optional, default false
* @param lazy flag to control whether the presence of a signature
*/ */
public void setLazy(final boolean lazy) { public void setLazy(final boolean lazy) {
this.lazy = lazy; this.lazy = lazy;
@@ -185,6 +194,7 @@ public class SignJar extends Task {
/** /**
* Adds a set of files to sign * Adds a set of files to sign
* @since Ant 1.4 * @since Ant 1.4
* @param set a set of files to sign
*/ */
public void addFileset(final FileSet set) { public void addFileset(final FileSet set) {
filesets.addElement(set); filesets.addElement(set);
@@ -193,6 +203,7 @@ public class SignJar extends Task {


/** /**
* sign the jar(s) * sign the jar(s)
* @throws BuildException on errors
*/ */
public void execute() throws BuildException { public void execute() throws BuildException {
if (null == jar && filesets.size() == 0) { if (null == jar && filesets.size() == 0) {
@@ -315,6 +326,15 @@ public class SignJar extends Task {
} }
} }


/**
* Compare a jar file with its corresponding signed jar
*
* @param jarFile the unsigned jar file
* @param signedjarFile the result signed jar file
* @return true if the signedjarfile is newer than the jar file
* false if the signedjarfile is the same as the jarfile or if
* jarfile or the signedjar does not exist.
*/
protected boolean isUpToDate(File jarFile, File signedjarFile) { protected boolean isUpToDate(File jarFile, File signedjarFile) {
if (null == jarFile) { if (null == jarFile) {
return false; return false;
@@ -346,7 +366,7 @@ public class SignJar extends Task {
/** /**
* 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 * directory
* @param file
* @param file the file to be checked
* @return true if the file is signed * @return true if the file is signed
*/ */
protected boolean isSigned(File file) { protected boolean isSigned(File file) {
@@ -366,4 +386,3 @@ public class SignJar extends Task {
this.preserveLastModified = preserveLastModified; this.preserveLastModified = preserveLastModified;
} }
} }


Loading…
Cancel
Save