Commit d9c5b66f authored by Sonia Zorba's avatar Sonia Zorba
Browse files

LoggingDAO bugfix

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