Use CollectionUtils.isEmpty() and StringUtils.hasLength()

See gh-40645
This commit is contained in:
Yanming Zhou
2024-05-09 15:15:51 +08:00
committed by Moritz Halbritter
parent a67c8e4bbd
commit 0e450d602d
9 changed files with 24 additions and 12 deletions

View File

@@ -37,6 +37,7 @@ import org.springframework.boot.loader.tools.LaunchScript;
import org.springframework.boot.loader.tools.LayoutFactory;
import org.springframework.boot.loader.tools.Libraries;
import org.springframework.boot.loader.tools.Repackager;
import org.springframework.util.StringUtils;
/**
* Repackage existing JAR and WAR archives so that they can be executed from the command
@@ -258,7 +259,7 @@ public class RepackageMojo extends AbstractPackagerMojo {
private void putIfMissing(Properties properties, String key, String... valueCandidates) {
if (!properties.containsKey(key)) {
for (String candidate : valueCandidates) {
if (candidate != null && !candidate.isEmpty()) {
if (StringUtils.hasLength(candidate)) {
properties.put(key, candidate);
return;
}