ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KC Baltz <KBa...@responsenetworks.com>
Subject [PATCH] SignJar (was RE: Ant 1.2 <SignJar> uses Deprecated metho ds?)
Date Wed, 25 Oct 2000 22:28:12 GMT
I realized this should have had [PATCH] as the subject.

> -----Original Message-----
> From: KC Baltz 
> Sent: Wednesday, October 25, 2000 1:58 PM
> To: 'ant-dev@jakarta.apache.org'
> Subject: RE: Ant 1.2 <SignJar> uses Deprecated methods?
> 
> 
> Well, I decided it was better to just submit the patch for 
> review.  Things
> reviewers should consider:
> 
> 1) Should I be quoting arguments manually or does ExecTask 
> handle this?
> 2) Is setValue the best way to do all of these without 
> rewriting the syntax
> of the signjar command, or should it be setFile/Path/...
> 
> K.C. Baltz
> 
> BTW, this is my first patch submission, so hopefully the 
> format is correct.
> 
> 
> --------------------%<----------------------------------
> Index: SignJar.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Sig
> nJar.java,v
> retrieving revision 1.3
> diff -u -r1.3 SignJar.java
> --- SignJar.java        2000/08/10 06:51:51     1.3
> +++ SignJar.java        2000/10/25 17:54:26
> @@ -150,67 +150,58 @@
> 
>          final StringBuffer sb = new StringBuffer();
> 
> -        sb.append("jarsigner ");
> -
> +        final ExecTask cmd = (ExecTask) project.createTask("exec");
> +        cmd.setExecutable("jarsigner");
> +        Commandline.Argument arg;
> +
>          if (null != keystore) {
> -            sb.append("-keystore \"");
> -            sb.append(keystore);
> -            sb.append("\" ");
> +            cmd.createArg().setValue("-keystore");
> +            cmd.createArg().setValue(keystore);
>          }
> 
>          if (null != storepass) {
> -            sb.append("-storepass \"");
> -            sb.append(storepass);
> -            sb.append("\" ");
> +            cmd.createArg().setValue("-storepass");
> +            cmd.createArg().setValue(storepass);
>          }
> 
>          if (null != storetype) {
> -            sb.append("-storetype \"");
> -            sb.append(storetype);
> -            sb.append("\" ");
> +            cmd.createArg().setValue("-storetype");
> +            cmd.createArg().setValue(storetype);
>          }
> 
>          if (null != keypass) {
> -            sb.append("-keypass \"");
> -            sb.append(keypass);
> -            sb.append("\" ");
> +            cmd.createArg().setValue("-keypass");
> +            cmd.createArg().setValue(keypass);
>          }
> 
>          if (null != sigfile) {
> -            sb.append("-sigfile \"");
> -            sb.append(sigfile);
> -            sb.append("\" ");
> +            cmd.createArg().setValue("-sigfile");
> +            cmd.createArg().setValue(sigfile);
>          }
> 
>          if (null != signedjar) {
> -            sb.append("-signedjar \"");
> -            sb.append(signedjar);
> -            sb.append("\" ");
> +            cmd.createArg().setValue("-signedjar");
> +            cmd.createArg().setValue(signedjar);
>          }
> 
>          if (verbose) {
> -            sb.append("-verbose ");
> +            cmd.createArg().setValue("-verbose");
>          }
> 
>          if (internalsf) {
> -            sb.append("-internalsf ");
> +            cmd.createArg().setValue("-internalsf");
>          }
> 
>          if (sectionsonly) {
> -            sb.append("-sectionsonly ");
> +            cmd.createArg().setValue("-sectionsonly");
>          }
> 
> -        sb.append('\"');
> -        sb.append(jar);
> -        sb.append("\" ");
> +        cmd.createArg().setValue(jar);
> 
> -        sb.append('\"');
> -        sb.append(alias);
> -        sb.append("\" ");
> 
> +        cmd.createArg().setValue(alias);
> +
>          log("Signing Jar : " + (new File(jar)).getAbsolutePath());
> -        final ExecTask cmd = (ExecTask) project.createTask("exec");
> -        cmd.setCommand(new Commandline(sb.toString()));
>          cmd.setFailonerror(true);
>          cmd.setTaskName( getTaskName() );
>          cmd.execute();
> 
> 
> 

Mime
View raw message