@@ -214,6 +214,13 @@ public class SignJar extends Task {
throw new BuildException("jar must be set through jar attribute "
throw new BuildException("jar must be set through jar attribute "
+ "or nested filesets");
+ "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();
redirector = createRedirector();
if (null != jar) {
if (null != jar) {
if (filesets.size() != 0) {
if (filesets.size() != 0) {
@@ -241,14 +248,8 @@ public class SignJar extends Task {
* @return a configured RedirectorElement.
* @return a configured RedirectorElement.
*/
*/
private RedirectorElement createRedirector() {
private RedirectorElement createRedirector() {
if (storepass == null && keypass == null) {
return null;
}
RedirectorElement result = new RedirectorElement();
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) {
if (keypass != null) {
input.append(keypass).append('\n');
input.append(keypass).append('\n');
}
}
@@ -263,14 +264,6 @@ public class SignJar extends Task {
private void doOneJar(File jarSource, File jarTarget)
private void doOneJar(File jarSource, File jarTarget)
throws BuildException {
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)) {
if (isUpToDate(jarSource, jarTarget)) {
return;
return;
}
}
@@ -329,9 +322,7 @@ public class SignJar extends Task {
log("Signing JAR: " + jarSource.getAbsolutePath());
log("Signing JAR: " + jarSource.getAbsolutePath());
cmd.setFailonerror(true);
cmd.setFailonerror(true);
cmd.setTaskName(getTaskName());
cmd.setTaskName(getTaskName());
if (redirector != null) {
cmd.addConfiguredRedirector(redirector);
}
cmd.addConfiguredRedirector(redirector);
cmd.execute();
cmd.execute();
// restore the lastModified attribute
// restore the lastModified attribute