>From f9f376d3d549fc2a49037fdc73cfe289e8ef8e0e Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Fri, 23 Mar 2012 16:19:59 -0400
Subject: [PATCH] Added policy deprecations

Many of the policy deprecation warnings come from classes that probably ought to
be deprecated as part of the deprecated policy framework as well.  Making these
as deprecated removes the deprecation warnings - and we can really see where
we make sure of deprecated policy code elsewhere.

Also removed some URLEncoder, Decoder deprecations
---
 pki/base/ca/src/com/netscape/ca/CAPolicy.java      |    1 +
 .../src/com/netscape/ca/CertificateAuthority.java  |    3 +
 .../netscape/certsrv/ca/ICertificateAuthority.java |    2 +-
 .../certsrv/kra/IKeyRecoveryAuthority.java         |    2 +-
 .../certsrv/ra/IRegistrationAuthority.java         |    2 +-
 .../cms/publish/publishers/OCSPPublisher.java      |    6 +-
 .../netscape/cms/servlet/admin/AdminServlet.java   |    4 +-
 .../cms/servlet/admin/PolicyAdminServlet.java      |    1 +
 .../netscape/cms/servlet/csadmin/DonePanel.java    |    2 +-
 .../com/netscape/cms/servlet/ocsp/OCSPServlet.java |    8 +++-
 .../com/netscape/cmscore/policy/AndExpression.java |    1 +
 .../netscape/cmscore/policy/GeneralNameUtil.java   |    1 +
 .../cmscore/policy/GenericPolicyProcessor.java     |    4 ++
 .../cmscore/policy/JavaScriptRequestProxy.java     |    5 ++
 .../com/netscape/cmscore/policy/OrExpression.java  |    1 +
 .../cmscore/policy/PolicyPredicateParser.java      |    1 +
 .../src/com/netscape/cmscore/policy/PolicySet.java |    1 +
 .../netscape/cmscore/policy/SimpleExpression.java  |    1 +
 .../src/com/netscape/cmstools/CRMFPopClient.java   |    2 +-
 pki/base/kra/src/com/netscape/kra/KRAPolicy.java   |    1 +
 .../src/com/netscape/kra/KeyRecoveryAuthority.java |    3 +
 .../src/com/netscape/pkisilent/common/Request.java |   47 ++++++++++++-------
 .../com/netscape/pkisilent/common/UserEnroll.java  |   17 ++++---
 .../com/netscape/pkisilent/http/HTTPClient.java    |    5 +-
 24 files changed, 83 insertions(+), 38 deletions(-)

diff --git a/pki/base/ca/src/com/netscape/ca/CAPolicy.java b/pki/base/ca/src/com/netscape/ca/CAPolicy.java
index d18774d9533eff5f3c7a05d936be456de0568523..4df28d344d4fe7211fc9060e29f38dfd3279a7ab 100644
--- a/pki/base/ca/src/com/netscape/ca/CAPolicy.java
+++ b/pki/base/ca/src/com/netscape/ca/CAPolicy.java
@@ -39,6 +39,7 @@ import com.netscape.cmscore.util.Debug;
  * XXX2 moved to just implement IPolicy since GenericPolicyProcessor is
  * unuseable for CA.
  * 
+ * @deprecated
  * @version $Revision$, $Date$
  */
 public class CAPolicy implements IPolicy {
diff --git a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
index 007ebf207f75ac8c0e63e605e8fab3378382d509..c8783f566f44d06716bc07de4a81649e6088ad82 100644
--- a/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
+++ b/pki/base/ca/src/com/netscape/ca/CertificateAuthority.java
@@ -268,6 +268,9 @@ public class CertificateAuthority implements ICertificateAuthority, ICertAuthori
         return mCRLPublisher;
     }
 
+    /**
+     * @deprecated
+     */
     public IPolicyProcessor getPolicyProcessor() {
         return mPolicy.getPolicyProcessor();
     }
diff --git a/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java b/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java
index a49653c1285531f66edeb14efe5b28f7d2fb0118..25bc9cabe066a7537bcec742c6a2ecdc646c592d 100644
--- a/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java
+++ b/pki/base/common/src/com/netscape/certsrv/ca/ICertificateAuthority.java
@@ -125,7 +125,7 @@ public interface ICertificateAuthority extends ISubsystem {
 
     /**
      * Retrieves the policy processor of this certificate authority.
-     * 
+     * @deprecated
      * @return CA's policy processor
      */
     public IPolicyProcessor getPolicyProcessor();
diff --git a/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java b/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java
index 0171115eec61e6b77373aea1ba720f3373194a2c..a7cc40507ae6e5207f1531f6a8fc5cbff9e050e0 100644
--- a/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java
+++ b/pki/base/common/src/com/netscape/certsrv/kra/IKeyRecoveryAuthority.java
@@ -206,7 +206,7 @@ public interface IKeyRecoveryAuthority extends ISubsystem {
     /**
      * Returns policy processor of the key recovery
      * authority.
-     * 
+     * @deprecated
      * @return policy processor
      */
     public IPolicyProcessor getPolicyProcessor();
diff --git a/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java b/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java
index 193a6d9bdf6d6db754c4ac5db3d977ebc90ed16a..8302e2d2360623a12bb94430e549518334fedffb 100644
--- a/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java
+++ b/pki/base/common/src/com/netscape/certsrv/ra/IRegistrationAuthority.java
@@ -69,7 +69,7 @@ public interface IRegistrationAuthority extends ISubsystem {
 
     /**
      * Retrieves the policy processor of this registration authority.
-     * 
+     * @deprecated
      * @return RA's policy processor
      */
     public IPolicyProcessor getPolicyProcessor();
diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java b/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java
index 80abd5f771ee56639188a744b4f332d2c0f1345d..600bbd11015dd155e494a6fc35a8f7aa5f8e6a59 100644
--- a/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java
+++ b/pki/base/common/src/com/netscape/cms/publish/publishers/OCSPPublisher.java
@@ -237,9 +237,9 @@ public class OCSPPublisher implements ILdapPublisher, IExtendedPluginInfo {
 
             StringBuffer query = new StringBuffer();
             query.append("crl=");
-            query.append(URLEncoder.encode("-----BEGIN CERTIFICATE REVOCATION LIST-----\n"));
-            query.append(URLEncoder.encode(CMS.BtoA(crl.getEncoded())));
-            query.append(URLEncoder.encode("\n-----END CERTIFICATE REVOCATION LIST-----"));
+            query.append(URLEncoder.encode("-----BEGIN CERTIFICATE REVOCATION LIST-----\n", "UTF-8"));
+            query.append(URLEncoder.encode(CMS.BtoA(crl.getEncoded()), "UTF-8"));
+            query.append(URLEncoder.encode("\n-----END CERTIFICATE REVOCATION LIST-----", "UTF-8"));
             query.append("&noui=true");
 
             Socket socket = null;
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java
index dbcba085d9e6564e0ad1e88a389410a8216fb87e..ce4c966ad866579e8b1d2310c7011e62852e4f9a 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/admin/AdminServlet.java
@@ -798,9 +798,9 @@ public class AdminServlet extends HttpServlet {
                 for (Iterator<String> i = names.iterator(); i.hasNext(); ) {
                     String name = i.next();
                     String value = java.net.URLEncoder.encode(
-                            params.get(name));
+                            params.get(name), "UTF-8");
 
-                    buf.append(java.net.URLEncoder.encode(name) +
+                    buf.append(java.net.URLEncoder.encode(name, "UTF-8") +
                             "=" + value);
                     if (i.hasNext())
                         buf.append("&");
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java
index f656cbd440ff741a729fc976ecc6df11f0458e7f..0bcb962ead74cd7516d01e7d385b84a9d42a3a46 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/admin/PolicyAdminServlet.java
@@ -50,6 +50,7 @@ import com.netscape.certsrv.ra.IRegistrationAuthority;
  * for registering an instance of this with the remote
  * administration subsystem.
  * 
+ * @deprecated
  * @version $Revision$, $Date$
  */
 public class PolicyAdminServlet extends AdminServlet {
diff --git a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java
index 663435cba41b1c395c95c37eb11deabdae951b57..6d0e92618ad970f5964d835e3d3162168ff0ee51 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/csadmin/DonePanel.java
@@ -849,7 +849,7 @@ public class DonePanel extends WizardPanelBase {
                             + "&ca.connector.KRA.port="
                             + ownagentsport
                             + "&ca.connector.KRA.transportCert="
-                            + URLEncoder.encode(transportCert)
+                            + URLEncoder.encode(transportCert, "UTF-8")
                             + "&sessionID="
                             + session_id;
 
diff --git a/pki/base/common/src/com/netscape/cms/servlet/ocsp/OCSPServlet.java b/pki/base/common/src/com/netscape/cms/servlet/ocsp/OCSPServlet.java
index 3d5e93a56b21deb258e1e6170022f104d0e928df..3ab20141c48e2cdf61a3c63132d15a5ac04adaf1 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/ocsp/OCSPServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/ocsp/OCSPServlet.java
@@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 
 import javax.servlet.ServletConfig;
@@ -124,7 +125,12 @@ public class OCSPServlet extends CMSServlet {
         CMS.debug("RequestURI=" + httpReq.getRequestURI());
         String pathInfo = httpReq.getPathInfo();
         if (pathInfo != null && pathInfo.indexOf('%') != -1) {
-            pathInfo = URLDecoder.decode(pathInfo);
+            try {
+                pathInfo = URLDecoder.decode(pathInfo, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+                throw new EBaseException("OCSPServlet: Unsupported encoding" + e);
+            }
         }
         CMS.debug("PathInfo=" + pathInfo);
 
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/AndExpression.java b/pki/base/common/src/com/netscape/cmscore/policy/AndExpression.java
index 7e704dfbf5ac97c9597390beededcbe8dd4a0f71..459660f1efdc0644999e9266fb0b792af6d30b63 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/AndExpression.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/AndExpression.java
@@ -27,6 +27,7 @@ import com.netscape.certsrv.request.IRequest;
  * 
  * Expressions are used as predicates for policy selection.
  * 
+ * @deprecated
  * @author kanda
  * @version $Revision$, $Date$
  */
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java b/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java
index 6afaea9971b164693d96940813464cf0654aa728..7c7162d0c227ca3114d1c0d32ee4f8c6a011dea8 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/GeneralNameUtil.java
@@ -53,6 +53,7 @@ import com.netscape.cmsutil.util.Utils;
 /**
  * Class that can be used to form general names from configuration file.
  * Used by policies and extension commands.
+ * @deprecated
  */
 public class GeneralNameUtil implements IGeneralNameUtil {
 
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java b/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java
index c9cc25997d1019495e0aa8f224825bf0e6e3d159..05f8e111a3a32d0c9d723ded30440b86e64c1c25 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java
@@ -60,6 +60,7 @@ import com.netscape.cmscore.util.Debug;
  * the processor itself presents itself as one big policy to the
  * request processor.
  * 
+ * @deprecated
  * @author kanda
  * @version $Revision$, $Date$
  */
@@ -1494,6 +1495,9 @@ class RegisteredPolicy {
     }
 }
 
+/**
+ * @deprecated
+ */
 class PolicyInstance {
     String mInstanceId;
     String mImplId;
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/JavaScriptRequestProxy.java b/pki/base/common/src/com/netscape/cmscore/policy/JavaScriptRequestProxy.java
index e9a7371d96145c7082582e0f17a6fed1f7dc528c..1fbcf27385f5d9438e974d11726346d3d4cb4370 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/JavaScriptRequestProxy.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/JavaScriptRequestProxy.java
@@ -21,6 +21,11 @@ import com.netscape.certsrv.policy.IPolicyRule;
 import com.netscape.certsrv.request.IRequest;
 import com.netscape.certsrv.request.PolicyResult;
 
+/**
+ *
+ * @deprecated
+ *
+ */
 public class JavaScriptRequestProxy {
     IRequest req;
 
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/OrExpression.java b/pki/base/common/src/com/netscape/cmscore/policy/OrExpression.java
index ec461fb9af46e1c4afb75d4619ae2d626165ed89..3b220c1009eecf87db14e26a90da2dd7146e95c0 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/OrExpression.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/OrExpression.java
@@ -27,6 +27,7 @@ import com.netscape.certsrv.request.IRequest;
  * 
  * Expressions are used as predicates for policy selection.
  * 
+ * @deprecated
  * @author kanda
  * @version $Revision$, $Date$
  */
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java b/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java
index 6c73bcb967646a46f9cbb0f0502b41595cdc6910..568a38e6d8df4800a0203ff015ee238f6859cb13 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java
@@ -36,6 +36,7 @@ import com.netscape.cmscore.util.Debug;
  * is treated as (a AND b) OR e OR (c AND d)
  * 4. If this is n't adequate, roll your own.
  * 
+ * @deprecated
  * @author kanda
  * @version $Revision$, $Date$
  */
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java b/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java
index bd38138ff0aa22124f99288b8859ee29e425706e..9e7ecdc6483e1eaec89054d118da6eb7e3ae1ace 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/PolicySet.java
@@ -33,6 +33,7 @@ import com.netscape.cmscore.util.Debug;
  * Implements a policy set per IPolicySet interface. This class
  * uses a vector of ordered policies to enforce priority.
  * 
+ * @deprecated
  * @author kanda
  * @version $Revision$, $Date$
  */
diff --git a/pki/base/common/src/com/netscape/cmscore/policy/SimpleExpression.java b/pki/base/common/src/com/netscape/cmscore/policy/SimpleExpression.java
index c844414680157e4cc4144578e810ab105db7cd09..892fd6451808f54575c78f47b292efed872428cc 100644
--- a/pki/base/common/src/com/netscape/cmscore/policy/SimpleExpression.java
+++ b/pki/base/common/src/com/netscape/cmscore/policy/SimpleExpression.java
@@ -33,6 +33,7 @@ import com.netscape.cmscore.util.Debug;
  * 
  * Expressions are used as predicates for policy selection.
  * 
+ * @deprecated
  * @author kanda
  * @version $Revision$, $Date$
  */
diff --git a/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java b/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java
index ea427ff7cf899b9896d6b1c59c7893d2c5ee4407..c1d463cdb1ebe1fc8b8973ecaae8446083d8201c 100644
--- a/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java
+++ b/pki/base/java-tools/src/com/netscape/cmstools/CRMFPopClient.java
@@ -485,7 +485,7 @@ public class CRMFPopClient {
                         return;
                 }
 
-                String Req = URLEncoder.encode(Req1);
+                String Req = URLEncoder.encode(Req1, "UTF-8");
 
                 // post PKCS10 
 
diff --git a/pki/base/kra/src/com/netscape/kra/KRAPolicy.java b/pki/base/kra/src/com/netscape/kra/KRAPolicy.java
index f7d2ba134c1f9c4dc903cf370ca9416d1c2d01d3..aa2b2c2de959e88d04f3e5d9d1cc926c07ffbae8 100644
--- a/pki/base/kra/src/com/netscape/kra/KRAPolicy.java
+++ b/pki/base/kra/src/com/netscape/kra/KRAPolicy.java
@@ -32,6 +32,7 @@ import com.netscape.cmscore.util.Debug;
 /**
  * KRA Policy.
  * 
+ * @deprecated
  * @version $Revision$, $Date$
  */
 public class KRAPolicy implements IPolicy {
diff --git a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java
index cf2b2d52aa372fcde6f6d50f104983d0696dbc7a..8d8cafb8486014430feaf8c0887631a0eba359ef 100644
--- a/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java
+++ b/pki/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java
@@ -178,6 +178,9 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove
         mId = id;
     }
 
+    /**
+     * @deprecated
+     */
     public IPolicyProcessor getPolicyProcessor() {
         return mPolicy.getPolicyProcessor();
     }
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java
index 0f0827d67ceeebeb467a4a60a9829d67a3daed16..3dffc929c3fb4f1054693ec09596bda1651229be 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/Request.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/Request.java
@@ -18,6 +18,7 @@ package com.netscape.pkisilent.common;
 // All rights reserved.
 // --- END COPYRIGHT BLOCK ---
 
+import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.Calendar;
 import java.util.Date;
@@ -153,9 +154,10 @@ public class Request extends TestClient {
      * 
      * @param fromrequest number
      * @param endrequestnumber.
+     * @throws UnsupportedEncodingException
      */
 
-    public Vector<String> ListPendingRequests(String fromRequestNumber, String toRequestNumber) {
+    public Vector<String> ListPendingRequests(String fromRequestNumber, String toRequestNumber) throws UnsupportedEncodingException {
         reqState = "showWaiting";
         reqType = "enrollment";
         approveseqnumFrom = fromRequestNumber;
@@ -169,9 +171,10 @@ public class Request extends TestClient {
      * 
      * @param fromrequest number
      * @param endrequestnumber.
+     * @throws UnsupportedEncodingException
      */
 
-    public Vector<String> ListAllRequests(String fromRequestNumber, String toRequestNumber) {
+    public Vector<String> ListAllRequests(String fromRequestNumber, String toRequestNumber) throws UnsupportedEncodingException {
         reqState = "showAll";
         reqType = "enrollment";
         approveseqnumFrom = fromRequestNumber;
@@ -184,9 +187,10 @@ public class Request extends TestClient {
      * Approve pending enrollment request. Takes parameters RequestNumber
      * 
      * @param request number
+     * @throws UnsupportedEncodingException
      */
 
-    public int ApproveRequests(String requestNumber) {
+    public int ApproveRequests(String requestNumber) throws UnsupportedEncodingException {
         reqState = "showWaiting";
         reqType = "enrollment";
         approveseqnum = requestNumber;
@@ -205,9 +209,10 @@ public class Request extends TestClient {
      * Approve profile based pending enrollment request. Takes parameters RequestNumber
      * 
      * @param request number
+     * @throws UnsupportedEncodingException
      */
 
-    public int ApproveProfileRequests(String RequestNumber) {
+    public int ApproveProfileRequests(String RequestNumber) throws UnsupportedEncodingException {
 
         approveseqnum = RequestNumber;
         approveseqnumFrom = RequestNumber;
@@ -223,7 +228,7 @@ public class Request extends TestClient {
 
     }
 
-    public boolean Approve_cadualcert_Profile_Request(String RequestNumber, String name) {
+    public boolean Approve_cadualcert_Profile_Request(String RequestNumber, String name) throws UnsupportedEncodingException {
 
         approveseqnum = RequestNumber;
         approveseqnumFrom = RequestNumber;
@@ -252,9 +257,10 @@ public class Request extends TestClient {
      * Reject profile based pending enrollment request. Takes parameters RequestNumber
      * 
      * @param request number
+     * @throws UnsupportedEncodingException
      */
 
-    public int RejectProfileRequests(String RequestNumber) {
+    public int RejectProfileRequests(String RequestNumber) throws UnsupportedEncodingException {
 
         approveseqnum = RequestNumber;
         approveseqnumFrom = RequestNumber;
@@ -274,9 +280,10 @@ public class Request extends TestClient {
      * Cancel profile based pending enrollment request. Takes parameters RequestNumber
      * 
      * @param request number
+     * @throws UnsupportedEncodingException
      */
 
-    public int CancelProfileRequests(String RequestNumber) {
+    public int CancelProfileRequests(String RequestNumber) throws UnsupportedEncodingException {
 
         approveseqnum = RequestNumber;
         approveseqnumFrom = RequestNumber;
@@ -678,7 +685,7 @@ public class Request extends TestClient {
         return st;
     }
 
-    private void buildquery() {
+    private void buildquery() throws UnsupportedEncodingException {
 
         if (reqtype == 1) { // req type = list
             ACTION_STRING = "/" + agenttype + ACTION_LISTREQUEST;
@@ -711,9 +718,9 @@ public class Request extends TestClient {
             query = "seqNum=" + approveseqnum;
             query += "&toDo=accept";
             if (subjectdn != null) {
-                query += "&subject=" + URLEncoder.encode(subjectdn);
+                query += "&subject=" + URLEncoder.encode(subjectdn, "UTF-8");
             } else if (subject != null) {
-                query += "&subject=" + URLEncoder.encode(subject);
+                query += "&subject=" + URLEncoder.encode(subject, "UTF-8");
             }
 
             if (csrRequestorName != null) {
@@ -776,7 +783,7 @@ public class Request extends TestClient {
             query = "requestId=" + approveseqnum;
             query += "&name="
                     + URLEncoder.encode(
-                            "UID=test,E=test,CN=test,OU=netscape,O=aol");
+                            "UID=test,E=test,CN=test,OU=netscape,O=aol", "UTF-8");
             query += "&keyUsageCritical=true";
             query += "&keyUsageDigitalSignature=true";
             query += "&keyUsageNonRepudiation=true";
@@ -800,7 +807,7 @@ public class Request extends TestClient {
 
             query += "&subAltNameExtCritical=false";
             query += "&subjAltNames=RFC822Name:"
-                    + URLEncoder.encode(" thomasknscp@aol.com");
+                    + URLEncoder.encode(" thomasknscp@aol.com", "UTF-8");
             query += "&signingAlg=MD5withRSA";
 
             query += "&submit=submit";
@@ -864,7 +871,7 @@ public class Request extends TestClient {
                     + ":" + end.get(Calendar.SECOND);
 
             query = "requestId=" + approveseqnum + "&name="
-                    + URLEncoder.encode(cadualcert_name) + "&notBefore=" + nb
+                    + URLEncoder.encode(cadualcert_name, "UTF-8") + "&notBefore=" + nb
                     + "&notAfter=" + nat + "&authInfoAccessCritical=false"
                     + "&authInfoAccessGeneralNames=" + "&keyUsageCritical=true"
                     + "&keyUsageDigitalSignature=false"
@@ -958,7 +965,7 @@ public class Request extends TestClient {
 
     }
 
-    private boolean listRequest(String from, String To) {
+    private boolean listRequest(String from, String To) throws UnsupportedEncodingException {
 
         Integer x = new Integer(from);
 
@@ -980,7 +987,7 @@ public class Request extends TestClient {
         return (Send());
     }
 
-    private boolean approveRequest() {
+    private boolean approveRequest() throws UnsupportedEncodingException {
 
         boolean st = true;
 
@@ -1059,9 +1066,10 @@ public class Request extends TestClient {
 
     /**
      * Use this method when you need to use properties file.
+     * @throws UnsupportedEncodingException
      */
 
-    public int processRequest() {
+    public int processRequest() throws UnsupportedEncodingException {
         if (propfileName != null) {
             readProperties();
         }
@@ -1112,7 +1120,12 @@ public class Request extends TestClient {
 
         Request t = new Request(args[0]);
 
-        st = t.processRequest();
+        try {
+            st = t.processRequest();
+        } catch (UnsupportedEncodingException e) {
+            System.out.println(e);
+            e.printStackTrace();
+        }
         if (st == -1) {
             System.exit(0);
         } else {
diff --git a/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java b/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java
index 5761c6f779c76acc45e6684c421cb81938933014..c55088bc660fc30cb9d2c92b402de1c1d8c5cb22 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/common/UserEnroll.java
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.Date;
 import java.util.GregorianCalendar;
@@ -153,7 +154,7 @@ public class UserEnroll extends TestClient {
         certType = ct;
     }
 
-    public boolean enroll_load() {
+    public boolean enroll_load() throws UnsupportedEncodingException {
         buildquery();
         setStatusString("");
         return (Send());
@@ -297,7 +298,7 @@ public class UserEnroll extends TestClient {
 
     }
 
-    private void buildquery() {
+    private void buildquery() throws UnsupportedEncodingException {
 
         StringBuffer queryStrBuf = new StringBuffer();
 
@@ -324,10 +325,10 @@ public class UserEnroll extends TestClient {
             if (requestorName.length() > 0) {
                 queryStrBuf.append("&csrRequestorName=");
             }
-            queryStrBuf.append(URLEncoder.encode(requestorName));
+            queryStrBuf.append(URLEncoder.encode(requestorName, "UTF-8"));
             if (requestorEmail.length() > 0) {
                 queryStrBuf.append("&csrRequestorEmail=");
-                queryStrBuf.append(URLEncoder.encode(requestorEmail));
+                queryStrBuf.append(URLEncoder.encode(requestorEmail, "UTF-8"));
                 queryStrBuf.append("&email=true");
 
             } else {
@@ -336,11 +337,11 @@ public class UserEnroll extends TestClient {
 
             if (requestorPhone.length() > 0) {
                 queryStrBuf.append("&csrRequestorPhone=");
-                queryStrBuf.append(URLEncoder.encode(requestorPhone));
+                queryStrBuf.append(URLEncoder.encode(requestorPhone, "UTF-8"));
             }
             if (requestorComments.length() > 0) {
                 queryStrBuf.append("&csrRequestorComments=");
-                queryStrBuf.append(URLEncoder.encode(requestorComments));
+                queryStrBuf.append(URLEncoder.encode(requestorComments, "UTF-8"));
             }
             System.out.println("buidlquery client E ");
             if (E.length() > 0) {
@@ -364,7 +365,7 @@ public class UserEnroll extends TestClient {
             // if(C.length() >0) {	queryStrBuf.append("&C=");queryStrBuf.append(C);}
             System.out.println("buidlquery client dn ");
             queryStrBuf.append("&subject=");
-            queryStrBuf.append(URLEncoder.encode(DN));
+            queryStrBuf.append(URLEncoder.encode(DN, "UTF-8"));
         }
 
         if (certType.equals("ra")) {
@@ -405,7 +406,7 @@ public class UserEnroll extends TestClient {
         }
 
         queryStrBuf.append("&pkcs10Request=");
-        queryStrBuf.append(URLEncoder.encode(pkcs10request));
+        queryStrBuf.append(URLEncoder.encode(pkcs10request, "UTF-8"));
         System.out.println("before converting bug to string ");
         query = queryStrBuf.toString();
 
diff --git a/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java b/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java
index 3c715226d36d9012a374ba63f874b93b6ec8a75c..f3980c0ed4df6e80edc871b7ee65387a49cbc68d 100644
--- a/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java
+++ b/pki/base/silent/src/com/netscape/pkisilent/http/HTTPClient.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.URLDecoder;
@@ -1078,7 +1079,7 @@ public class HTTPClient implements SSLCertificateApprovalCallback {
         return true;
     }
 
-    public static void main(String args[]) {
+    public static void main(String args[]) throws UnsupportedEncodingException {
         HTTPClient hc = new HTTPClient();
         HTTPResponse hr = null;
 
@@ -1217,7 +1218,7 @@ public class HTTPClient implements SSLCertificateApprovalCallback {
 
         String responseValue = null;
         if (decode.equalsIgnoreCase("true"))
-            responseValue = URLDecoder.decode(hr.getHTML());
+            responseValue = URLDecoder.decode(hr.getHTML(), "UTF-8");
         else
             responseValue = hr.getHTML();
 
-- 
1.7.6.4

