Skip to content

Commit 8a918f5

Browse files
committed
Use String#isEmpty()
1 parent 99b987d commit 8a918f5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

log4j-1.2-api/src/main/java/org/apache/log4j/PropertyConfigurator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ void parseAdditivityForLogger(final Properties properties, final Logger logger,
426426
final String value = OptionConverter.findAndSubst(ADDITIVITY_PREFIX + loggerName, properties);
427427
LogLog.debug("Handling " + ADDITIVITY_PREFIX + loggerName + "=[" + value + "]");
428428
// touch additivity only if necessary
429-
if ((value != null) && (!value.equals(""))) {
429+
if (value != null && !value.isEmpty()) {
430430
final boolean additivity = OptionConverter.toBoolean(value, true);
431431
LogLog.debug("Setting additivity for \"" + loggerName + "\" to " + additivity);
432432
logger.setAdditivity(additivity);
@@ -581,7 +581,7 @@ void parseCategory(
581581
// If value is not in the form ", appender.." or "", then we should set
582582
// the level of the loggeregory.
583583

584-
if (!(value.startsWith(",") || value.equals(""))) {
584+
if (!(value.startsWith(",") || value.isEmpty())) {
585585

586586
// just to be on the safe side...
587587
if (!st.hasMoreTokens()) {

log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ private boolean getAdditivityForLogger(final Properties props, final String logg
390390
final String value = OptionConverter.findAndSubst(key, props);
391391
LOGGER.debug("Handling {}=[{}]", key, value);
392392
// touch additivity only if necessary
393-
if ((value != null) && (!value.equals(""))) {
393+
if (value != null && !value.isEmpty()) {
394394
additivity = OptionConverter.toBoolean(value, true);
395395
}
396396
return additivity;
@@ -412,7 +412,7 @@ private void parseLogger(
412412

413413
// If value is not in the form ", appender.." or "", then we should set the level of the logger.
414414

415-
if (!(value.startsWith(",") || value.equals(""))) {
415+
if (!(value.startsWith(",") || value.isEmpty())) {
416416

417417
// just to be on the safe side...
418418
if (!st.hasMoreTokens()) {

log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,14 @@ private void parse(Element element) {
732732
// if the log4j.dtd is not specified in the XML file, then the
733733
// "debug" attribute is returned as the empty string.
734734
String status = "error";
735-
if (!debugAttrib.equals("") && !debugAttrib.equals("null")) {
735+
if (!debugAttrib.isEmpty() && !debugAttrib.equals("null")) {
736736
status = OptionConverter.toBoolean(debugAttrib, true) ? "debug" : "error";
737737
} else {
738738
LOGGER.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
739739
}
740740

741741
final String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR));
742-
if (!confDebug.equals("") && !confDebug.equals("null")) {
742+
if (!confDebug.isEmpty() && !confDebug.equals("null")) {
743743
LOGGER.warn("The \"" + CONFIG_DEBUG_ATTR + "\" attribute is deprecated.");
744744
LOGGER.warn("Use the \"" + INTERNAL_DEBUG_ATTR + "\" attribute instead.");
745745
status = OptionConverter.toBoolean(confDebug, true) ? "debug" : "error";

0 commit comments

Comments
 (0)