Use placeholders instead of string concatenation when logging

This commit is contained in:
Andrei Ivanov
2016-10-11 12:07:25 +02:00
committed by Rob Winch
parent 33840bc46c
commit 468655a17c
2 changed files with 6 additions and 18 deletions

View File

@@ -170,23 +170,17 @@ public class DefaultDirContextValidator implements DirContextValidator {
final NamingEnumeration<SearchResult> searchResults = dirContext.search(this.base, this.filter, this.searchControls);
if (searchResults.hasMore()) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("DirContext '" + dirContext + "' passed validation.");
}
this.logger.debug("DirContext '{}' passed validation.", dirContext);
return true;
}
}
catch (Exception e) {
if(this.logger.isDebugEnabled()) {
this.logger.debug("DirContext '" + dirContext + "' failed validation with an exception.", e);
}
this.logger.debug("DirContext '{}' failed validation with an exception.", dirContext, e);
return false;
}
if (this.logger.isDebugEnabled()) {
this.logger.debug("DirContext '" + dirContext + "' failed validation.");
}
this.logger.debug("DirContext '{}' failed validation.", dirContext);
return false;
}
}

View File

@@ -170,23 +170,17 @@ public class DefaultDirContextValidator implements DirContextValidator {
final NamingEnumeration<SearchResult> searchResults = dirContext.search(this.base, this.filter, this.searchControls);
if (searchResults.hasMore()) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("DirContext '" + dirContext + "' passed validation.");
}
this.logger.debug("DirContext '{}' passed validation.", dirContext);
return true;
}
}
catch (Exception e) {
if(this.logger.isDebugEnabled()) {
this.logger.debug("DirContext '" + dirContext + "' failed validation with an exception.", e);
}
this.logger.debug("DirContext '{}' failed validation with an exception.", dirContext, e);
return false;
}
if (this.logger.isDebugEnabled()) {
this.logger.debug("DirContext '" + dirContext + "' failed validation.");
}
this.logger.debug("DirContext '{}' failed validation.", dirContext);
return false;
}
}