mbenson     2005/02/10 14:48:46

  Modified:    src/main/org/apache/tools/ant/taskdefs SignJar.java
  Log:
  Move some validation into execute();
  remove unnecessary guards against storepass == null.
  
  Revision  Changes    Path
  1.45      +9 -18     ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java
  
  Index: SignJar.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- SignJar.java      10 Feb 2005 22:43:27 -0000      1.44
  +++ SignJar.java      10 Feb 2005 22:48:46 -0000      1.45
  @@ -214,6 +214,13 @@
               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 @@
        * @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 @@
       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 @@
           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
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to