Browse Source

Move some validation into execute();

remove unnecessary guards against storepass == null.


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

+ 9
- 18
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -214,6 +214,13 @@ public class SignJar extends Task {
throw new BuildException("jar must be set through jar attribute "
+ "or nested filesets");
}
if (null == alias) {
throw new BuildException("alias attribute must be set");
}

if (null == storepass) {
throw new BuildException("storepass attribute must be set");
}
redirector = createRedirector();
if (null != jar) {
if (filesets.size() != 0) {
@@ -241,14 +248,8 @@ public class SignJar extends Task {
* @return a configured RedirectorElement.
*/
private RedirectorElement createRedirector() {
if (storepass == null && keypass == null) {
return null;
}
RedirectorElement result = new RedirectorElement();
StringBuffer input = new StringBuffer();
if (storepass != null) {
input.append(storepass).append('\n');
}
StringBuffer input = new StringBuffer(storepass).append('\n');
if (keypass != null) {
input.append(keypass).append('\n');
}
@@ -263,14 +264,6 @@ public class SignJar extends Task {
private void doOneJar(File jarSource, File jarTarget)
throws BuildException {

if (null == alias) {
throw new BuildException("alias attribute must be set");
}

if (null == storepass) {
throw new BuildException("storepass attribute must be set");
}

if (isUpToDate(jarSource, jarTarget)) {
return;
}
@@ -329,9 +322,7 @@ public class SignJar extends Task {
log("Signing JAR: " + jarSource.getAbsolutePath());
cmd.setFailonerror(true);
cmd.setTaskName(getTaskName());
if (redirector != null) {
cmd.addConfiguredRedirector(redirector);
}
cmd.addConfiguredRedirector(redirector);
cmd.execute();

// restore the lastModified attribute


Loading…
Cancel
Save