Skip to content

Commit

Permalink
[MNG-6829] Replace StringUtils#isEmpty(String) & #isNotEmpty(String)
Browse files Browse the repository at this point in the history
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 <team@moderne.io>
  • Loading branch information
2 people authored and slachiewicz committed Jun 5, 2023
1 parent d347230 commit 9f821e9
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException

compilerConfiguration.setImplicitOption(implicit);

if (debug && StringUtils.isNotEmpty(debuglevel)) {
if (debug && (debuglevel != null && !debuglevel.isEmpty())) {
String[] split = StringUtils.split(debuglevel, ",");
for (String aSplit : split) {
if (!(aSplit.equalsIgnoreCase("none")
Expand Down Expand Up @@ -779,7 +779,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException
compilerConfiguration.setFork(fork);

if (fork) {
if (!StringUtils.isEmpty(meminitial)) {
if (!(meminitial == null || meminitial.isEmpty())) {
String value = getMemoryValue(meminitial);

if (value != null) {
Expand All @@ -789,7 +789,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException
}
}

if (!StringUtils.isEmpty(maxmem)) {
if (!(maxmem == null || maxmem.isEmpty())) {
String value = getMemoryValue(maxmem);

if (value != null) {
Expand Down Expand Up @@ -960,14 +960,14 @@ public void execute() throws MojoExecutionException, CompilationFailureException
key = "-" + key;
}

if (key.startsWith("-A") && StringUtils.isNotEmpty(value)) {
if (key.startsWith("-A") && (value != null && !value.isEmpty())) {
compilerConfiguration.addCompilerCustomArgument(key + "=" + value, null);
} else {
compilerConfiguration.addCompilerCustomArgument(key, value);
}
}
}
if (!StringUtils.isEmpty(effectiveCompilerArgument)) {
if (!(effectiveCompilerArgument == null || effectiveCompilerArgument.isEmpty())) {
compilerConfiguration.addCompilerCustomArgument(effectiveCompilerArgument, null);
}
if (compilerArgs != null) {
Expand Down Expand Up @@ -1310,7 +1310,7 @@ protected boolean isTestCompile() {
private Set<File> getCompileSources(Compiler compiler, CompilerConfiguration compilerConfiguration)
throws MojoExecutionException, CompilerException {
String inputFileEnding = compiler.getInputFileEnding(compilerConfiguration);
if (StringUtils.isEmpty(inputFileEnding)) {
if (inputFileEnding == null || inputFileEnding.isEmpty()) {
// see MCOMPILER-199 GroovyEclipseCompiler doesn't set inputFileEnding
// so we can presume it's all files from the source directory
inputFileEnding = ".*";
Expand Down Expand Up @@ -1710,7 +1710,7 @@ private DirectoryScanResult computeInputFileTreeChanges(IncrementalBuildHelper i
}

private boolean hasInputFileTreeChanged(DirectoryScanResult dsr) {
return (dsr.getFilesAdded().length > 0 || dsr.getFilesRemoved().length > 0);
return dsr.getFilesAdded().length > 0 || dsr.getFilesRemoved().length > 0;
}

public void setTarget(String target) {
Expand Down

0 comments on commit 9f821e9

Please sign in to comment.