refactor if
This commit is contained in:
parent
f6efb65fa6
commit
45b4ccf8f6
@ -32,9 +32,16 @@ public class ClientErrorLoggingFilter extends GenericFilterBean {
|
|||||||
Authentication auth = SecurityContextHolder.getContext()
|
Authentication auth = SecurityContextHolder.getContext()
|
||||||
.getAuthentication();
|
.getAuthentication();
|
||||||
|
|
||||||
if (auth != null) {
|
if (auth == null) {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int status = ((HttpServletResponse) response).getStatus();
|
int status = ((HttpServletResponse) response).getStatus();
|
||||||
if (status >= 400 && status < 500) {
|
if (status < 400 || status >= 500) {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (errorCodes == null) {
|
if (errorCodes == null) {
|
||||||
logger.debug("User " + auth.getName() + " encountered error " + status);
|
logger.debug("User " + auth.getName() + " encountered error " + status);
|
||||||
} else {
|
} else {
|
||||||
@ -45,8 +52,6 @@ public class ClientErrorLoggingFilter extends GenericFilterBean {
|
|||||||
logger.debug("User " + auth.getName() + " encountered error " + status);
|
logger.debug("User " + auth.getName() + " encountered error " + status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user