fixed sonar bugs
This commit is contained in:
@ -1,7 +1,3 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.jeeutil;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -20,7 +16,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import static org.apache.log4j.Logger.getLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -28,7 +23,7 @@ import static org.apache.log4j.Logger.getLogger;
|
||||
*/
|
||||
public class AuthenticationFilter implements Filter {
|
||||
|
||||
private final static Logger logger = getLogger(AuthenticationFilter.class.getName());
|
||||
private final static Logger LOGGER = Logger.getLogger(AuthenticationFilter.class);
|
||||
private final static String USER = AuthenticationFilter.class.getName() + "_user";
|
||||
private String loginPage;
|
||||
private String errorPage;
|
||||
@ -56,17 +51,18 @@ public class AuthenticationFilter implements Filter {
|
||||
if (session != null) {
|
||||
if (session.getAttribute(USER) != null) {
|
||||
currentUser = (User) session.getAttribute(USER);
|
||||
LOGGER.debug ("found "+currentUser);
|
||||
} 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);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (currentUser == null) {
|
||||
logger.debug("No logged in user found - going to force login");
|
||||
LOGGER.debug("No logged in user found - going to force login");
|
||||
filterConfig.getServletContext().getRequestDispatcher(loginPage).forward(request, response);
|
||||
} else {
|
||||
logger.debug("User is authenticated, continue filter chain");
|
||||
LOGGER.debug("User is authenticated, continue filter chain");
|
||||
// user is authenticated, continue with filter chain
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
@ -97,7 +93,7 @@ public class AuthenticationFilter implements Filter {
|
||||
pw.print("</html>");
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.ERROR, errorMsg, ex);
|
||||
LOGGER.log(Level.ERROR, errorMsg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user