fixed sonar bugs
This commit is contained in:
@ -42,7 +42,7 @@ public class AuthenticationFilter implements Filter {
|
|||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||||
|
|
||||||
if ((loginPage == null) || (errorPage == null)) {
|
if ((loginPage == null) || (errorPage == null)) {
|
||||||
returnError(request, response, "AuthenticationFilter not properly configured! Contact Administrator.");
|
returnError(response, "AuthenticationFilter not properly configured! Contact Administrator.");
|
||||||
}
|
}
|
||||||
|
|
||||||
User currentUser = null;
|
User currentUser = null;
|
||||||
@ -51,7 +51,7 @@ public class AuthenticationFilter implements Filter {
|
|||||||
if (session != null) {
|
if (session != null) {
|
||||||
if (session.getAttribute(USER) != null) {
|
if (session.getAttribute(USER) != null) {
|
||||||
currentUser = (User) session.getAttribute(USER);
|
currentUser = (User) session.getAttribute(USER);
|
||||||
LOGGER.debug ("found "+currentUser);
|
LOGGER.debug("found " + currentUser);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug("No active session found - going to force login");
|
LOGGER.debug("No active session found - going to force login");
|
||||||
filterConfig.getServletContext().getRequestDispatcher(loginPage).forward(request, response);
|
filterConfig.getServletContext().getRequestDispatcher(loginPage).forward(request, response);
|
||||||
@ -74,10 +74,8 @@ public class AuthenticationFilter implements Filter {
|
|||||||
this.filterConfig = null;
|
this.filterConfig = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void returnError(ServletRequest request, ServletResponse response, String errorMsg) {
|
private void returnError(ServletResponse response, String errorMsg) {
|
||||||
response.setContentType("text/html");
|
response.setContentType("text/html");
|
||||||
|
|
||||||
|
|
||||||
try (
|
try (
|
||||||
ServletOutputStream servletOutputStream = response.getOutputStream();
|
ServletOutputStream servletOutputStream = response.getOutputStream();
|
||||||
PrintStream ps = new PrintStream(servletOutputStream);
|
PrintStream ps = new PrintStream(servletOutputStream);
|
||||||
|
|||||||
@ -145,7 +145,7 @@ public abstract class FileUtil {
|
|||||||
try {
|
try {
|
||||||
md = MessageDigest.getInstance("MD5");
|
md = MessageDigest.getInstance("MD5");
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
throw new IOException("Cannot get MD5 MessageDigest instance");
|
throw new IOException("Cannot get MD5 MessageDigest instance. Reason: "+ex.toString(), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
try (InputStream is = Files.newInputStream(Paths.get(fileName));
|
try (InputStream is = Files.newInputStream(Paths.get(fileName));
|
||||||
|
|||||||
Reference in New Issue
Block a user