logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1501255 - in /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core: appender/db/jdbc/ config/plugins/ helpers/ impl/ layout/ pattern/
Date Tue, 09 Jul 2013 13:24:15 GMT
Author: ggregory
Date: Tue Jul  9 13:24:14 2013
New Revision: 1501255

URL: http://svn.apache.org/r1501255
Log:
Replace String.length() == 0 with String.isEmpty() in all but one spot.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSource.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/LoggersPlugin.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableFormatOptions.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSource.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSource.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSource.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jdbc/DriverManagerConnectionSource.java
Tue Jul  9 13:24:14 2013
@@ -95,7 +95,7 @@ public final class DriverManagerConnecti
             return null;
         }
 
-        if (username == null || username.trim().length() == 0) {
+        if (username == null || username.trim().isEmpty()) {
             username = null;
             password = null;
         }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/LoggersPlugin.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/LoggersPlugin.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/LoggersPlugin.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/LoggersPlugin.java
Tue Jul  9 13:24:14 2013
@@ -43,7 +43,7 @@ public final class LoggersPlugin {
 
         for (final LoggerConfig logger : loggers) {
             if (logger != null) {
-                if (logger.getName().length() == 0) {
+                if (logger.getName().isEmpty()) {
                     root = logger;
                 }
                 loggerMap.put(logger.getName(), logger);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java
Tue Jul  9 13:24:14 2013
@@ -29,7 +29,7 @@ public final class NameUtil {
     }
 
     public static String getSubName(final String name) {
-        if (name.length() == 0) {
+        if (name.isEmpty()) {
             return null;
         }
         final int i = name.lastIndexOf('.');

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
Tue Jul  9 13:24:14 2013
@@ -329,7 +329,7 @@ public class Log4jLogEvent implements Lo
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder();
-        final String n = name.length() == 0 ? "root" : name;
+        final String n = name.isEmpty() ? "root" : name;
         sb.append("Logger=").append(n);
         sb.append(" Level=").append(level.name());
         sb.append(" Message=").append(message.getFormattedMessage());

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableFormatOptions.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableFormatOptions.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableFormatOptions.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableFormatOptions.java
Tue Jul  9 13:24:14 2013
@@ -194,7 +194,7 @@ public final class ThrowableFormatOption
             for (String rawOption : options) {
                 if (rawOption != null) {
                     final String option = rawOption.trim();
-                    if (option.length() == 0) {
+                    if (option.isEmpty()) {
                         // continue;
                     } else if (option.startsWith("separator(") && option.endsWith(")"))
{
                         separator = option.substring("separator(".length(), option.length()
- 1);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/HTMLLayout.java
Tue Jul  9 13:24:14 2013
@@ -145,7 +145,7 @@ public final class HTMLLayout extends Ab
         sbuf.append("</td>").append(Constants.LINE_SEP);
 
         String escapedLogger = Transform.escapeTags(event.getLoggerName());
-        if (escapedLogger.length() == 0) {
+        if (escapedLogger.isEmpty()) {
             escapedLogger = "root";
         }
         sbuf.append("<td title=\"").append(escapedLogger).append(" logger\">");

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
Tue Jul  9 13:24:14 2013
@@ -105,7 +105,7 @@ public class XMLLayout extends AbstractS
 
         buf.append("<log4j:event logger=\"");
         String name = event.getLoggerName();
-        if (name.length() == 0) {
+        if (name.isEmpty()) {
             name = "root";
         }
         buf.append(Transform.escapeTags(name));

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java?rev=1501255&r1=1501254&r2=1501255&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/NameAbbreviator.java
Tue Jul  9 13:24:14 2013
@@ -46,7 +46,7 @@ public abstract class NameAbbreviator {
             //     use MaxElementAbbreviator
             final String trimmed = pattern.trim();
 
-            if (trimmed.length() == 0) {
+            if (trimmed.isEmpty()) {
                 return DEFAULT;
             }
 



Mime
View raw message