From 95159ed298362b56aa499171636e358fb422d81b Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Sat, 17 Dec 2016 10:41:37 -0700 Subject: [PATCH 1/2] Added logging exception resolver Signed-off-by: Andrew DeMaria --- .../spring/LoggingExceptionResolver.java | 26 +++++++++++++++++++ .../webapp/WEB-INF/libresonic-servlet.xml | 1 + 2 files changed, 27 insertions(+) create mode 100644 libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java diff --git a/libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java b/libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java new file mode 100644 index 00000000..14c753a4 --- /dev/null +++ b/libresonic-main/src/main/java/org/libresonic/player/spring/LoggingExceptionResolver.java @@ -0,0 +1,26 @@ +package org.libresonic.player.spring; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.libresonic.player.Logger; +import org.springframework.core.Ordered; +import org.springframework.web.servlet.HandlerExceptionResolver; +import org.springframework.web.servlet.ModelAndView; + +public class LoggingExceptionResolver implements HandlerExceptionResolver, Ordered { + + private static final Logger logger = Logger.getLogger(LoggingExceptionResolver.class); + + @Override + public ModelAndView resolveException( + HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e + ) { + logger.error("Exception occurred", e); + return null; + } + + @Override + public int getOrder() { + return Integer.MIN_VALUE; + } +} diff --git a/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml b/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml index 3c44ef8b..d4295b1d 100644 --- a/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml +++ b/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml @@ -398,4 +398,5 @@ + From 5ba7e77e11ff5441e8b507755c0787db485a6d27 Mon Sep 17 00:00:00 2001 From: Andrew DeMaria Date: Sun, 18 Dec 2016 19:58:26 -0700 Subject: [PATCH 2/2] Fix build dependency Signed-off-by: Andrew DeMaria --- libresonic-main/pom.xml | 4 ++++ pom.xml | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/libresonic-main/pom.xml b/libresonic-main/pom.xml index 910b1119..d26d8cc8 100644 --- a/libresonic-main/pom.xml +++ b/libresonic-main/pom.xml @@ -38,6 +38,10 @@ test + + org.springframework + spring-core + org.springframework diff --git a/pom.xml b/pom.xml index 1070b1e4..510cbff9 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,11 @@ + + org.springframework + spring-core + ${spring.version} + org.springframework spring-webmvc