Skip to content

Commit

Permalink
addressing issue #388. Checking if URL is null, empty, or blank (usin…
Browse files Browse the repository at this point in the history
…g Java 1.8 compatibility)

Signed-off-by: mtgag <githreg@mtg.de>
  • Loading branch information
mtgag authored and hboutemy committed Sep 14, 2023
1 parent 71c467e commit c08b9c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/cyclonedx/maven/DefaultModelConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private MavenProject getEffectiveMavenProject(final Artifact artifact) throws Pr
}

private void addExternalReference(final ExternalReference.Type referenceType, final String url, final Component component) {
if (url == null || doesComponentHaveExternalReference(component, referenceType)) {
if (isURLBlank(url) || doesComponentHaveExternalReference(component, referenceType)) {
return;
}
try {
Expand Down Expand Up @@ -398,4 +398,8 @@ 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;
}
}

0 comments on commit c08b9c7

Please sign in to comment.