Skip to content

Commit 401c229

Browse files
[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#189)
Continuation of https://issues.apache.org/jira/browse/MNG-6829 Review requested of @elharo 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 <team@moderne.io>
1 parent 4afec1d commit 401c229

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
754754
return;
755755
}
756756

757-
if (StringUtils.isEmpty(encoding)) {
757+
if (encoding == null || encoding.isEmpty()) {
758758
getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
759759
+ ", i.e. build is platform dependent!");
760760
}
@@ -1477,7 +1477,7 @@ private CharSequence resolveExternalJreVersion() {
14771477
private File interpolatePomFile(File pomFile, File basedir) throws MojoExecutionException {
14781478
File interpolatedPomFile = null;
14791479
if (pomFile != null) {
1480-
if (StringUtils.isNotEmpty(filteredPomPrefix)) {
1480+
if (filteredPomPrefix != null && !filteredPomPrefix.isEmpty()) {
14811481
interpolatedPomFile = new File(basedir, filteredPomPrefix + pomFile.getName());
14821482
buildInterpolatedFile(pomFile, interpolatedPomFile);
14831483
} else {
@@ -1640,7 +1640,7 @@ private MessageBuilder pad(BuildJob buildJob) {
16401640
* @param interpolatedPomFile The interpolated pom file.
16411641
*/
16421642
private void deleteInterpolatedPomFile(File interpolatedPomFile) {
1643-
if (interpolatedPomFile != null && StringUtils.isNotEmpty(filteredPomPrefix)) {
1643+
if (interpolatedPomFile != null && (filteredPomPrefix != null && !filteredPomPrefix.isEmpty())) {
16441644
interpolatedPomFile.delete();
16451645
}
16461646
}

src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.util.List;
2929
import java.util.Locale;
3030

31-
import org.apache.commons.lang3.StringUtils;
3231
import org.apache.maven.doxia.sink.Sink;
3332
import org.apache.maven.plugins.annotations.Component;
3433
import org.apache.maven.plugins.annotations.Mojo;
@@ -260,8 +259,8 @@ private void renderBuildJob(BuildJob buildJob) {
260259
private String getBuildJobReportName(BuildJob buildJob) {
261260
String buildJobName = buildJob.getName();
262261
String buildJobDescription = buildJob.getDescription();
263-
boolean emptyJobName = StringUtils.isEmpty(buildJobName);
264-
boolean emptyJobDescription = StringUtils.isEmpty(buildJobDescription);
262+
boolean emptyJobName = buildJobName == null || buildJobName.isEmpty();
263+
boolean emptyJobDescription = buildJobDescription == null || buildJobDescription.isEmpty();
265264
boolean isReportJobNameComplete = !emptyJobName && !emptyJobDescription;
266265
if (isReportJobNameComplete) {
267266
return getFormattedName(buildJobName, buildJobDescription);

0 commit comments

Comments
 (0)