Catch Exception and log error when cert alias is specified that doesn't exist in...
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 10 Apr 2003 17:55:20 +0000 (17:55 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 10 Apr 2003 17:55:20 +0000 (17:55 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@562 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/hs/HandleServlet.java

index da49c80..70aef48 100644 (file)
@@ -226,12 +226,26 @@ public class HandleServlet extends HttpServlet {
                                certificates =
                                        keyStore.getCertificateChain(
                                                configuration.getProperty("edu.internet2.middleware.shibboleth.hs.HandleServlet.certAlias"));
+                               if (certificates == null) {
+                                       throw new HSConfigurationException(
+                                               "An error occurred while reading the java keystore: No certificate found with the specified alias ("
+                                                       + configuration.getProperty("edu.internet2.middleware.shibboleth.hs.HandleServlet.certAlias")
+                                                       + ").");
+                               }
                        } else {
                                certificates =
                                        keyStore.getCertificateChain(
                                                configuration.getProperty(
                                                        "edu.internet2.middleware.shibboleth.hs.HandleServlet.keyStoreKeyAlias"));
+                               if (certificates == null) {
+                                       throw new HSConfigurationException(
+                                               "An error occurred while reading the java keystore: No certificate found with the specified alias ("
+                                                       + configuration.getProperty(
+                                                               "edu.internet2.middleware.shibboleth.hs.HandleServlet.keyStoreKeyAlias")
+                                                       + ").");
+                               }
                        }
+
                } catch (KeyStoreException e) {
                        throw new HSConfigurationException("An error occurred while accessing the java keystore: " + e);
                } catch (NoSuchAlgorithmException e) {