From ff173996b9a7d2eedb5a31f8235e0de3b9c1adda Mon Sep 17 00:00:00 2001 From: Adam Young Date: Wed, 16 Nov 2011 10:44:12 -0500 Subject: Unreachable Catch clauses In each of the cases, more specific exceptions would be caught, masking these more generic exception. --- .../publish/publishers/LdapCertSubjPublisher.java | 4 --- .../netscape/cms/servlet/admin/AdminServlet.java | 29 ---------------------- .../netscape/cmscore/ldap/LdapPublishModule.java | 10 -------- .../netscape/cmscore/security/JssSubsystem.java | 3 --- .../cmscore/selftests/SelfTestSubsystem.java | 11 -------- 5 files changed, 57 deletions(-) (limited to 'pki/base') diff --git a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java index 0c596f3b0..50cfd7c5a 100644 --- a/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java +++ b/pki/base/common/src/com/netscape/cms/publish/publishers/LdapCertSubjPublisher.java @@ -317,10 +317,6 @@ public class LdapCertSubjPublisher implements ILdapPublisher { } catch (CertificateEncodingException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_UNPUBLISH_ERROR", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_GET_DER_ENCODED_CERT_FAILED", e.toString())); - } catch (CertificateException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_UNPUBLISH_ERROR", e.toString())); - throw new ELdapException( - CMS.getUserMessage("CMS_LDAP_DECODING_CERT_FAILED", e.toString())); } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_UNPUBLISH_ERROR", e.toString())); throw new ELdapException(CMS.getUserMessage("CMS_LDAP_GET_LDAP_DN_STRING_FAILED", e.toString())); 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 089967344..0f2a6ec71 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 @@ -539,35 +539,6 @@ public class AdminServlet extends HttpServlet { audit(auditMessage); } - throw new IOException("authentication failed"); - } catch (EBaseException e) { - mLogger.log(ILogger.EV_SYSTEM, ILogger.S_OTHER, - ILogger.LL_FAILURE, - CMS.getLogMessage("ADMIN_SRVLT_ERROR", - e.toString())); - - if (authType.equals("sslclientauth")) { - // store a message in the signed audit log file - auditMessage = CMS.getLogMessage( - LOGGING_SIGNED_AUDIT_AUTH_FAIL, - ILogger.UNIDENTIFIED, - ILogger.FAILURE, - CERTUSERDB, - auditUID); - - audit(auditMessage); - } else { - // store a message in the signed audit log file - auditMessage = CMS.getLogMessage( - LOGGING_SIGNED_AUDIT_AUTH_FAIL, - ILogger.UNIDENTIFIED, - ILogger.FAILURE, - PASSWDUSERDB, - auditUID); - - audit(auditMessage); - } - throw new IOException("authentication failed"); } diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java index 8e890f06b..e9839f595 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java @@ -726,11 +726,6 @@ class HandleRevocation implements IRequestListener { mModule.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_UNPUBLISH", cert.getSerialNumber().toString(16), e.getMessage())); - } catch (EBaseException e) { - error = true; - mModule.log(ILogger.LL_FAILURE, - CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_FIND", - cert.getSerialNumber().toString(16), e.getMessage())); } } r.setExtData("ldapPublishStatus", results); @@ -794,11 +789,6 @@ class HandleUnrevocation implements IRequestListener { mModule.log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_UNPUBLISH", certs[i].getSerialNumber().toString(16), e.getMessage())); - } catch (EBaseException e) { - error = true; - mModule.log(ILogger.LL_FAILURE, - CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_FIND", - certs[i].getSerialNumber().toString(16), e.getMessage())); } } r.setExtData("ldapPublishStatus", results); diff --git a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java index d0df7d1a9..f15a4bc21 100644 --- a/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/security/JssSubsystem.java @@ -1719,9 +1719,6 @@ CMS.debug("*** removing this interna cert"); } catch (IOException e) { log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_SECURITY_DELETE_CERT", e.toString())); throw new EBaseException(CMS.getUserMessage("CMS_BASE_CERT_ERROR", e.toString())); - } catch (CertificateException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_SECURITY_DELETE_CERT", e.toString())); - throw new EBaseException(CMS.getUserMessage("CMS_BASE_CERT_ERROR", e.toString())); } } diff --git a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java index 209be47df..ba3a8d550 100644 --- a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java @@ -952,17 +952,6 @@ public class SelfTestSubsystem // rethrow the specific exception to be handled later throw eAudit1; - } catch (ESelfTestException eAudit2) { - // store a message in the signed audit log file - auditMessage = CMS.getLogMessage( - LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION, - ILogger.SYSTEM_UID, - ILogger.FAILURE); - - audit(auditMessage); - - // rethrow the specific exception to be handled later - throw eAudit2; } } -- cgit