Skip to content

Commit c02b50f

Browse files
committed
share isBlank(String)
Signed-off-by: Hervé Boutemy <hboutemy@apache.org>
1 parent 0bef0d0 commit c02b50f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/java/org/cyclonedx/maven/DefaultModelConverter.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private MavenProject getEffectiveMavenProject(final Artifact artifact) throws Pr
272272
}
273273

274274
private void addExternalReference(final ExternalReference.Type referenceType, final String url, final Component component) {
275-
if (isURLBlank(url) || doesComponentHaveExternalReference(component, referenceType)) {
275+
if (isBlank(url) || doesComponentHaveExternalReference(component, referenceType)) {
276276
return;
277277
}
278278
try {
@@ -422,12 +422,11 @@ private Component.Type resolveProjectType(String projectType) {
422422
return Component.Type.LIBRARY;
423423
}
424424

425-
private static boolean isURLBlank(String url) {
426-
return url == null || url.isEmpty() || url.trim().length() == 0;
425+
private static boolean isBlank(String s) {
426+
return s == null || s.isEmpty() || s.trim().isEmpty();
427427
}
428428

429429
private static boolean isLicenseBlank(org.apache.maven.model.License license) {
430-
return (license.getName() == null || license.getName().isEmpty() || license.getName().trim().length() == 0)
431-
&& (license.getUrl() == null || license.getUrl().isEmpty() || license.getUrl().trim().length() == 0);
430+
return isBlank(license.getName()) && isBlank(license.getUrl());
432431
}
433432
}

0 commit comments

Comments
 (0)