Skip to content
Snippets Groups Projects
Commit d9c5b66f authored by Sonia Zorba's avatar Sonia Zorba
Browse files

LoggingDAO bugfix

parent fd37936e
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -51,7 +52,7 @@ public class LoggingDAO { ...@@ -51,7 +52,7 @@ public class LoggingDAO {
private String getStackTraceString(Exception ex) { private String getStackTraceString(Exception ex) {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
try (PrintWriter pw = new PrintWriter(sw)) { try ( PrintWriter pw = new PrintWriter(sw)) {
ex.printStackTrace(pw); ex.printStackTrace(pw);
} }
return sw.toString(); return sw.toString();
...@@ -91,9 +92,11 @@ public class LoggingDAO { ...@@ -91,9 +92,11 @@ public class LoggingDAO {
if (request.getUserPrincipal() != null && request.getUserPrincipal() instanceof RapPrincipal) { if (request.getUserPrincipal() != null && request.getUserPrincipal() instanceof RapPrincipal) {
return request.getUserPrincipal().getName(); return request.getUserPrincipal().getName();
} else if (request.getSession(false) != null) { } else if (request.getSession(false) != null) {
return sessionData.getUserId(); try {
} else { return sessionData.getUserId();
return null; } catch (BeanCreationException ex) {
}
} }
return null;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment