diff options
author | Ade Lee <alee@redhat.com> | 2012-03-23 16:19:59 -0400 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-03-23 20:51:42 -0400 |
commit | 40d3643b8d91886bf210aa27f711731c81a11e49 (patch) | |
tree | afef9b49de9539ab1d681835e150aadefb4f9e53 | |
parent | 154c2954b7986299840746e98ae7a23199cc35b9 (diff) | |
download | pki-40d3643b8d91886bf210aa27f711731c81a11e49.tar.gz pki-40d3643b8d91886bf210aa27f711731c81a11e49.tar.xz pki-40d3643b8d91886bf210aa27f711731c81a11e49.zip |
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
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 d18774d95..4df28d344 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 007ebf207..c8783f566 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 a49653c12..25bc9cabe 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 0171115ee..a7cc40507 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 193a6d9bd..8302e2d23 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 80abd5f77..600bbd110 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 dbcba085d..ce4c966ad 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 f656cbd44..0bcb962ea 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 663435cba..6d0e92618 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 3d5e93a56..3ab20141c 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 7e704dfbf..459660f1e 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 6afaea997..7c7162d0c 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 c9cc25997..05f8e111a 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 e9a7371d9..1fbcf2738 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 ec461fb9a..3b220c100 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 6c73bcb96..568a38e6d 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 bd38138ff..9e7ecdc64 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 c84441468..892fd6451 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 ea427ff7c..c1d463cdb 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 f7d2ba134..aa2b2c2de 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 cf2b2d52a..8d8cafb84 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 0f0827d67..3dffc929c 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) + "¬Before=" + nb + + URLEncoder.encode(cadualcert_name, "UTF-8") + "¬Before=" + nb + "¬After=" + 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 5761c6f77..c55088bc6 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 3c715226d..f3980c0ed 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(); |