>From 97df49759d43a9815a79022a1d135b3463e38990 Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Mon, 10 Feb 2014 15:35:21 -0500
Subject: [PATCH 193/194] Fix eclipse warnings.

---
 .../com/netscape/certsrv/base/PKIException.java    |  5 ---
 .../src/com/netscape/cmstools/CRMFPopClient.java   | 37 +---------------------
 .../cmstools/client/ClientCertImportCLI.java       |  2 --
 .../cms/profile/def/RandomizedValidityDefault.java |  9 +++---
 .../cms/profile/input/SubjectAltNameExtInput.java  | 22 ++++++++-----
 .../com/netscape/cms/servlet/cert/DoRevoke.java    |  7 ----
 .../netscape/cms/servlet/csadmin/GetCookie.java    |  5 ---
 7 files changed, 19 insertions(+), 68 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/base/PKIException.java b/base/common/src/com/netscape/certsrv/base/PKIException.java
index 74e13c747d7c9202cada36bbe4773bcd4c16d857..ad55d139e1353cb2c7cdb3d8412ebe75ad009ae6 100644
--- a/base/common/src/com/netscape/certsrv/base/PKIException.java
+++ b/base/common/src/com/netscape/certsrv/base/PKIException.java
@@ -17,11 +17,6 @@
 // --- END COPYRIGHT BLOCK ---
 package com.netscape.certsrv.base;
 
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
diff --git a/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java b/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java
index ec152f775e7065aa12b6f1877f497f60b1e9d660..7edac0af6a99ed077ffc715c570441d9e6bad8de 100644
--- a/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java
+++ b/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java
@@ -31,7 +31,6 @@ import java.net.URLEncoder;
 import java.security.KeyPair;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.Date;
 
 import netscape.security.x509.X500Name;
 
@@ -114,33 +113,6 @@ public class CRMFPopClient {
         System.out.println("            in base64 encoded format with the header and footer removed.\n");
     }
 
-    private static int getRealArgsLength(String args[]) {
-
-        int len = args.length;
-
-        String curArg = "";
-        int finalLen = len;
-
-        for (int i = 0; i < len; i++) {
-
-            curArg = args[i];
-            // System.out.println("arg[" + i + "]  " + curArg);
-
-            if (curArg == null || curArg.equalsIgnoreCase("")) {
-                finalLen--;
-            }
-
-        }
-
-        //System.out.println("getRealArgsLength: returning " + finalLen);
-
-        if (finalLen < 0)
-            finalLen = 0;
-
-        return finalLen;
-
-    }
-
     public static void main(String args[]) {
 
 //        int argsLen =  getRealArgsLength(args);
@@ -278,8 +250,6 @@ public class CRMFPopClient {
         URLConnection conn = null;
         InputStream is = null;
         BufferedReader reader = null;
-        boolean success = false;
-        long total_time = 0;
         KeyPair pair = null;
 
         boolean foundTransport = false;
@@ -500,7 +470,7 @@ public class CRMFPopClient {
                 certReq.encode(bo);
                 byte[] toBeVerified = bo.toByteArray();
 
-                byte popdata[] = ASN1Util.encode(certReq);
+                // byte popdata[] = ASN1Util.encode(certReq);
                 byte signature[];
 
                 System.out.println(".CertRequest encoded");
@@ -604,7 +574,6 @@ public class CRMFPopClient {
                     System.out.println("--------------------");
                     System.out.println("");
 
-                    long start_time = (new Date()).getTime();
                     conn = url.openConnection();
                     is = conn.getInputStream();
                     reader = new BufferedReader(new InputStreamReader(is));
@@ -613,14 +582,10 @@ public class CRMFPopClient {
                     while ((line = reader.readLine()) != null) {
                         System.out.println(line);
                         if (line.equals("CMS Enroll Request Success")) {
-                            success = true;
                             System.out.println("CRMFPopClient: Enrollment Successful: ......");
                             System.out.println("");
                         }
                     } /* while */
-
-                    long end_time = (new Date()).getTime();
-                    total_time += (end_time - start_time);
                 } catch (Exception e) {
                     System.out.println("CRMFPopClient: WARNING: " + e.toString());
                     e.printStackTrace();
diff --git a/base/java-tools/src/com/netscape/cmstools/client/ClientCertImportCLI.java b/base/java-tools/src/com/netscape/cmstools/client/ClientCertImportCLI.java
index 0376b7f90d197dc6962570d0b12c87628672fc04..8494c93027cc560a29dc8a9c7e189534630d97d7 100644
--- a/base/java-tools/src/com/netscape/cmstools/client/ClientCertImportCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/client/ClientCertImportCLI.java
@@ -24,7 +24,6 @@ import java.io.FileOutputStream;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.io.FileUtils;
-import org.mozilla.jss.crypto.X509Certificate;
 
 import com.netscape.certsrv.client.ClientConfig;
 import com.netscape.cmstools.cli.CLI;
@@ -72,7 +71,6 @@ public class ClientCertImportCLI extends CLI {
         client = parent.getClient();
 
         byte[] bytes = null;
-        X509Certificate cert = null;
 
         String certPath = cmd.getOptionValue("cert");
         String caCertPath = cmd.getOptionValue("ca-cert");
diff --git a/base/server/cms/src/com/netscape/cms/profile/def/RandomizedValidityDefault.java b/base/server/cms/src/com/netscape/cms/profile/def/RandomizedValidityDefault.java
index b3b16448d657d7723142dbaeee295aeb1c414293..6308715b068738e210ed72369ea2ec0c0ac61305 100644
--- a/base/server/cms/src/com/netscape/cms/profile/def/RandomizedValidityDefault.java
+++ b/base/server/cms/src/com/netscape/cms/profile/def/RandomizedValidityDefault.java
@@ -122,13 +122,13 @@ public class RandomizedValidityDefault extends EnrollDefault {
                             "CMS_PROFILE_VALIDITY_START_TIME"));
         } else if (name.equals(CONFIG_NOT_BEFORE_RANDOM_BITS)) {
             return new Descriptor(IDescriptor.STRING,
-                    null, 
+                    null,
                     "10", /* 10 bits */
                     CMS.getUserMessage(locale,
                             "CMS_PROFILE_NOT_BEFORE_RANDOM_BITS"));
         } else if (name.equals(CONFIG_NOT_AFTER_RANDOM_BITS)) {
             return new Descriptor(IDescriptor.STRING,
-                    null, 
+                    null,
                     "10", /* 10 bits */
                     CMS.getUserMessage(locale,
                             "CMS_PROFILE_NOT_AFTER_RANDOM_BITS"));
@@ -261,12 +261,11 @@ public class RandomizedValidityDefault extends EnrollDefault {
         if (numBits > 0) {
             maxSecs = (1 << numBits) - 1;
             int numBytes = (numBits+7)/8;
-            int byteSecs = (1 << (numBytes * 8)) - 1;
             byte[] randomBits = new byte[numBytes];
             mRandom.nextBytes(randomBits);
             for (int i = 0; i < numBytes; i++) {
                 secs <<= 8;
-                secs |= (int)(randomBits[i]) & 0xFF;
+                secs |= (randomBits[i]) & 0xFF;
             }
             secs &= maxSecs;
         }
@@ -339,7 +338,7 @@ public class RandomizedValidityDefault extends EnrollDefault {
         CMS.debug("RandomizedValidityDefault populate  notAfterRandomized  = "+notAfterRandomized);
         Date notAfterMax = new Date(notAfterValueMax);
         CMS.debug("RandomizedValidityDefault populate  notAfterMax         = "+notAfterMax);
-        CertificateValidity validity = 
+        CertificateValidity validity =
                 new CertificateValidity(notBeforeRandomized, notAfterRandomized);
 
         try {
diff --git a/base/server/cms/src/com/netscape/cms/profile/input/SubjectAltNameExtInput.java b/base/server/cms/src/com/netscape/cms/profile/input/SubjectAltNameExtInput.java
index 72dc55b6cef2670dfce054c7fbcde99aeb531171..d03ad0690f4f2ac0abec43f128f5cbcd198c45c8 100644
--- a/base/server/cms/src/com/netscape/cms/profile/input/SubjectAltNameExtInput.java
+++ b/base/server/cms/src/com/netscape/cms/profile/input/SubjectAltNameExtInput.java
@@ -17,14 +17,20 @@
 // --- END COPYRIGHT BLOCK ---
 package com.netscape.cms.profile.input;
 
-import java.util.*;
-import com.netscape.certsrv.base.*;
-import com.netscape.certsrv.profile.*;
-import com.netscape.certsrv.request.*;
-import com.netscape.certsrv.property.*;
-import com.netscape.certsrv.apps.*;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Vector;
 
-import com.netscape.cms.profile.common.*;
+import com.netscape.certsrv.apps.CMS;
+import com.netscape.certsrv.base.EBaseException;
+import com.netscape.certsrv.base.IConfigStore;
+import com.netscape.certsrv.profile.EProfileException;
+import com.netscape.certsrv.profile.IProfile;
+import com.netscape.certsrv.profile.IProfileContext;
+import com.netscape.certsrv.profile.IProfileInput;
+import com.netscape.certsrv.property.Descriptor;
+import com.netscape.certsrv.property.IDescriptor;
+import com.netscape.certsrv.request.IRequest;
 
 
 /**
@@ -37,7 +43,7 @@ import com.netscape.cms.profile.common.*;
  * <p>
  *
  */
-public class SubjectAltNameExtInput extends EnrollInput implements IProfileInput { 
+public class SubjectAltNameExtInput extends EnrollInput implements IProfileInput {
 
     public static final int DEF_REQ_ENTRIES = 4;
 
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/DoRevoke.java b/base/server/cms/src/com/netscape/cms/servlet/cert/DoRevoke.java
index 64a9856fc63f90caceb9134e26617cc6128487dc..8a7bc556e27359c54de55dcbf0e6659f2c1918ef 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/DoRevoke.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/DoRevoke.java
@@ -65,8 +65,6 @@ import com.netscape.certsrv.ra.IRegistrationAuthority;
 import com.netscape.certsrv.request.IRequest;
 import com.netscape.certsrv.request.RequestId;
 import com.netscape.certsrv.request.RequestStatus;
-import com.netscape.certsrv.usrgrp.ICertUserLocator;
-import com.netscape.certsrv.usrgrp.IUGSubsystem;
 import com.netscape.cms.servlet.base.CMSServlet;
 import com.netscape.cms.servlet.common.CMSRequest;
 import com.netscape.cms.servlet.common.CMSTemplate;
@@ -90,8 +88,6 @@ public class DoRevoke extends CMSServlet {
     private String mFormPath = null;
     private IPublisherProcessor mPublisherProcessor = null;
     private int mTimeLimits = 30; /* in seconds */
-    private IUGSubsystem mUG = null;
-    private ICertUserLocator mUL = null;
 
     public DoRevoke() {
         super();
@@ -107,9 +103,6 @@ public class DoRevoke extends CMSServlet {
         super.init(sc);
         mFormPath = "/" + mAuthority.getId() + "/" + TPL_FILE;
 
-        mUG = (IUGSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_UG);
-        mUL = mUG.getCertUserLocator();
-
         if (mAuthority instanceof ICertificateAuthority) {
             mCertDB = ((ICertificateAuthority) mAuthority).getCertificateRepository();
         }
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetCookie.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetCookie.java
index 1e8c6518209f381a51c7f8e479636b7c8f6e3393..b8030f01a3983bfc48e1fed1ee24ecd76197ca69 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetCookie.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetCookie.java
@@ -52,11 +52,6 @@ public class GetCookie extends CMSServlet {
     private String mErrorFormPath = null;
     private String mFormPath = null;
 
-    private final static String LOGGING_SIGNED_AUDIT_SECURITY_DOMAIN_UPDATE =
-            "LOGGING_SIGNED_AUDIT_SECURITY_DOMAIN_UPDATE_1";
-    private final static String LOGGING_SIGNED_AUDIT_ROLE_ASSUME =
-            "LOGGING_SIGNED_AUDIT_ROLE_ASSUME_3";
-
     public GetCookie() {
         super();
     }
-- 
1.8.4.2

