This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git

commit ab0c8830aa20ed87fc812c5654acde20d73ed9a5
Author: Stefan Bodewig <[email protected]>
AuthorDate: Fri May 8 21:50:17 2026 +0200

    properly deal with circular references
---
 src/main/org/apache/ant/cyclonedx/Component.java    | 7 +++++++
 src/main/org/apache/ant/cyclonedx/License.java      | 1 +
 src/main/org/apache/ant/cyclonedx/Organization.java | 1 +
 3 files changed, 9 insertions(+)

diff --git a/src/main/org/apache/ant/cyclonedx/Component.java 
b/src/main/org/apache/ant/cyclonedx/Component.java
index 82b0d73..6c8f457 100644
--- a/src/main/org/apache/ant/cyclonedx/Component.java
+++ b/src/main/org/apache/ant/cyclonedx/Component.java
@@ -79,6 +79,7 @@ public class Component extends DataType {
         if (isReference()) {
             return getRef().getName();
         }
+        dieOnCircularReference();
         return name;
     }
 
@@ -91,6 +92,7 @@ public class Component extends DataType {
         if (isReference()) {
             return getRef().getGroup();
         }
+        dieOnCircularReference();
         return group;
     }
 
@@ -169,6 +171,7 @@ public class Component extends DataType {
         if (isReference()) {
             return getRef().getPurl();
         }
+        dieOnCircularReference();
         if (purl != null) {
             return purl;
         }
@@ -187,6 +190,7 @@ public class Component extends DataType {
         if (isReference()) {
             return getRef().getBomRef();
         }
+        dieOnCircularReference();
         if (bomRef == null) {
             return getPurl();
         }
@@ -234,6 +238,7 @@ public class Component extends DataType {
         if (isReference()) {
             return getRef().hasSbomLink();
         }
+        dieOnCircularReference();
         return sbomLink != null;
     }
 
@@ -241,6 +246,7 @@ public class Component extends DataType {
         if (isReference()) {
             return getRef().areDependenciesUnknown();
         }
+        dieOnCircularReference();
         return unknownDependencies;
     }
 
@@ -248,6 +254,7 @@ public class Component extends DataType {
         if (isReference()) {
             return getRef().resolve();
         }
+        dieOnCircularReference();
 
         if (sbomLink != null && !sbomLinkResolved) {
             if (sbomLink.size() != 1) {
diff --git a/src/main/org/apache/ant/cyclonedx/License.java 
b/src/main/org/apache/ant/cyclonedx/License.java
index 4756af9..c171ab8 100644
--- a/src/main/org/apache/ant/cyclonedx/License.java
+++ b/src/main/org/apache/ant/cyclonedx/License.java
@@ -31,6 +31,7 @@ public class License extends DataType {
         if (isReference()) {
             return getRef().toCycloneDxLicense();
         }
+        dieOnCircularReference();
         if (name == null && id == null) {
             throw new BuildException("license name or id is required");
         }
diff --git a/src/main/org/apache/ant/cyclonedx/Organization.java 
b/src/main/org/apache/ant/cyclonedx/Organization.java
index 949bdde..7981495 100644
--- a/src/main/org/apache/ant/cyclonedx/Organization.java
+++ b/src/main/org/apache/ant/cyclonedx/Organization.java
@@ -26,6 +26,7 @@ public class Organization extends DataType {
         if (isReference()) {
             return getRef().toOrganizationalEntity();
         }
+        dieOnCircularReference();
         OrganizationalEntity oe = new OrganizationalEntity();
         if (name != null) {
             oe.setName(name);

Reply via email to