Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
* request into the MDC.
* <p/>
* <p/>
* The values are removed after the request is processed.
* The values are removed after the all following
* filters/servlets have been processed. Note, however,
* the value is not available in an error handler servlet.
*
* @author Ceki G&uuml;lc&uuml;
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
import org.slf4j.MDC;

/**
* A simple servlet filter that puts the username
* found either in the Principal.
* A simple servlet filter that stores the username
* found in the Principal in the MDC.
*
* <p> The value is removed from the MDC once the request has been
* fully processed.
* <p> The value is removed from the MDC once all following
* filters/servlets have been fully processed. Note, however,
* the value is not available in an error handler servlet.
*
* @author S&eacute;bastien Pennec
*/
Expand Down Expand Up @@ -74,7 +75,7 @@ public void init(FilterConfig arg0) throws ServletException {
* @return true id the user can be successfully registered
*/
private boolean registerUsername(String username) {
if (username != null && username.trim().length() > 0) {
if (username != null && !username.trim().isEmpty()) {
MDC.put(USER_KEY, username);
return true;
}
Expand Down