You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2023/05/15 11:11:27 UTC

[maven-ear-plugin] branch master updated: [MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#93)

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

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f70d92  [MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#93)
3f70d92 is described below

commit 3f70d92d672c89dd775244a1428a34bcdfe62006
Author: Tim te Beek <ti...@gmail.com>
AuthorDate: Mon May 15 13:11:21 2023 +0200

    [MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#93)
    
    * [MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String)
    
    Use this link to re-run the recipe: https://public.moderne.io/recipes/org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk?organizationId=QXBhY2hlIE1hdmVu
    
    Co-authored-by: Moderne <te...@moderne.io>
    
    * Fix checkstyle violations
    
    ---------
    
    Co-authored-by: Moderne <te...@moderne.io>
---
 src/main/java/org/apache/maven/plugins/ear/EarMojo.java     | 4 ++--
 src/main/java/org/apache/maven/plugins/ear/EjbRef.java      | 5 ++---
 src/main/java/org/apache/maven/plugins/ear/EnvEntry.java    | 6 +++---
 src/main/java/org/apache/maven/plugins/ear/ResourceRef.java | 5 ++---
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
index 5d3d646..ea0bc20 100644
--- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
@@ -562,7 +562,7 @@ public class EarMojo
      */
     public String[] getPackagingExcludes()
     {
-        if ( StringUtils.isEmpty( packagingExcludes ) )
+        if ( packagingExcludes == null || packagingExcludes.isEmpty() )
         {
             return new String[0];
         }
@@ -585,7 +585,7 @@ public class EarMojo
      */
     public String[] getPackagingIncludes()
     {
-        if ( StringUtils.isEmpty( packagingIncludes ) )
+        if ( packagingIncludes == null || packagingIncludes.isEmpty() )
         {
             return new String[] { "**" };
         }
diff --git a/src/main/java/org/apache/maven/plugins/ear/EjbRef.java b/src/main/java/org/apache/maven/plugins/ear/EjbRef.java
index 2f5ef5f..e57b6c1 100644
--- a/src/main/java/org/apache/maven/plugins/ear/EjbRef.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EjbRef.java
@@ -19,7 +19,6 @@ package org.apache.maven.plugins.ear;
  * under the License.
  */
 
-import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
 /**
@@ -56,11 +55,11 @@ public class EjbRef
      */
     public EjbRef( String description, String name, String type, String lookupName )
     {
-        if ( StringUtils.isEmpty( name ) )
+        if ( name == null || name.isEmpty() )
         {
             throw new IllegalArgumentException( EJB_NAME + " in " + EJB_REF + " element cannot be null." );
         }
-        else if ( StringUtils.isEmpty( type ) && StringUtils.isEmpty( lookupName ) )
+        else if ( ( type == null || type.isEmpty() ) && ( lookupName == null || lookupName.isEmpty() ) )
         {
             throw new IllegalArgumentException( EJB_TYPE + " in " + EJB_REF + " element cannot be null if no "
                 + EJB_LOOKUP_NAME + " was specified." );
diff --git a/src/main/java/org/apache/maven/plugins/ear/EnvEntry.java b/src/main/java/org/apache/maven/plugins/ear/EnvEntry.java
index 18b44b5..e3fb775 100644
--- a/src/main/java/org/apache/maven/plugins/ear/EnvEntry.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EnvEntry.java
@@ -19,7 +19,6 @@ package org.apache.maven.plugins.ear;
  * under the License.
  */
 
-import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
 /**
@@ -54,11 +53,12 @@ class EnvEntry
 
     EnvEntry( String description, String name, String type, String value, String lookupName )
     {
-        if ( StringUtils.isEmpty( name ) )
+        if ( name == null || name.isEmpty() )
         {
             throw new IllegalArgumentException( ENV_ENTRY_NAME + " in " + ENV_ENTRY + " element cannot be null." );
         }
-        else if ( StringUtils.isEmpty( type ) && StringUtils.isEmpty( value ) )
+        else if ( ( type == null || type.isEmpty() ) && ( value == null || value.isEmpty() ) )
+
         {
             throw new IllegalArgumentException( ENV_ENTRY_TYPE + " in " + ENV_ENTRY + " element cannot be null if no "
                 + ENV_ENTRY_VALUE + " was specified." );
diff --git a/src/main/java/org/apache/maven/plugins/ear/ResourceRef.java b/src/main/java/org/apache/maven/plugins/ear/ResourceRef.java
index a8d5bf2..339dfb2 100644
--- a/src/main/java/org/apache/maven/plugins/ear/ResourceRef.java
+++ b/src/main/java/org/apache/maven/plugins/ear/ResourceRef.java
@@ -19,7 +19,6 @@ package org.apache.maven.plugins.ear;
  * under the License.
  */
 
-import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
 /**
@@ -72,12 +71,12 @@ public class ResourceRef
      */
    public ResourceRef( String name, String type, String auth, String lookupName )
     {
-        if ( StringUtils.isEmpty( name ) )
+        if ( name == null || name.isEmpty() )
         {
             throw new IllegalArgumentException( RESOURCE_REF_NAME + " in " + RESOURCE_REF_NAME
                 + " element cannot be null." );
         }
-        else if ( StringUtils.isEmpty( type ) && StringUtils.isEmpty( auth ) )
+        else if ( ( type == null || type.isEmpty() ) && ( auth == null || auth.isEmpty() ) )
         {
             throw new IllegalArgumentException( RESOURCE_TYPE + " in " + RESOURCE_REF_NAME
                 + " element cannot be null " );