Skip to content

Commit

Permalink
share isBlank(String)
Browse files Browse the repository at this point in the history
Signed-off-by: Hervé Boutemy <hboutemy@apache.org>
  • Loading branch information
hboutemy committed Nov 2, 2024
1 parent 0bef0d0 commit c02b50f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/java/org/cyclonedx/maven/DefaultModelConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private MavenProject getEffectiveMavenProject(final Artifact artifact) throws Pr
}

private void addExternalReference(final ExternalReference.Type referenceType, final String url, final Component component) {
if (isURLBlank(url) || doesComponentHaveExternalReference(component, referenceType)) {
if (isBlank(url) || doesComponentHaveExternalReference(component, referenceType)) {
return;
}
try {
Expand Down Expand Up @@ -422,12 +422,11 @@ private Component.Type resolveProjectType(String projectType) {
return Component.Type.LIBRARY;
}

private static boolean isURLBlank(String url) {
return url == null || url.isEmpty() || url.trim().length() == 0;
private static boolean isBlank(String s) {
return s == null || s.isEmpty() || s.trim().isEmpty();
}

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

0 comments on commit c02b50f

Please sign in to comment.