You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/12/31 16:30:01 UTC

[commons-digester] branch master updated: Use String#isEmpty().

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-digester.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fc490d  Use String#isEmpty().
6fc490d is described below

commit 6fc490dae37f2fc40373ce4ba4309112da9c4be2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 31 11:29:57 2020 -0500

    Use String#isEmpty().
---
 .../main/java/org/apache/commons/digester3/NodeCreateRule.java |  4 ++--
 core/src/main/java/org/apache/commons/digester3/RulesBase.java |  2 +-
 .../apache/commons/digester3/binder/DefaultRulesBinder.java    |  2 +-
 .../org/apache/commons/digester3/binder/LinkedRuleBuilder.java | 10 +++++-----
 .../apache/commons/digester3/binder/SetPropertyBuilder.java    |  2 +-
 .../commons/digester3/plugins/PluginDeclarationRule.java       |  2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/core/src/main/java/org/apache/commons/digester3/NodeCreateRule.java b/core/src/main/java/org/apache/commons/digester3/NodeCreateRule.java
index cc5b619..1ad8b65 100644
--- a/core/src/main/java/org/apache/commons/digester3/NodeCreateRule.java
+++ b/core/src/main/java/org/apache/commons/digester3/NodeCreateRule.java
@@ -261,7 +261,7 @@ public class NodeCreateRule
             try
             {
                 final Node previousTop = top;
-                if ( ( localName == null ) || ( localName.length() == 0 ) )
+                if ( ( localName == null ) || ( localName.isEmpty() ) )
                 {
                     top = doc.createElement( qName );
                 }
@@ -272,7 +272,7 @@ public class NodeCreateRule
                 for ( int i = 0; i < atts.getLength(); i++ )
                 {
                     Attr attr = null;
-                    if ( ( atts.getLocalName( i ) == null ) || ( atts.getLocalName( i ).length() == 0 ) )
+                    if ( ( atts.getLocalName( i ) == null ) || ( atts.getLocalName( i ).isEmpty() ) )
                     {
                         attr = doc.createAttribute( atts.getQName( i ) );
                         attr.setNodeValue( atts.getValue( i ) );
diff --git a/core/src/main/java/org/apache/commons/digester3/RulesBase.java b/core/src/main/java/org/apache/commons/digester3/RulesBase.java
index 228d5e4..a4e7918 100644
--- a/core/src/main/java/org/apache/commons/digester3/RulesBase.java
+++ b/core/src/main/java/org/apache/commons/digester3/RulesBase.java
@@ -186,7 +186,7 @@ public class RulesBase
         {
             return ( null );
         }
-        if ( ( namespaceURI == null ) || ( namespaceURI.length() == 0 ) )
+        if ( ( namespaceURI == null ) || ( namespaceURI.isEmpty() ) )
         {
             return ( list );
         }
diff --git a/core/src/main/java/org/apache/commons/digester3/binder/DefaultRulesBinder.java b/core/src/main/java/org/apache/commons/digester3/binder/DefaultRulesBinder.java
index 4fe419c..9b2ff55 100644
--- a/core/src/main/java/org/apache/commons/digester3/binder/DefaultRulesBinder.java
+++ b/core/src/main/java/org/apache/commons/digester3/binder/DefaultRulesBinder.java
@@ -158,7 +158,7 @@ final class DefaultRulesBinder
     {
         final String keyPattern;
 
-        if ( pattern == null || pattern.length() == 0 )
+        if ( pattern == null || pattern.isEmpty() )
         {
             addError( "Null or empty pattern is not valid" );
             keyPattern = null;
diff --git a/core/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java b/core/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java
index 7569895..8a675e3 100644
--- a/core/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java
+++ b/core/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java
@@ -68,7 +68,7 @@ public final class LinkedRuleBuilder
      */
     public CallMethodBuilder callMethod( final String methodName )
     {
-        if ( methodName == null || methodName.length() == 0 )
+        if ( methodName == null || methodName.isEmpty() )
         {
             mainBinder.addError( "{ forPattern( \"%s\" ).callMethod( String ) } empty 'methodName' not allowed",
                                  keyPattern );
@@ -161,7 +161,7 @@ public final class LinkedRuleBuilder
      */
     public SetNextBuilder setNext( final String methodName )
     {
-        if ( methodName == null || methodName.length() == 0 )
+        if ( methodName == null || methodName.isEmpty() )
         {
             mainBinder.addError( "{ forPattern( \"%s\" ).setNext( String ) } empty 'methodName' not allowed",
                                  keyPattern );
@@ -196,7 +196,7 @@ public final class LinkedRuleBuilder
      */
     public SetPropertyBuilder setProperty( final String attributePropertyName )
     {
-        if ( attributePropertyName == null || attributePropertyName.length() == 0 )
+        if ( attributePropertyName == null || attributePropertyName.isEmpty() )
         {
             mainBinder
                 .addError( "{ forPattern( \"%s\" ).setProperty( String ) } empty 'attributePropertyName' not allowed",
@@ -218,7 +218,7 @@ public final class LinkedRuleBuilder
      */
     public SetRootBuilder setRoot( final String methodName )
     {
-        if ( methodName == null || methodName.length() == 0 )
+        if ( methodName == null || methodName.isEmpty() )
         {
             mainBinder.addError( "{ forPattern( \"%s\" ).setRoot( String ) } empty 'methodName' not allowed",
                                  keyPattern );
@@ -235,7 +235,7 @@ public final class LinkedRuleBuilder
      */
     public SetTopBuilder setTop( final String methodName )
     {
-        if ( methodName == null || methodName.length() == 0 )
+        if ( methodName == null || methodName.isEmpty() )
         {
             mainBinder.addError( "{ forPattern( \"%s\" ).setTop( String ) } empty 'methodName' not allowed",
                                  keyPattern );
diff --git a/core/src/main/java/org/apache/commons/digester3/binder/SetPropertyBuilder.java b/core/src/main/java/org/apache/commons/digester3/binder/SetPropertyBuilder.java
index 8f2c463..032c3a9 100644
--- a/core/src/main/java/org/apache/commons/digester3/binder/SetPropertyBuilder.java
+++ b/core/src/main/java/org/apache/commons/digester3/binder/SetPropertyBuilder.java
@@ -51,7 +51,7 @@ public final class SetPropertyBuilder
      */
     public SetPropertyBuilder extractingValueFromAttribute( final String valueAttributeName )
     {
-        if ( attributePropertyName == null || attributePropertyName.length() == 0 )
+        if ( attributePropertyName == null || attributePropertyName.isEmpty() )
         {
             reportError( format( "setProperty(\"%s\").extractingValueFromAttribute(String)}", attributePropertyName ),
                          "empty 'valueAttributeName' not allowed" );
diff --git a/core/src/main/java/org/apache/commons/digester3/plugins/PluginDeclarationRule.java b/core/src/main/java/org/apache/commons/digester3/plugins/PluginDeclarationRule.java
index 8be1ce0..ce1e657 100644
--- a/core/src/main/java/org/apache/commons/digester3/plugins/PluginDeclarationRule.java
+++ b/core/src/main/java/org/apache/commons/digester3/plugins/PluginDeclarationRule.java
@@ -68,7 +68,7 @@ public class PluginDeclarationRule
         for ( int i = 0; i < nAttrs; ++i )
         {
             String key = attributes.getLocalName( i );
-            if ( ( key == null ) || ( key.length() == 0 ) )
+            if ( ( key == null ) || ( key.isEmpty() ) )
             {
                 key = attributes.getQName( i );
             }