>From 47b506d49e95d1e172c639372c85e47c283e9323 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru@redhat.com>
Date: Fri, 29 Jun 2012 16:08:04 -0400
Subject: [PATCH] CATCH_REXCEPTION AND UNREAD_FIELD_CASES

---
 .../netscape/certsrv/base/MessageFormatter.java    |   98 +-
 .../src/com/netscape/cmscore/apps/CMSEngine.java   |   10 +-
 .../src/com/netscape/cmscore/cert/CertUtils.java   |   43 +-
 .../netscape/cmscore/connector/LocalConnector.java |    1 -
 .../netscape/cmscore/ldap/LdapPredicateParser.java |    1 -
 .../cmscore/policy/PolicyPredicateParser.java      |    1 -
 .../src/com/netscape/cmscore/security/PWCBsdr.java |    7 -
 .../src/com/netscape/cmscore/security/PWUtil.java  |   61 +-
 .../com/netscape/cmscore/security/PWsdrCache.java  |   78 +-
 .../src/com/netscape/cmstools/PasswordCache.java   |    7 +-
 .../netscape/kra/SecurityDataRecoveryService.java  |    1 +
 .../netscape/cmsutil/ocsp/BasicOCSPResponse.java   |   18 +-
 .../com/netscape/cmsutil/scep/CRSPKIMessage.java   |    7 +-
 base/util/src/com/netscape/cmsutil/util/Utils.java |    7 +-
 .../netscape/security/util/CertPrettyPrint.java    |    1 +
 .../src/netscape/security/util/ExtPrettyPrint.java |  938 ++++++++++----------
 .../netscape/security/util/PubKeyPrettyPrint.java  |    4 +-
 .../security/x509/CRLDistributionPoint.java        |   12 +-
 .../src/netscape/security/x509/X509CertImpl.java   |   11 +-
 .../src/netscape/security/x509/X509CertInfo.java   |   15 +-
 20 files changed, 651 insertions(+), 670 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/base/MessageFormatter.java b/base/common/src/com/netscape/certsrv/base/MessageFormatter.java
index 40275b516f40c4d485e332d386add1e6f660f3b3..f573a227e99583606b8494ddf217747d418485cf 100644
--- a/base/common/src/com/netscape/certsrv/base/MessageFormatter.java
+++ b/base/common/src/com/netscape/certsrv/base/MessageFormatter.java
@@ -88,67 +88,63 @@ public class MessageFormatter {
         String localizedFormat = null;
 
         try {
-            try {
-                // if you are worried about the efficiency of the
-                // following line, dont worry. ResourceBundle has
-                // an internal cache. So resource bundle wont be
-                // instantiated everytime you call toString().
+            // if you are worried about the efficiency of the
+            // following line, dont worry. ResourceBundle has
+            // an internal cache. So resource bundle wont be
+            // instantiated everytime you call toString().
 
-                localizedFormat = ResourceBundle.getBundle(
-                            resourceBundleBaseName, locale).getString(formatString);
-            } catch (MissingResourceException e) {
-                return formatString;
+            localizedFormat = ResourceBundle.getBundle(
+                    resourceBundleBaseName, locale).getString(formatString);
+        } catch (MissingResourceException e) {
+            return formatString;
 
-            }
-            Object[] localizedParams = params;
-            Object[] localeArg = null;
+        }
+        Object[] localizedParams = params;
+        Object[] localeArg = null;
 
-            if (params != null) {
-                for (int i = 0; i < params.length; ++i) {
-                    if (!(params[i] instanceof String) ||
-                            !(params[i] instanceof Date) ||
-                            !(params[i] instanceof Number)) {
-                        if (localizedParams == params) {
+        if (params != null) {
+            for (int i = 0; i < params.length; ++i) {
+                if (!(params[i] instanceof String) ||
+                        !(params[i] instanceof Date) ||
+                        !(params[i] instanceof Number)) {
+                    if (localizedParams == params) {
 
+                        // only done once
+                        // NB if the following variant of cloning code is used
+                        //         localizedParams = (Object [])mParams.clone();
+                        // it causes ArrayStoreException in
+                        //         localizedParams[i] = params[i].toString();
+                        // below
+
+                        localizedParams = new Object[params.length];
+                        System.arraycopy(params, 0, localizedParams, 0,
+                                params.length);
+                    }
+                    try {
+                        Method toStringMethod = params[i].getClass().getMethod(
+                                "toString", toStringSignature);
+
+                        if (localeArg == null) {
                             // only done once
-                            // NB if the following variant of cloning code is used
-                            //         localizedParams = (Object [])mParams.clone();
-                            // it causes ArrayStoreException in
-                            //         localizedParams[i] = params[i].toString();
-                            // below
-
-                            localizedParams = new Object[params.length];
-                            System.arraycopy(params, 0, localizedParams, 0,
-                                    params.length);
-                        }
-                        try {
-                            Method toStringMethod = params[i].getClass().getMethod(
-                                    "toString", toStringSignature);
-
-                            if (localeArg == null) {
-                                // only done once
-                                localeArg = new Object[] { locale };
-                            }
-                            localizedParams[i] = toStringMethod.invoke(
-                                        params[i], localeArg);
-                        } catch (Exception e) {
-                            // no method for localization, fall back
-                            localizedParams[i] = params[i].toString();
+                            localeArg = new Object[] { locale };
                         }
+                        localizedParams[i] = toStringMethod.invoke(
+                                params[i], localeArg);
+                    } catch (Exception e) {
+                        // no method for localization, fall back
+                        localizedParams[i] = params[i].toString();
                     }
                 }
             }
-            try {
-                // XXX - runtime exception may be raised by the following function
-                MessageFormat format = new MessageFormat(localizedFormat);
+        }
+        try {
+            // XXX - runtime exception may be raised by the following function
+            MessageFormat format = new MessageFormat(localizedFormat);
 
-                return format.format(localizedParams);
-            } catch (IllegalArgumentException e) {
-                // XXX - for now, we just print the unformatted message
-                // if the exception is raised
-                return localizedFormat;
-            }
-        } catch (Exception e) {
+            return format.format(localizedParams);
+        } catch (IllegalArgumentException e) {
+            // XXX - for now, we just print the unformatted message
+            // if the exception is raised
             return localizedFormat;
         }
     }
diff --git a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
index cbdfee8fc65e435ffae9f568473674d068b1c480..5cfa3ef56af921e5dd61a612c0a876bf6c2eb2a8 100644
--- a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
+++ b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java
@@ -531,8 +531,9 @@ public class CMSEngine implements ICMSEngine {
 
     /**
      * Parse server.xml to get the ports and IPs
+     * @throws EBaseException
      */
-    private void parseServerXML() {
+    private void parseServerXML() throws EBaseException {
         try {
             String instanceRoot = mConfig.getString("instanceRoot");
             String path = instanceRoot + File.separator + "conf" + File.separator + SERVER_XML;
@@ -628,6 +629,7 @@ public class CMSEngine implements ICMSEngine {
 
         } catch (Exception e) {
             CMS.debug("CMSEngine: parseServerXML exception: " + e.toString());
+            throw new EBaseException("CMSEngine: Cannot parse the configuration file. " + e.toString());
         }
     }
 
@@ -1586,8 +1588,10 @@ public class CMSEngine implements ICMSEngine {
 
             process.waitFor();
 
-        } catch (Exception e) {
-
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
         }
     } // end shutdownHttpServer
 
diff --git a/base/common/src/com/netscape/cmscore/cert/CertUtils.java b/base/common/src/com/netscape/cmscore/cert/CertUtils.java
index ee1e1568c595da8b264d443426854a856afcb1e3..b7942e5a145017284bbd49453934cb5ccb2ea0df 100644
--- a/base/common/src/com/netscape/cmscore/cert/CertUtils.java
+++ b/base/common/src/com/netscape/cmscore/cert/CertUtils.java
@@ -28,6 +28,7 @@ import java.security.cert.CertificateEncodingException;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateExpiredException;
 import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.CertificateParsingException;
 import java.security.cert.X509CRL;
 import java.security.cert.X509Certificate;
 import java.util.Arrays;
@@ -453,7 +454,7 @@ public class CertUtils {
         return ((recentCert == currentCert) ? null : recentCert);
     }
 
-    public static String getCertType(X509CertImpl cert) {
+    public static String getCertType(X509CertImpl cert) throws CertificateParsingException, IOException {
         StringBuffer sb = new StringBuffer();
 
         if (isSigningCert(cert))
@@ -465,27 +466,24 @@ public class CertUtils {
         }
 
         // Is is object signing cert?
-        try {
-            CertificateExtensions extns = (CertificateExtensions)
-                    cert.get(X509CertImpl.NAME + "." +
-                            X509CertImpl.INFO + "." +
-                            X509CertInfo.EXTENSIONS);
+        CertificateExtensions extns = (CertificateExtensions)
+                cert.get(X509CertImpl.NAME + "." +
+                        X509CertImpl.INFO + "." +
+                        X509CertInfo.EXTENSIONS);
 
-            if (extns != null) {
-                NSCertTypeExtension nsExtn = (NSCertTypeExtension)
-                        extns.get(NSCertTypeExtension.NAME);
+        if (extns != null) {
+            NSCertTypeExtension nsExtn = (NSCertTypeExtension)
+                    extns.get(NSCertTypeExtension.NAME);
 
-                if (nsExtn != null) {
-                    String nsType = getNSExtensionInfo(nsExtn);
+            if (nsExtn != null) {
+                String nsType = getNSExtensionInfo(nsExtn);
 
-                    if (nsType != null) {
-                        if (sb.length() > 0)
-                            sb.append("  ");
-                        sb.append(nsType);
-                    }
+                if (nsType != null) {
+                    if (sb.length() > 0)
+                        sb.append("  ");
+                    sb.append(nsType);
                 }
             }
-        } catch (Exception e) {
         }
         return (sb.length() > 0) ? sb.toString() : null;
     }
@@ -793,14 +791,21 @@ public class CertUtils {
 
         // if the OID isn't valid (ex. n.n) the error isn't caught til
         // encoding time leaving a bad request in the request queue.
+        DerOutputStream derOut = null;
         try {
-            DerOutputStream derOut = new DerOutputStream();
+            derOut = new DerOutputStream();
 
             derOut.putOID(oid);
             new ObjectIdentifier(new DerInputStream(derOut.toByteArray()));
         } catch (Exception e) {
             throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_ATTR_VALUE",
-                        attrName, msg1));
+                    attrName, msg1));
+        } finally {
+            try {
+                derOut.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
         }
         return oid;
     }
diff --git a/base/common/src/com/netscape/cmscore/connector/LocalConnector.java b/base/common/src/com/netscape/cmscore/connector/LocalConnector.java
index 9c48254945f44587ef4c6f4dc4b21db2d7bb5e29..ed0d5aa6d3c2d470906ca3a86890690517940dc0 100644
--- a/base/common/src/com/netscape/cmscore/connector/LocalConnector.java
+++ b/base/common/src/com/netscape/cmscore/connector/LocalConnector.java
@@ -36,7 +36,6 @@ import com.netscape.certsrv.request.RequestStatus;
 import com.netscape.cmscore.util.Debug;
 
 public class LocalConnector implements IConnector {
-    ILogger mLogger = CMS.getLogger();
     ICertAuthority mSource = null;
     IAuthority mDest = null;
     Hashtable<String, IRequest> mSourceReqs = new Hashtable<String, IRequest>();
diff --git a/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java b/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java
index 8c2b730d57f900a283d81bd2c012f4a1caf02d39..699877ffa776b415c234ca7a8ca1ac5247885c24 100644
--- a/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java
+++ b/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java
@@ -262,7 +262,6 @@ class PredicateTokenizer {
     int currentIndex;
     int endOfString;
     String nextToken;
-    boolean first;
 
     public PredicateTokenizer(String predString) {
         input = predString;
diff --git a/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java b/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java
index 09316ceffb9e405f762cf6c33d95f9db89083ffe..8494178695f9f8e37ea5e8981dc024aa14ffd4b7 100644
--- a/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java
+++ b/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java
@@ -265,7 +265,6 @@ class PredicateTokenizer {
     int currentIndex;
     int endOfString;
     String nextToken;
-    boolean first;
 
     public PredicateTokenizer(String predString) {
         input = predString;
diff --git a/base/common/src/com/netscape/cmscore/security/PWCBsdr.java b/base/common/src/com/netscape/cmscore/security/PWCBsdr.java
index 0ff50668c08cf52592bb3701f115dcd043d2eda8..a62a8561d724370d8b4cb24e5ea9fc56996c732b 100644
--- a/base/common/src/com/netscape/cmscore/security/PWCBsdr.java
+++ b/base/common/src/com/netscape/cmscore/security/PWCBsdr.java
@@ -17,9 +17,6 @@
 // --- END COPYRIGHT BLOCK ---
 package com.netscape.cmscore.security;
 
-import java.io.InputStream;
-import java.io.OutputStream;
-
 import org.mozilla.jss.util.Password;
 import org.mozilla.jss.util.PasswordCallback;
 import org.mozilla.jss.util.PasswordCallbackInfo;
@@ -36,8 +33,6 @@ import com.netscape.cmscore.base.JDialogPasswordCallback;
  */
 
 public class PWCBsdr implements PasswordCallback {
-    InputStream in = null;
-    OutputStream out = null;
     String mprompt = "";
     boolean firsttime = true;
     private PasswordCallback mCB = null;
@@ -49,8 +44,6 @@ public class PWCBsdr implements PasswordCallback {
     }
 
     public PWCBsdr(String prompt) {
-        in = System.in;
-        out = System.out;
         mprompt = prompt;
 
         /* to get the test program work
diff --git a/base/common/src/com/netscape/cmscore/security/PWUtil.java b/base/common/src/com/netscape/cmscore/security/PWUtil.java
index fa0de3c4bf1df2c501b41469b8719ad4e6d6c25f..4a15aa09b32e68e8032359512e799b0e4d663089 100644
--- a/base/common/src/com/netscape/cmscore/security/PWUtil.java
+++ b/base/common/src/com/netscape/cmscore/security/PWUtil.java
@@ -29,45 +29,42 @@ public class PWUtil {
         String passwordString = "";
         int c;
 
+        // System.out.println( "about to do read" );
         try {
-            // System.out.println( "about to do read" );
-            try {
-                while ((c = System.in.read()) != -1) {
-                    char ch = (char) c;
+            while ((c = System.in.read()) != -1) {
+                char ch = (char) c;
 
-                    // System.out.println( "read [" + ch + "]" );
-                    // System.out.println( "char is [" + ch + "]" );
-                    if (ch != '\r') {
-                        if (ch != '\n') {
-                            buf.append(ch);
-                        } else {
-                            passwordString = buf.toString();
-                            buf.setLength(0);
-                            break;
-                        }
+                // System.out.println( "read [" + ch + "]" );
+                // System.out.println( "char is [" + ch + "]" );
+                if (ch != '\r') {
+                    if (ch != '\n') {
+                        buf.append(ch);
+                    } else {
+                        passwordString = buf.toString();
+                        buf.setLength(0);
+                        break;
                     }
                 }
-            } catch (Exception e) {
-                System.out.println("READ EXCEPTION");
             }
-
-            // memory problem?
-            //      String passwordString = in.readLine();
-            //            System.out.println( "done read" );
-            //            System.out.println( " password recieved is ["
-            //                              + passwordString + "]" );
-            if (passwordString == null) {
-                throw new PasswordCallback.GiveUpException();
-            }
-
-            if (passwordString.equals("")) {
-                throw new PasswordCallback.GiveUpException();
-            }
-
-            // System.out.println( "returning pw" );
-            return (new Password(passwordString.toCharArray()));
         } catch (Exception e) {
+            System.out.println("READ EXCEPTION");
+        }
+
+        // memory problem?
+        //      String passwordString = in.readLine();
+        //            System.out.println( "done read" );
+        //            System.out.println( " password recieved is ["
+        //                              + passwordString + "]" );
+        if (passwordString == null) {
+            throw new PasswordCallback.GiveUpException();
+        }
+
+        if (passwordString.equals("")) {
             throw new PasswordCallback.GiveUpException();
         }
+
+        // System.out.println( "returning pw" );
+        return (new Password(passwordString.toCharArray()));
+
     }
 }
diff --git a/base/common/src/com/netscape/cmscore/security/PWsdrCache.java b/base/common/src/com/netscape/cmscore/security/PWsdrCache.java
index b0445bd6d10ff52f0594bbf40319ea75f9723139..4342dd800cef73f2e33e04de7bceda3f47991400 100644
--- a/base/common/src/com/netscape/cmscore/security/PWsdrCache.java
+++ b/base/common/src/com/netscape/cmscore/security/PWsdrCache.java
@@ -543,49 +543,51 @@ public class PWsdrCache {
     }
 
     public static boolean exec(String cmd) throws EBaseException {
+        String cmds[] = null;
+
+        if (isNT()) {
+            // NT
+            cmds = new String[3];
+            cmds[0] = "cmd";
+            cmds[1] = "/c";
+            cmds[2] = cmd;
+        } else {
+            // UNIX
+            cmds = new String[3];
+            cmds[0] = "/bin/sh";
+            cmds[1] = "-c";
+            cmds[2] = cmd;
+        }
+        Process process = null;
         try {
-            String cmds[] = null;
-
-            if (isNT()) {
-                // NT
-                cmds = new String[3];
-                cmds[0] = "cmd";
-                cmds[1] = "/c";
-                cmds[2] = cmd;
-            } else {
-                // UNIX
-                cmds = new String[3];
-                cmds[0] = "/bin/sh";
-                cmds[1] = "-c";
-                cmds[2] = cmd;
-            }
-            Process process = Runtime.getRuntime().exec(cmds);
-
+            process = Runtime.getRuntime().exec(cmds);
             process.waitFor();
+        } catch (IOException e) {
+            throw new EBaseException(e.toString());
+        } catch (InterruptedException e) {
+            throw new EBaseException(e.toString());
+        }
 
-            if (process.exitValue() == 0) {
+        if (process.exitValue() == 0) {
 
-                /**
-                 * pOut = new BufferedReader(
-                 * new InputStreamReader(process.getInputStream()));
-                 * while ((l = pOut.readLine()) != null) {
-                 * System.out.println(l);
-                 * }
-                 **/
-                return true;
-            } else {
+            /**
+             * pOut = new BufferedReader(
+             * new InputStreamReader(process.getInputStream()));
+             * while ((l = pOut.readLine()) != null) {
+             * System.out.println(l);
+             * }
+             **/
+            return true;
+        } else {
 
-                /**
-                 * pOut = new BufferedReader(
-                 * new InputStreamReader(process.getErrorStream()));
-                 * l = null;
-                 * while ((l = pOut.readLine()) != null) {
-                 * System.out.println(l);
-                 * }
-                 **/
-                return false;
-            }
-        } catch (Exception e) {
+            /**
+             * pOut = new BufferedReader(
+             * new InputStreamReader(process.getErrorStream()));
+             * l = null;
+             * while ((l = pOut.readLine()) != null) {
+             * System.out.println(l);
+             * }
+             **/
             return false;
         }
     }
diff --git a/base/java-tools/src/com/netscape/cmstools/PasswordCache.java b/base/java-tools/src/com/netscape/cmstools/PasswordCache.java
index dbc52a02ab3317270fc0f1b2c440a265063faf35..5cc8142ca820ade5fe77d9f713ca27cdd5241f6a 100644
--- a/base/java-tools/src/com/netscape/cmstools/PasswordCache.java
+++ b/base/java-tools/src/com/netscape/cmstools/PasswordCache.java
@@ -818,9 +818,12 @@ class PWsdrCache {
                  **/
                 return false;
             }
-        } catch (Exception e) {
-            return false;
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
         }
+        return false;
     }
 
     public void debug(String msg) {
diff --git a/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java b/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java
index a2c6fd9f5f5c151eee947f8abb61a55732bb9a26..527548381577a027ce81d4e3fb5cf7dfe5e11163 100644
--- a/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java
+++ b/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java
@@ -236,6 +236,7 @@ public class SecurityDataRecoveryService implements IService {
                         throw new IOException("Failed to create cipher");
                     }
                 } catch (Exception e) {
+                    e.printStackTrace();
                     throw new EBaseException("Can't wrap pass phrase!");
                 }
             }
diff --git a/base/util/src/com/netscape/cmsutil/ocsp/BasicOCSPResponse.java b/base/util/src/com/netscape/cmsutil/ocsp/BasicOCSPResponse.java
index 52535d3d060ce7896c0cbcd9921c3a5cc2d4c850..1b8273edabd11d18a994e5416c190d707c79e817 100644
--- a/base/util/src/com/netscape/cmsutil/ocsp/BasicOCSPResponse.java
+++ b/base/util/src/com/netscape/cmsutil/ocsp/BasicOCSPResponse.java
@@ -61,23 +61,19 @@ public class BasicOCSPResponse implements Response {
         _certs = certs;
     }
 
-    public BasicOCSPResponse(OCTET_STRING os) {
+    public BasicOCSPResponse(OCTET_STRING os) throws InvalidBERException, IOException {
         this(os.toByteArray());
     }
 
-    public BasicOCSPResponse(byte data[]) {
+    public BasicOCSPResponse(byte data[]) throws InvalidBERException, IOException {
         mData = data;
 
         // extract _rd, _signAlg, _signature and _certs
-        try {
-            BasicOCSPResponse resp = (BasicOCSPResponse) getTemplate().decode(new ByteArrayInputStream(data));
-            _rd = resp.getResponseData();
-            _signAlg = resp.getSignatureAlgorithm();
-            _signature = resp.getSignature();
-            _certs = resp.getCerts();
-        } catch (Exception e) {
-            // exception in decoding byte data
-        }
+        BasicOCSPResponse resp = (BasicOCSPResponse) getTemplate().decode(new ByteArrayInputStream(data));
+        _rd = resp.getResponseData();
+        _signAlg = resp.getSignatureAlgorithm();
+        _signature = resp.getSignature();
+        _certs = resp.getCerts();
     }
 
     private static final Tag TAG = SEQUENCE.TAG;
diff --git a/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java b/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java
index de6cb20aaa64b65a2d3490b484b121754e4f58d5..afde8b6c1bec434f20f3e46653fa3366d06d5f54 100644
--- a/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java
+++ b/base/util/src/com/netscape/cmsutil/scep/CRSPKIMessage.java
@@ -484,9 +484,12 @@ public class CRSPKIMessage {
 
             return baos.toByteArray();
             //            return crsd.getEncodedContents();
-        } catch (Exception e) {
-            return null;
+        } catch (InvalidBERException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
         }
+        return null;
     }
 
     public String toString() {
diff --git a/base/util/src/com/netscape/cmsutil/util/Utils.java b/base/util/src/com/netscape/cmsutil/util/Utils.java
index c8d6b438dec11d5667870ee4ccba23382a9c3868..b2b0119accb8d91e2e885c7c2b8bd6495cb31f2d 100644
--- a/base/util/src/com/netscape/cmsutil/util/Utils.java
+++ b/base/util/src/com/netscape/cmsutil/util/Utils.java
@@ -87,9 +87,12 @@ public class Utils {
                  **/
                 return false;
             }
-        } catch (Exception e) {
-            return false;
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
         }
+        return false;
     }
 
     public static String SpecialURLDecode(String s) {
diff --git a/base/util/src/netscape/security/util/CertPrettyPrint.java b/base/util/src/netscape/security/util/CertPrettyPrint.java
index a72f0d4fba7bd874a4d59a0b1832f026bb309d67..34dda33b61a111c6b0dbbb46d0e2c2475a87eee4 100644
--- a/base/util/src/netscape/security/util/CertPrettyPrint.java
+++ b/base/util/src/netscape/security/util/CertPrettyPrint.java
@@ -336,6 +336,7 @@ public class CertPrettyPrint {
 
             sb.append(certFingerprints.toString());
         } catch (Exception e) {
+            e.printStackTrace();
         }
 
         return sb.toString();
diff --git a/base/util/src/netscape/security/util/ExtPrettyPrint.java b/base/util/src/netscape/security/util/ExtPrettyPrint.java
index d40379e7da44d0785385b15882ccbb0b60c6d736..05556525516e4140cf99d922fa89db3935664624 100644
--- a/base/util/src/netscape/security/util/ExtPrettyPrint.java
+++ b/base/util/src/netscape/security/util/ExtPrettyPrint.java
@@ -17,7 +17,9 @@
 // --- END COPYRIGHT BLOCK ---
 package netscape.security.util;
 
+import java.io.IOException;
 import java.math.BigInteger;
+import java.security.cert.CertificateException;
 import java.text.DateFormat;
 import java.util.Enumeration;
 import java.util.ResourceBundle;
@@ -218,34 +220,31 @@ public class ExtPrettyPrint {
         }
 
         //unknown cert extension
-        try {
-            String extName = OIDMap.getName(mExt.getExtensionId());
+        String extName = OIDMap.getName(mExt.getExtensionId());
 
-            if (extName == null)
-                sb.append(pp.indent(mIndentSize) + mResource.getString(
-                        PrettyPrintResources.TOKEN_IDENTIFIER) +
-                        mExt.getExtensionId().toString() + "\n");
-            else
-                sb.append(pp.indent(mIndentSize) + mResource.getString(
-                        PrettyPrintResources.TOKEN_IDENTIFIER) + " " + extName + " - " +
-                        mExt.getExtensionId().toString() + "\n");
+        if (extName == null)
+            sb.append(pp.indent(mIndentSize) + mResource.getString(
+                    PrettyPrintResources.TOKEN_IDENTIFIER) +
+                    mExt.getExtensionId().toString() + "\n");
+        else
+            sb.append(pp.indent(mIndentSize) + mResource.getString(
+                    PrettyPrintResources.TOKEN_IDENTIFIER) + " " + extName + " - " +
+                    mExt.getExtensionId().toString() + "\n");
 
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
-            }
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_VALUE) + "\n");
-            sb.append(pp.toHexString(mExt.getExtensionValue(), mIndentSize + 8, 16));
-            return sb.toString();
-        } catch (Exception e) {
-            return "";
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
         }
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_VALUE) + "\n");
+        sb.append(pp.toHexString(mExt.getExtensionValue(), mIndentSize + 8, 16));
+
+        return sb.toString();
 
     }
 
@@ -329,195 +328,174 @@ public class ExtPrettyPrint {
     private String getSubjectInfoAccessExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(
-                    PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_SIA) +
-                    "- " + mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
+        sb.append(pp.indent(mIndentSize) + mResource.getString(
+                PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_SIA) +
+                "- " + mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
+        }
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_ACCESS_DESC) + "\n");
+        SubjectInfoAccessExtension aia = (SubjectInfoAccessExtension) mExt;
+
+        for (int i = 0; i < aia.numberOfAccessDescription(); i++) {
+            AccessDescription ad = aia.getAccessDescription(i);
+            ObjectIdentifier method = ad.getMethod();
+
+            if (method.equals(SubjectInfoAccessExtension.METHOD_OCSP)) {
+                sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
+                        "ocsp" + "\n");
             } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
+                sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
+                        method.toString() + "\n");
             }
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_ACCESS_DESC) + "\n");
-            SubjectInfoAccessExtension aia = (SubjectInfoAccessExtension) mExt;
-
-            for (int i = 0; i < aia.numberOfAccessDescription(); i++) {
-                AccessDescription ad = aia.getAccessDescription(i);
-                ObjectIdentifier method = ad.getMethod();
-
-                if (method.equals(SubjectInfoAccessExtension.METHOD_OCSP)) {
-                    sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
-                            "ocsp" + "\n");
-                } else {
-                    sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
-                            method.toString() + "\n");
-                }
-                sb.append(pp.indent(mIndentSize + 8) + "Location #" + i + ": " +
-                        ad.getLocation().toString() + "\n");
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return sb.toString();
+            sb.append(pp.indent(mIndentSize + 8) + "Location #" + i + ": " +
+                    ad.getLocation().toString() + "\n");
         }
+        return sb.toString();
     }
 
     private String getAuthInfoAccessExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(
-                    PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_AIA) +
-                    "- " + mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
+        sb.append(pp.indent(mIndentSize) + mResource.getString(
+                PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_AIA) +
+                "- " + mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
+        }
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_ACCESS_DESC) + "\n");
+        AuthInfoAccessExtension aia = (AuthInfoAccessExtension) mExt;
+
+        for (int i = 0; i < aia.numberOfAccessDescription(); i++) {
+            AccessDescription ad = aia.getAccessDescription(i);
+            ObjectIdentifier method = ad.getMethod();
+
+            if (method.equals(AuthInfoAccessExtension.METHOD_OCSP)) {
+                sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
+                        "ocsp" + "\n");
             } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
+                sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
+                        method.toString() + "\n");
             }
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_ACCESS_DESC) + "\n");
-            AuthInfoAccessExtension aia = (AuthInfoAccessExtension) mExt;
-
-            for (int i = 0; i < aia.numberOfAccessDescription(); i++) {
-                AccessDescription ad = aia.getAccessDescription(i);
-                ObjectIdentifier method = ad.getMethod();
-
-                if (method.equals(AuthInfoAccessExtension.METHOD_OCSP)) {
-                    sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
-                            "ocsp" + "\n");
-                } else {
-                    sb.append(pp.indent(mIndentSize + 8) + "Method #" + i + ": " +
-                            method.toString() + "\n");
-                }
-                sb.append(pp.indent(mIndentSize + 8) + "Location #" + i + ": " +
-                        ad.getLocation().toString() + "\n");
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return sb.toString();
+            sb.append(pp.indent(mIndentSize + 8) + "Location #" + i + ": " +
+                    ad.getLocation().toString() + "\n");
         }
+        return sb.toString();
     }
 
     private String getPresenceServerExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(
-                    PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_PRESENCE_SERVER) +
-                    "- " + mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
-            }
-
-            PresenceServerExtension pse = (PresenceServerExtension) mExt;
-
-            sb.append(pp.indent(mIndentSize + 4) + "Version : " + pse.getVersion() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "Street Address : " + pse.getStreetAddress() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "Telephone Number : " + pse.getTelephoneNumber() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "RFC822 Name : " + pse.getRFC822() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "ID : " + pse.getID() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "Host Name : " + pse.getHostName() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "Port Number : " + pse.getPortNumber() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "Max Users : " + pse.getMaxUsers() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + "Service Level : " + pse.getServiceLevel() + "\n");
-
-            return sb.toString();
-        } catch (Exception e) {
-            return sb.toString();
+        sb.append(pp.indent(mIndentSize) + mResource.getString(
+                PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_PRESENCE_SERVER) +
+                "- " + mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
         }
+
+        PresenceServerExtension pse = (PresenceServerExtension) mExt;
+
+        sb.append(pp.indent(mIndentSize + 4) + "Version : " + pse.getVersion() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "Street Address : " + pse.getStreetAddress() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "Telephone Number : " + pse.getTelephoneNumber() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "RFC822 Name : " + pse.getRFC822() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "ID : " + pse.getID() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "Host Name : " + pse.getHostName() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "Port Number : " + pse.getPortNumber() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "Max Users : " + pse.getMaxUsers() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + "Service Level : " + pse.getServiceLevel() + "\n");
+
+        return sb.toString();
     }
 
     private String getPrivateKeyUsageExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(
-                    PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_PRIVATE_KEY_USAGE) +
-                    "- " + mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
-            }
+        sb.append(pp.indent(mIndentSize) + mResource.getString(
+                PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_PRIVATE_KEY_USAGE) +
+                "- " + mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
+        }
 
-            PrivateKeyUsageExtension usage = (PrivateKeyUsageExtension) mExt;
+        PrivateKeyUsageExtension usage = (PrivateKeyUsageExtension) mExt;
 
-            sb.append(pp.indent(mIndentSize + 4) + "Validity:\n");
+        sb.append(pp.indent(mIndentSize + 4) + "Validity:\n");
 
-            if (dateFormater == null) {
-                dateFormater = DateFormat.getDateInstance(DateFormat.FULL);
-            }
-            String notBefore = dateFormater.format(usage.getNotBefore());
-            String notAfter = dateFormater.format(usage.getNotAfter());
+        if (dateFormater == null) {
+            dateFormater = DateFormat.getDateInstance(DateFormat.FULL);
+        }
+        String notBefore = dateFormater.format(usage.getNotBefore());
+        String notAfter = dateFormater.format(usage.getNotAfter());
 
-            sb.append(pp.indent(mIndentSize + 8) + "Not Before: " + notBefore + "\n");
-            sb.append(pp.indent(mIndentSize + 8) + "Not  After: " + notAfter + "\n");
+        sb.append(pp.indent(mIndentSize + 8) + "Not Before: " + notBefore + "\n");
+        sb.append(pp.indent(mIndentSize + 8) + "Not  After: " + notAfter + "\n");
 
-            return sb.toString();
-        } catch (Exception e) {
-            return sb.toString();
-        }
+        return sb.toString();
     }
 
     private String getExtendedKeyUsageExtension() {
         StringBuffer sb = new StringBuffer();
+        sb.append(pp.indent(mIndentSize) + mResource.getString(
+                PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_EXTENDED_KEY_USAGE) +
+                "- " + mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
+        }
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_EXTENDED_KEY_USAGE) + "\n");
+        ExtendedKeyUsageExtension usage = (ExtendedKeyUsageExtension) mExt;
+        Enumeration<ObjectIdentifier> e = usage.getOIDs();
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(
-                    PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_EXTENDED_KEY_USAGE) +
-                    "- " + mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
-            }
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_EXTENDED_KEY_USAGE) + "\n");
-            ExtendedKeyUsageExtension usage = (ExtendedKeyUsageExtension) mExt;
-            Enumeration<ObjectIdentifier> e = usage.getOIDs();
+        if (e != null) {
+            while (e.hasMoreElements()) {
+                ObjectIdentifier oid = e.nextElement();
 
-            if (e != null) {
-                while (e.hasMoreElements()) {
-                    ObjectIdentifier oid = e.nextElement();
-
-                    if (oid.equals(ExtendedKeyUsageExtension.OID_OCSP_SIGNING)) {
-                        sb.append(pp.indent(mIndentSize + 8) + "OCSPSigning" + "\n");
-                    } else {
-                        sb.append(pp.indent(mIndentSize + 8) + oid.toString() + "\n");
-                    }
+                if (oid.equals(ExtendedKeyUsageExtension.OID_OCSP_SIGNING)) {
+                    sb.append(pp.indent(mIndentSize + 8) + "OCSPSigning" + "\n");
+                } else {
+                    sb.append(pp.indent(mIndentSize + 8) + oid.toString() + "\n");
                 }
             }
-            return sb.toString();
-        } catch (Exception e) {
-            return sb.toString();
         }
+        return sb.toString();
     }
 
     /**
@@ -572,7 +550,8 @@ public class ExtPrettyPrint {
                 sb.append(pp.indent(mIndentSize + 8) + mResource.getString(KeyUsageExtension.DECIPHER_ONLY) + "\n");
             }
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
+            e.printStackTrace();
             return sb.toString();
         }
 
@@ -620,7 +599,8 @@ public class ExtPrettyPrint {
                         + mResource.getString(NSCertTypeExtension.OBJECT_SIGNING_CA) + "\n");
             }
             return sb.toString();
-        } catch (Exception e) {
+        } catch (CertificateException e) {
+            e.printStackTrace();
             return "";
         }
 
@@ -650,7 +630,8 @@ public class ExtPrettyPrint {
                 sb.append(pp.toHexString(keyId.getIdentifier(), 24, 16));
             }
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
+            e.printStackTrace();
             return "";
         }
     }
@@ -700,7 +681,8 @@ public class ExtPrettyPrint {
                         "0x" + serial.getNumber().toBigInteger().toString(16).toUpperCase() + "\n");
             }
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
+            e.printStackTrace();
             return "";
         }
     }
@@ -737,29 +719,25 @@ public class ExtPrettyPrint {
      */
     private String getInhibitAnyPolicyExtension() {
         StringBuffer sb = new StringBuffer();
-        try {
-            sb.append(pp.indent(mIndentSize) +
-                    mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(pp.indent(mIndentSize) +
+                mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(
+                PrettyPrintResources.TOKEN_INHIBIT_ANY_POLICY_EXT) + "- " +
+                mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) +
+                mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
+        InhibitAnyPolicyExtension ext = (InhibitAnyPolicyExtension) mExt;
+        if (mExt.isCritical())
             sb.append(mResource.getString(
-                    PrettyPrintResources.TOKEN_INHIBIT_ANY_POLICY_EXT) + "- " +
-                    mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) +
-                    mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
-            InhibitAnyPolicyExtension ext = (InhibitAnyPolicyExtension) mExt;
-            if (mExt.isCritical())
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
-            else
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_SKIP_CERTS));
-            BigInt num = ext.getSkipCerts();
-            sb.append("" + num.toInt() + "\n");
-            return sb.toString();
-        } catch (Exception e) {
-            return "";
-        }
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        else
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_SKIP_CERTS));
+        BigInt num = ext.getSkipCerts();
+        sb.append("" + num.toInt() + "\n");
+        return sb.toString();
     }
 
     /**
@@ -805,7 +783,8 @@ public class ExtPrettyPrint {
             }
 
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
+            e.printStackTrace();
             return "";
         }
     }
@@ -912,7 +891,7 @@ public class ExtPrettyPrint {
             }
 
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
             return "";
         }
     }
@@ -952,7 +931,8 @@ public class ExtPrettyPrint {
             }
 
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
+            e.printStackTrace();
             return "";
         }
     }
@@ -962,47 +942,42 @@ public class ExtPrettyPrint {
      */
     private String getCertificateScopeOfUseExtension() {
         StringBuffer sb = new StringBuffer();
+        sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_CERT_SCOPE_OF_USE) + "- " +
+                mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
+        CertificateScopeOfUseExtension ext = (CertificateScopeOfUseExtension) mExt;
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_CERT_SCOPE_OF_USE) + "- " +
-                    mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
-            CertificateScopeOfUseExtension ext = (CertificateScopeOfUseExtension) mExt;
-
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
-            }
-            Vector<CertificateScopeEntry> entries = ext.getCertificateScopeEntries();
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
+        }
+        Vector<CertificateScopeEntry> entries = ext.getCertificateScopeEntries();
 
-            if (entries != null) {
-                sb.append(pp.indent(mIndentSize + 4) +
-                        mResource.getString(PrettyPrintResources.TOKEN_SCOPE_OF_USE) + "\n");
-                for (int i = 0; i < entries.size(); i++) {
-                    CertificateScopeEntry se = entries.elementAt(i);
-                    GeneralName gn = se.getGeneralName();
+        if (entries != null) {
+            sb.append(pp.indent(mIndentSize + 4) +
+                    mResource.getString(PrettyPrintResources.TOKEN_SCOPE_OF_USE) + "\n");
+            for (int i = 0; i < entries.size(); i++) {
+                CertificateScopeEntry se = entries.elementAt(i);
+                GeneralName gn = se.getGeneralName();
 
-                    if (gn != null) {
-                        String nameType = "";
+                if (gn != null) {
+                    String nameType = "";
 
-                        if (gn.getType() == GeneralNameInterface.NAME_DIRECTORY)
-                            nameType = "DirectoryName: ";
-                        sb.append(pp.indent(mIndentSize + 8) + nameType + gn.toString() + "\n");
-                    }
-                    BigInt port = se.getPort();
+                    if (gn.getType() == GeneralNameInterface.NAME_DIRECTORY)
+                        nameType = "DirectoryName: ";
+                    sb.append(pp.indent(mIndentSize + 8) + nameType + gn.toString() + "\n");
+                }
+                BigInt port = se.getPort();
 
-                    if (port != null) {
-                        sb.append(pp.indent(mIndentSize + 8) + PrettyPrintResources.TOKEN_PORT +
-                                port.toBigInteger().toString() + "\n");
-                    }
+                if (port != null) {
+                    sb.append(pp.indent(mIndentSize + 8) + PrettyPrintResources.TOKEN_PORT +
+                            port.toBigInteger().toString() + "\n");
                 }
             }
-            return sb.toString();
-        } catch (Exception e) {
-            return "";
         }
+        return sb.toString();
     }
 
     /**
@@ -1011,97 +986,92 @@ public class ExtPrettyPrint {
     private String getFreshestCRLExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-
-            //
-            // Generic stuff: name, OID, criticality
-            //
-            sb.append(pp.indent(mIndentSize) +
-                    mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        //
+        // Generic stuff: name, OID, criticality
+        //
+        sb.append(pp.indent(mIndentSize) +
+                mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(
+                PrettyPrintResources.TOKEN_FRESHEST_CRL_EXT) + "- " +
+                mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) +
+                mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
             sb.append(mResource.getString(
-                    PrettyPrintResources.TOKEN_FRESHEST_CRL_EXT) + "- " +
-                    mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) +
-                    mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
-            }
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
+        }
+
+        //
+        // Now the CRLDP-specific stuff
+        //
+        FreshestCRLExtension ext = (FreshestCRLExtension) mExt;
+
+        int numPoints = ext.getNumPoints();
+
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRLDP_NUMPOINTS)
+                + numPoints + "\n");
+
+        for (int i = 0; i < numPoints; i++) {
 
             //
-            // Now the CRLDP-specific stuff
+            // print one individual CRL distribution point
             //
-            FreshestCRLExtension ext = (FreshestCRLExtension) mExt;
 
-            int numPoints = ext.getNumPoints();
+            int idt;
 
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRLDP_NUMPOINTS)
-                    + numPoints + "\n");
+            idt = mIndentSize + 4; // reset each time through loop
+            boolean isEmpty = true;
 
-            for (int i = 0; i < numPoints; i++) {
+            sb.append(pp.indent(idt) +
+                    mResource.getString(PrettyPrintResources.TOKEN_CRLDP_POINTN) +
+                    i + "\n");
 
-                //
-                // print one individual CRL distribution point
-                //
+            CRLDistributionPoint pt = ext.getPointAt(i);
 
-                int idt;
+            idt += 4; // further indent rest of information
 
-                idt = mIndentSize + 4; // reset each time through loop
-                boolean isEmpty = true;
+            if (pt.getFullName() != null) {
+                isEmpty = false;
+                sb.append(pp.indent(idt) +
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
+                        + pt.getFullName() + "\n");
+            }
+
+            if (pt.getRelativeName() != null) {
+                isEmpty = false;
+                sb.append(pp.indent(idt) +
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
+                        + pt.getRelativeName() + "\n");
+            }
+
+            if (pt.getReasons() != null) {
+                isEmpty = false;
+                byte[] reasonBits = pt.getReasons().toByteArray();
+                String reasonList = reasonBitsToReasonList(reasonBits);
 
                 sb.append(pp.indent(idt) +
-                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_POINTN) +
-                        i + "\n");
-
-                CRLDistributionPoint pt = ext.getPointAt(i);
-
-                idt += 4; // further indent rest of information
-
-                if (pt.getFullName() != null) {
-                    isEmpty = false;
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
-                            + pt.getFullName() + "\n");
-                }
-
-                if (pt.getRelativeName() != null) {
-                    isEmpty = false;
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
-                            + pt.getRelativeName() + "\n");
-                }
-
-                if (pt.getReasons() != null) {
-                    isEmpty = false;
-                    byte[] reasonBits = pt.getReasons().toByteArray();
-                    String reasonList = reasonBitsToReasonList(reasonBits);
-
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_REASONS)
-                            + reasonList + "\n");
-                }
-
-                if (pt.getCRLIssuer() != null) {
-                    isEmpty = false;
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_CRLISSUER)
-                            + pt.getCRLIssuer() + "\n");
-                }
-
-                if (isEmpty) {
-                    sb.append(pp.indent(idt) + "<i>empty</i>\n");
-                }
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_REASONS)
+                        + reasonList + "\n");
+            }
 
+            if (pt.getCRLIssuer() != null) {
+                isEmpty = false;
+                sb.append(pp.indent(idt) +
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_CRLISSUER)
+                        + pt.getCRLIssuer() + "\n");
+            }
+
+            if (isEmpty) {
+                sb.append(pp.indent(idt) + "<i>empty</i>\n");
             }
 
-            return sb.toString();
-        } catch (Exception e) {
-            return "";
         }
+
+        return sb.toString();
     }
 
     /**
@@ -1110,98 +1080,93 @@ public class ExtPrettyPrint {
     private String getCRLDistributionPointsExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-
-            //
-            // Generic stuff: name, OID, criticality
-            //
-            sb.append(pp.indent(mIndentSize) +
-                    mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        //
+        // Generic stuff: name, OID, criticality
+        //
+        sb.append(pp.indent(mIndentSize) +
+                mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(
+                PrettyPrintResources.TOKEN_CRL_DP_EXT) + "- " +
+                mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) +
+                mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
             sb.append(mResource.getString(
-                    PrettyPrintResources.TOKEN_CRL_DP_EXT) + "- " +
-                    mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) +
-                    mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(
-                        PrettyPrintResources.TOKEN_NO) + "\n");
-            }
+                    PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(
+                    PrettyPrintResources.TOKEN_NO) + "\n");
+        }
+
+        //
+        // Now the CRLDP-specific stuff
+        //
+        CRLDistributionPointsExtension ext =
+                (CRLDistributionPointsExtension) mExt;
+
+        int numPoints = ext.getNumPoints();
+
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRLDP_NUMPOINTS)
+                + numPoints + "\n");
+
+        for (int i = 0; i < numPoints; i++) {
 
             //
-            // Now the CRLDP-specific stuff
+            // print one individual CRL distribution point
             //
-            CRLDistributionPointsExtension ext =
-                    (CRLDistributionPointsExtension) mExt;
 
-            int numPoints = ext.getNumPoints();
+            int idt;
 
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRLDP_NUMPOINTS)
-                    + numPoints + "\n");
+            idt = mIndentSize + 4; // reset each time through loop
+            boolean isEmpty = true;
 
-            for (int i = 0; i < numPoints; i++) {
+            sb.append(pp.indent(idt) +
+                    mResource.getString(PrettyPrintResources.TOKEN_CRLDP_POINTN) +
+                    i + "\n");
 
-                //
-                // print one individual CRL distribution point
-                //
+            CRLDistributionPoint pt = ext.getPointAt(i);
 
-                int idt;
+            idt += 4; // further indent rest of information
 
-                idt = mIndentSize + 4; // reset each time through loop
-                boolean isEmpty = true;
+            if (pt.getFullName() != null) {
+                isEmpty = false;
+                sb.append(pp.indent(idt) +
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
+                        + pt.getFullName() + "\n");
+            }
+
+            if (pt.getRelativeName() != null) {
+                isEmpty = false;
+                sb.append(pp.indent(idt) +
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
+                        + pt.getRelativeName() + "\n");
+            }
+
+            if (pt.getReasons() != null) {
+                isEmpty = false;
+                byte[] reasonBits = pt.getReasons().toByteArray();
+                String reasonList = reasonBitsToReasonList(reasonBits);
 
                 sb.append(pp.indent(idt) +
-                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_POINTN) +
-                        i + "\n");
-
-                CRLDistributionPoint pt = ext.getPointAt(i);
-
-                idt += 4; // further indent rest of information
-
-                if (pt.getFullName() != null) {
-                    isEmpty = false;
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
-                            + pt.getFullName() + "\n");
-                }
-
-                if (pt.getRelativeName() != null) {
-                    isEmpty = false;
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT)
-                            + pt.getRelativeName() + "\n");
-                }
-
-                if (pt.getReasons() != null) {
-                    isEmpty = false;
-                    byte[] reasonBits = pt.getReasons().toByteArray();
-                    String reasonList = reasonBitsToReasonList(reasonBits);
-
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_REASONS)
-                            + reasonList + "\n");
-                }
-
-                if (pt.getCRLIssuer() != null) {
-                    isEmpty = false;
-                    sb.append(pp.indent(idt) +
-                            mResource.getString(PrettyPrintResources.TOKEN_CRLDP_CRLISSUER)
-                            + pt.getCRLIssuer() + "\n");
-                }
-
-                if (isEmpty) {
-                    sb.append(pp.indent(idt) + "<i>empty</i>\n");
-                }
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_REASONS)
+                        + reasonList + "\n");
+            }
 
+            if (pt.getCRLIssuer() != null) {
+                isEmpty = false;
+                sb.append(pp.indent(idt) +
+                        mResource.getString(PrettyPrintResources.TOKEN_CRLDP_CRLISSUER)
+                        + pt.getCRLIssuer() + "\n");
+            }
+
+            if (isEmpty) {
+                sb.append(pp.indent(idt) + "<i>empty</i>\n");
             }
 
-            return sb.toString();
-        } catch (Exception e) {
-            return "";
         }
+
+        return sb.toString();
     }
 
     private static String reasonBitsToReasonList(byte[] reasonBits) {
@@ -1228,78 +1193,74 @@ public class ExtPrettyPrint {
     private String getIssuingDistributionPointExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_ISSUING_DIST_POINT) + "- " +
-                    mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
-            }
+        sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_ISSUING_DIST_POINT) + "- " +
+                mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
+        }
 
-            IssuingDistributionPointExtension ext = (IssuingDistributionPointExtension) mExt;
-            IssuingDistributionPoint issuingDistributionPoint = ext.getIssuingDistributionPoint();
+        IssuingDistributionPointExtension ext = (IssuingDistributionPointExtension) mExt;
+        IssuingDistributionPoint issuingDistributionPoint = ext.getIssuingDistributionPoint();
 
-            if (issuingDistributionPoint != null) {
-                GeneralNames fullNames = issuingDistributionPoint.getFullName();
-                RDN relativeName = issuingDistributionPoint.getRelativeName();
+        if (issuingDistributionPoint != null) {
+            GeneralNames fullNames = issuingDistributionPoint.getFullName();
+            RDN relativeName = issuingDistributionPoint.getRelativeName();
 
-                if (fullNames != null || relativeName != null) {
-                    sb.append(pp.indent(mIndentSize + 4)
-                            + mResource.getString(PrettyPrintResources.TOKEN_DIST_POINT_NAME) + "\n");
-                    if (fullNames != null) {
-                        sb.append(pp.indent(mIndentSize + 8)
-                                + mResource.getString(PrettyPrintResources.TOKEN_FULL_NAME) + "\n");
-                        for (int i = 0; i < fullNames.size(); i++) {
-                            GeneralName fullName = (GeneralName) fullNames.elementAt(i);
+            if (fullNames != null || relativeName != null) {
+                sb.append(pp.indent(mIndentSize + 4)
+                        + mResource.getString(PrettyPrintResources.TOKEN_DIST_POINT_NAME) + "\n");
+                if (fullNames != null) {
+                    sb.append(pp.indent(mIndentSize + 8)
+                            + mResource.getString(PrettyPrintResources.TOKEN_FULL_NAME) + "\n");
+                    for (int i = 0; i < fullNames.size(); i++) {
+                        GeneralName fullName = (GeneralName) fullNames.elementAt(i);
 
-                            if (fullName != null) {
-                                sb.append(pp.indent(mIndentSize + 12) + fullName.toString() + "\n");
-                            }
+                        if (fullName != null) {
+                            sb.append(pp.indent(mIndentSize + 12) + fullName.toString() + "\n");
                         }
                     }
-                    if (relativeName != null) {
-                        sb.append(pp.indent(mIndentSize + 8)
-                                + mResource.getString(PrettyPrintResources.TOKEN_RELATIVE_NAME) +
-                                relativeName.toString() + "\n");
-                    }
                 }
-
-                sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_ONLY_USER_CERTS));
-                if (issuingDistributionPoint.getOnlyContainsUserCerts()) {
-                    sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
-                } else {
-                    sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
-                }
-                sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_ONLY_CA_CERTS));
-                if (issuingDistributionPoint.getOnlyContainsCACerts()) {
-                    sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
-                } else {
-                    sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
+                if (relativeName != null) {
+                    sb.append(pp.indent(mIndentSize + 8)
+                            + mResource.getString(PrettyPrintResources.TOKEN_RELATIVE_NAME) +
+                            relativeName.toString() + "\n");
                 }
+            }
 
-                BitArray onlySomeReasons = issuingDistributionPoint.getOnlySomeReasons();
+            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_ONLY_USER_CERTS));
+            if (issuingDistributionPoint.getOnlyContainsUserCerts()) {
+                sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
+            } else {
+                sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
+            }
+            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_ONLY_CA_CERTS));
+            if (issuingDistributionPoint.getOnlyContainsCACerts()) {
+                sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
+            } else {
+                sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
+            }
 
-                if (onlySomeReasons != null) {
-                    sb.append(pp.indent(mIndentSize + 4)
-                            + mResource.getString(PrettyPrintResources.TOKEN_ONLY_SOME_REASONS));
-                    sb.append("0x" + pp.toHexString(onlySomeReasons.toByteArray()));
-                }
+            BitArray onlySomeReasons = issuingDistributionPoint.getOnlySomeReasons();
 
-                sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_INDIRECT_CRL));
-                if (issuingDistributionPoint.getIndirectCRL()) {
-                    sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
-                } else {
-                    sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
-                }
+            if (onlySomeReasons != null) {
+                sb.append(pp.indent(mIndentSize + 4)
+                        + mResource.getString(PrettyPrintResources.TOKEN_ONLY_SOME_REASONS));
+                sb.append("0x" + pp.toHexString(onlySomeReasons.toByteArray()));
             }
 
-            return sb.toString();
-        } catch (Exception e) {
-            return "";
+            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_INDIRECT_CRL));
+            if (issuingDistributionPoint.getIndirectCRL()) {
+                sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
+            } else {
+                sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
+            }
         }
+
+        return sb.toString();
     }
 
     /**
@@ -1372,7 +1333,8 @@ public class ExtPrettyPrint {
             }
 
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
+            e.printStackTrace();
             return "";
         }
     }
@@ -1457,50 +1419,46 @@ public class ExtPrettyPrint {
     private String getPolicyMappingsExtension() {
         StringBuffer sb = new StringBuffer();
 
-        try {
-            sb.append(pp.indent(mIndentSize) + mResource.getString(
-                    PrettyPrintResources.TOKEN_IDENTIFIER));
-            sb.append(mResource.getString(PrettyPrintResources.TOKEN_POLICY_MAPPINGS) +
-                    "- " + mExt.getExtensionId().toString() + "\n");
-            sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
-                    PrettyPrintResources.TOKEN_CRITICAL));
-            if (mExt.isCritical()) {
-                sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
-            } else {
-                sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
-            }
+        sb.append(pp.indent(mIndentSize) + mResource.getString(
+                PrettyPrintResources.TOKEN_IDENTIFIER));
+        sb.append(mResource.getString(PrettyPrintResources.TOKEN_POLICY_MAPPINGS) +
+                "- " + mExt.getExtensionId().toString() + "\n");
+        sb.append(pp.indent(mIndentSize + 4) + mResource.getString(
+                PrettyPrintResources.TOKEN_CRITICAL));
+        if (mExt.isCritical()) {
+            sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
+        } else {
+            sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
+        }
 
-            PolicyMappingsExtension ext = (PolicyMappingsExtension) mExt;
-            Enumeration<CertificatePolicyMap> maps = ext.getMappings();
+        PolicyMappingsExtension ext = (PolicyMappingsExtension) mExt;
+        Enumeration<CertificatePolicyMap> maps = ext.getMappings();
 
-            sb.append(pp.indent(mIndentSize + 4) +
-                    mResource.getString(PrettyPrintResources.TOKEN_MAPPINGS));
-            if (maps == null || !maps.hasMoreElements()) {
-                sb.append(
-                        mResource.getString(PrettyPrintResources.TOKEN_NONE) + "\n");
-            } else {
-                sb.append("\n");
-                for (int i = 0; maps.hasMoreElements(); i++) {
-                    sb.append(pp.indent(mIndentSize + 8) +
-                            mResource.getString(
-                                    PrettyPrintResources.TOKEN_MAP) + i + ":" + "\n");
-                    CertificatePolicyMap m =
-                            maps.nextElement();
+        sb.append(pp.indent(mIndentSize + 4) +
+                mResource.getString(PrettyPrintResources.TOKEN_MAPPINGS));
+        if (maps == null || !maps.hasMoreElements()) {
+            sb.append(
+                    mResource.getString(PrettyPrintResources.TOKEN_NONE) + "\n");
+        } else {
+            sb.append("\n");
+            for (int i = 0; maps.hasMoreElements(); i++) {
+                sb.append(pp.indent(mIndentSize + 8) +
+                        mResource.getString(
+                                PrettyPrintResources.TOKEN_MAP) + i + ":" + "\n");
+                CertificatePolicyMap m =
+                        maps.nextElement();
 
-                    sb.append(pp.indent(mIndentSize + 12) +
-                            mResource.getString(
-                                    PrettyPrintResources.TOKEN_ISSUER_DOMAIN_POLICY) +
-                            m.getIssuerIdentifier().getIdentifier().toString() + "\n");
-                    sb.append(pp.indent(mIndentSize + 12) +
-                            mResource.getString(
-                                    PrettyPrintResources.TOKEN_SUBJECT_DOMAIN_POLICY) +
-                            m.getSubjectIdentifier().getIdentifier().toString() + "\n");
-                }
+                sb.append(pp.indent(mIndentSize + 12) +
+                        mResource.getString(
+                                PrettyPrintResources.TOKEN_ISSUER_DOMAIN_POLICY) +
+                        m.getIssuerIdentifier().getIdentifier().toString() + "\n");
+                sb.append(pp.indent(mIndentSize + 12) +
+                        mResource.getString(
+                                PrettyPrintResources.TOKEN_SUBJECT_DOMAIN_POLICY) +
+                        m.getSubjectIdentifier().getIdentifier().toString() + "\n");
             }
-            return sb.toString();
-        } catch (Throwable e) {
-            return "";
         }
+        return sb.toString();
     }
 
     /**
@@ -1642,7 +1600,7 @@ public class ExtPrettyPrint {
                 }
             }
             return sb.toString();
-        } catch (Exception e) {
+        } catch (IOException e) {
             return sb.toString();
         }
     }
diff --git a/base/util/src/netscape/security/util/PubKeyPrettyPrint.java b/base/util/src/netscape/security/util/PubKeyPrettyPrint.java
index 88fcdddb559d56ef77b20e62a461ee3401be55df..21fc1f4468e083e4a20ce88fcff7524f67b1907f 100644
--- a/base/util/src/netscape/security/util/PubKeyPrettyPrint.java
+++ b/base/util/src/netscape/security/util/PubKeyPrettyPrint.java
@@ -17,6 +17,7 @@
 // --- END COPYRIGHT BLOCK ---
 package netscape.security.util;
 
+import java.security.InvalidKeyException;
 import java.security.PublicKey;
 import java.util.Locale;
 import java.util.ResourceBundle;
@@ -113,7 +114,8 @@ public class PubKeyPrettyPrint {
                 sb.append(pp.toHexString(mX509Key.getKey(), indentSize + 4, lineLen));
             }
 
-        } catch (Exception e) {
+        } catch(InvalidKeyException e){
+            e.printStackTrace();
         }
 
         return sb.toString();
diff --git a/base/util/src/netscape/security/x509/CRLDistributionPoint.java b/base/util/src/netscape/security/x509/CRLDistributionPoint.java
index 435392de78e4aef2ac61fd1eaed3cdbef71863e2..637ee57febe0f5af8bfe0a29c12c4f33b8169e2f 100644
--- a/base/util/src/netscape/security/x509/CRLDistributionPoint.java
+++ b/base/util/src/netscape/security/x509/CRLDistributionPoint.java
@@ -251,7 +251,7 @@ public class CRLDistributionPoint implements ASN1Value {
         return templateInstance;
     }
 
-    public static void main(String args[]) {
+    public static void main(String args[]) throws Exception {
         ByteArrayOutputStream bos = null;
         FileOutputStream fos = null;
         try {
@@ -339,13 +339,13 @@ public class CRLDistributionPoint implements ASN1Value {
 
         } catch (Exception e) {
             e.printStackTrace();
+            throw e;
         } finally {
             if (bos != null) {
-                try {
-                    bos.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
+                bos.close();
+            }
+            if (fos != null) {
+                fos.close();
             }
             if (fos != null) {
                 try {
diff --git a/base/util/src/netscape/security/x509/X509CertImpl.java b/base/util/src/netscape/security/x509/X509CertImpl.java
index 05de623ce4e05005a333657a524ecd6ba92ed62b..b6d97da3868b659bf615eba623e4868d5b64e4b1 100755
--- a/base/util/src/netscape/security/x509/X509CertImpl.java
+++ b/base/util/src/netscape/security/x509/X509CertImpl.java
@@ -976,6 +976,7 @@ public class X509CertImpl extends X509Certificate
      * @param oid the Object Identifier value for the extension.
      */
     public byte[] getExtensionValue(String oid) {
+        DerOutputStream out = null;
         try {
             String extAlias = OIDMap.getName(new ObjectIdentifier(oid));
             Extension certExt = null;
@@ -1008,11 +1009,19 @@ public class X509CertImpl extends X509Certificate
             if (extData == null)
                 return null;
 
-            DerOutputStream out = new DerOutputStream();
+            out = new DerOutputStream();
             out.putOctetString(extData);
             return out.toByteArray();
         } catch (Exception e) {
             return null;
+        } finally {
+            if (out != null) {
+                try {
+                    out.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
         }
     }
 
diff --git a/base/util/src/netscape/security/x509/X509CertInfo.java b/base/util/src/netscape/security/x509/X509CertInfo.java
index 0c44e2c92b2ac7ae9eb8a1e4d38ba2781bfcc12f..6ad4d243fb47a5cf14f1cfe808ba1c023dd80a1d 100644
--- a/base/util/src/netscape/security/x509/X509CertInfo.java
+++ b/base/util/src/netscape/security/x509/X509CertInfo.java
@@ -352,12 +352,13 @@ public class X509CertInfo implements CertAttrSet, Serializable {
             for (int i = 0; i < extensions.size(); i++) {
                 sb.append("  Extension[" + i + "] = ");
                 Extension ext = extensions.elementAt(i);
+                DerOutputStream out = null;
                 try {
                     if (OIDMap.getClass(ext.getExtensionId()) == null) {
                         sb.append(ext.toString());
                         byte[] extValue = ext.getExtensionValue();
                         if (extValue != null) {
-                            DerOutputStream out = new DerOutputStream();
+                            out = new DerOutputStream();
                             out.putOctetString(extValue);
                             extValue = out.toByteArray();
                             String extValuebits = pp.toHexString(extValue);
@@ -367,8 +368,18 @@ public class X509CertInfo implements CertAttrSet, Serializable {
                         }
                     } else
                         sb.append(ext.toString()); //sub-class exists
-                } catch (Exception e) {
+                } catch (CertificateException e) {
                     sb.append(", Error parsing this extension");
+                } catch (IOException e) {
+                    sb.append(", Error parsing this extension");
+                } finally {
+                    if (out != null) {
+                        try {
+                            out.close();
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                    }
                 }
             }
         }
-- 
1.7.10.2

