[icedtea-web] RFC: Remove unused variables in JarSigner

Deepak Bhole dbhole at redhat.com
Wed Dec 8 09:52:29 PST 2010


* Omair Majid <omajid at redhat.com> [2010-12-08 12:46]:
> Hi,
> 
> The attached patch removes unused imports and variables from
> JarSigner. It also removes a few unnecessary casts.
> 
> ChangeLog
> 2010-12-08  Omair Majid  <omajid at redhat.com>
> 
>     * netx/net/sourceforge/jnlp/tools/JarSigner.java: Remove unused
>     imports and variables.
>     (getRoot): Remove unnecessary cast.
>     (getPublisher): Likewise.
> 
> Any concerns?
> 
> Cheers,
> Omair

Assuming it's been tested, okay for commit.

Deepak

> diff -r 78afe7c627ae netx/net/sourceforge/jnlp/tools/JarSigner.java
> --- a/netx/net/sourceforge/jnlp/tools/JarSigner.java	Wed Dec 08 12:09:00 2010 -0500
> +++ b/netx/net/sourceforge/jnlp/tools/JarSigner.java	Wed Dec 08 12:23:53 2010 -0500
> @@ -29,10 +29,7 @@
>  
>  import java.io.*;
>  import java.util.*;
> -import java.util.zip.*;
>  import java.util.jar.*;
> -import java.text.Collator;
> -import java.text.MessageFormat;
>  import java.security.cert.Certificate;
>  import java.security.cert.X509Certificate;
>  import java.security.cert.CertPath;
> @@ -53,12 +50,6 @@
>  
>  public class JarSigner implements CertVerifier {
>  
> -    private static final Collator collator = Collator.getInstance();
> -    static {
> -        // this is for case insensitive string comparisions
> -        collator.setStrength(Collator.PRIMARY);
> -    }
> -
>      private static final String META_INF = "META-INF/";
>  
>      // prefix for new signature-related files in META-INF directory
> @@ -66,11 +57,6 @@
>  
>      private static final long SIX_MONTHS = 180 * 24 * 60 * 60 * 1000L; //milliseconds
>  
> -    static final String VERSION = "1.0";
> -
> -    static final int IN_KEYSTORE = 0x01;
> -    static final int IN_SCOPE = 0x02;
> -
>      static enum verifyResult {
>          UNSIGNED, SIGNED_OK, SIGNED_NOT_OK
>      }
> @@ -78,36 +64,8 @@
>      // signer's certificate chain (when composing)
>      X509Certificate[] certChain;
>  
> -    /*
> -     * private key
> -     */
> -    PrivateKey privateKey;
> -    KeyStore store;
> -
> -    String keystore; // key store file
> -    boolean nullStream = false; // null keystore input stream (NONE)
> -    boolean token = false; // token-based keystore
> -    String jarfile; // jar file to sign
> -    String alias; // alias to sign jar with
> -    char[] storepass; // keystore password
> -    boolean protectedPath; // protected authentication path
> -    String storetype; // keystore type
> -    String providerName; // provider name
> -    Vector<String> providers = null; // list of providers
> -    HashMap<String, String> providerArgs = new HashMap<String, String>(); // arguments for provider constructors
> -    char[] keypass; // private key password
> -    String sigfile; // name of .SF file
> -    String sigalg; // name of signature algorithm
> -    String digestalg = "SHA1"; // name of digest algorithm
> -    String signedjar; // output filename
> -    String tsaUrl; // location of the Timestamping Authority
> -    String tsaAlias; // alias for the Timestamping Authority's certificate
> -    boolean verify = false; // verify the jar
>      boolean verbose = false; // verbose output when signing/verifying
>      boolean showcerts = false; // show certs when verifying
> -    boolean debug = false; // debug
> -    boolean signManifest = true; // "sign" the whole manifest
> -    boolean externalSF = true; // leave the .SF out of the PKCS7 block
>  
>      private boolean hasExpiredCert = false;
>      private boolean hasExpiringCert = false;
> @@ -397,7 +355,7 @@
>          if (certPath != null) {
>              List<? extends Certificate> certList = certPath.getCertificates();
>              if (certList.size() > 0) {
> -                return (Certificate) certList.get(0);
> +                return certList.get(0);
>              } else {
>                  return null;
>              }
> @@ -413,8 +371,7 @@
>          if (certPath != null) {
>              List<? extends Certificate> certList = certPath.getCertificates();
>              if (certList.size() > 0) {
> -                return (Certificate) certList.get(
> -                                certList.size() - 1);
> +                return certList.get(certList.size() - 1);
>              } else {
>                  return null;
>              }




More information about the distro-pkg-dev mailing list