From 850b50af410ea2c2fb4f2bd9e6a5342bf5571f44 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 22 May 2023 15:28:22 +0000 Subject: [PATCH] [MNG-6829] Replace StringUtils#isEmpty(String) & #isNotEmpty(String) Last batch of is(Not)Empty for https://issues.apache.org/jira/browse/MNG-6829 These are the smallest change sets, hence why I opened more at the same time. After this we can target the next most often used method from the StringUtils classes. 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 --- src/main/java/org/apache/maven/archiver/MavenArchiver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/archiver/MavenArchiver.java b/src/main/java/org/apache/maven/archiver/MavenArchiver.java index aa9a1b0..232decc 100644 --- a/src/main/java/org/apache/maven/archiver/MavenArchiver.java +++ b/src/main/java/org/apache/maven/archiver/MavenArchiver.java @@ -223,7 +223,7 @@ private void addManifestAttribute(Manifest manifest, Map map, St } private void addManifestAttribute(Manifest manifest, String key, String value) throws ManifestException { - if (!StringUtils.isEmpty(value)) { + if (!(value == null || value.isEmpty())) { Manifest.Attribute attr = new Manifest.Attribute(key, value); manifest.addConfiguredAttribute(attr); } else { @@ -772,7 +772,7 @@ public static Optional parseBuildOutputTimestamp(String outputTimestamp } // Number representing seconds since the epoch - if (StringUtils.isNotEmpty(outputTimestamp) && StringUtils.isNumeric(outputTimestamp)) { + if ((outputTimestamp != null && !outputTimestamp.isEmpty()) && StringUtils.isNumeric(outputTimestamp)) { return Optional.of(Instant.ofEpochSecond(Long.parseLong(outputTimestamp))); }