Replace some String.length() checks with String.isEmpty()

Closes gh-10451
This commit is contained in:
dreis2211
2017-09-28 22:51:07 +02:00
committed by Stephane Nicoll
parent b08e51f0b3
commit 756398b52c
13 changed files with 15 additions and 15 deletions

View File

@@ -88,7 +88,7 @@ class RawConfigurationMetadata {
}
private static boolean hasLength(String string) {
return (string != null && string.length() > 0);
return (string != null && !string.isEmpty());
}
}

View File

@@ -63,7 +63,7 @@ class UnresolvedDependenciesAnalyzer {
private boolean hasNoVersion(ModuleVersionSelector selector) {
String version = selector.getVersion();
return version == null || version.trim().length() == 0;
return version == null || version.trim().isEmpty();
}
}

View File

@@ -255,7 +255,7 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable {
}
if (parent.lastIndexOf("/") != -1) {
parent = parent.substring(0, parent.lastIndexOf("/") + 1);
if (parent.length() > 0) {
if (!parent.isEmpty()) {
writeEntry(new JarArchiveEntry(parent), null);
}
}

View File

@@ -201,7 +201,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
}
private boolean hasJvmArgs() {
return (this.jvmArguments != null && this.jvmArguments.length() > 0);
return (this.jvmArguments != null && !this.jvmArguments.isEmpty());
}
private boolean hasWorkingDirectorySet() {

View File

@@ -225,7 +225,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
private File getTargetFile() {
String classifier = (this.classifier == null ? "" : this.classifier.trim());
if (classifier.length() > 0 && !classifier.startsWith("-")) {
if (!classifier.isEmpty() && !classifier.startsWith("-")) {
classifier = "-" + classifier;
}
if (!this.outputDirectory.exists()) {
@@ -292,7 +292,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
String... valueCandidates) {
if (!properties.containsKey(key)) {
for (String candidate : valueCandidates) {
if (candidate != null && candidate.length() > 0) {
if (candidate != null && !candidate.isEmpty()) {
properties.put(key, candidate);
return;
}