From 73f760492004dcf9899c7da857e40fdc5fd9a67d Mon Sep 17 00:00:00 2001 From: j2blake Date: Wed, 15 Jan 2014 15:29:08 -0500 Subject: [PATCH] VIVO-673 Log throwables and re-throw them. If a startup module throws an error, StartupManager will catch it only long enough to write it to the log, and then re-throw it. --- .../mannlib/vitro/webapp/startup/StartupManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/startup/StartupManager.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/startup/StartupManager.java index a3a6f76e2..20bf0f34c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/startup/StartupManager.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/startup/StartupManager.java @@ -69,6 +69,9 @@ public class StartupManager implements ServletContextListener { } catch (Exception e) { ss.fatal(this, "Startup threw an unexpected exception.", e); log.error("Startup threw an unexpected exception.", e); + } catch (Throwable t) { + log.fatal("Startup threw an unexpected error.", t); + throw t; } } @@ -177,6 +180,9 @@ public class StartupManager implements ServletContextListener { ss.listenerExecuted(listener); } catch (Exception e) { ss.fatal(listener, "Threw unexpected exception", e); + } catch (Throwable t) { + log.fatal(listener + " Threw unexpected error", t); + throw t; } } @@ -214,6 +220,10 @@ public class StartupManager implements ServletContextListener { } catch (Exception e) { log.error("Unexpected exception from contextDestroyed() on '" + listener.getClass().getName() + "'", e); + } catch (Throwable t) { + log.fatal("Unexpected error from contextDestroyed() on '" + + listener.getClass().getName() + "'", t); + throw t; } } log.info("Called 'contextDestroyed' on all listeners.");