Skip to content

Commit

Permalink
Initial Changes
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Alzate <aalzate@sonatype.com>
  • Loading branch information
mr-zepol committed Oct 9, 2023
1 parent d13ad3e commit 06a70ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/cyclonedx/model/ExtensibleElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import org.apache.commons.lang3.StringUtils;
import org.cyclonedx.util.serializer.ExtensibleTypesSerializer;
import org.cyclonedx.util.deserializer.ExtensionDeserializer;

Expand Down Expand Up @@ -71,6 +72,8 @@ public void add(final String key, final Extension value) {
if (this.extensions == null) {
this.extensions = new HashMap<>();
}
extensions.put(key, value);
if (value != null) {
extensions.put(key, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ private void parseTools(Metadata metadata, JsonGenerator jsonGenerator) throws I
} else if (version.getVersion() >= Version.VERSION_15.getVersion()) {
ToolInformation choice = metadata.getToolChoice();
if (choice != null) {
jsonGenerator.writeFieldName("tools");
jsonGenerator.writeStartObject();
if (isXml && jsonGenerator instanceof ToXmlGenerator) {
if (choice.getComponents() != null) {
writeArrayFieldXML(choice.getComponents(), (ToXmlGenerator) jsonGenerator, "component");
Expand All @@ -131,6 +133,7 @@ private void parseTools(Metadata metadata, JsonGenerator jsonGenerator) throws I
writeArrayFieldJSON(jsonGenerator, "services", choice.getServices());
}
}
jsonGenerator.writeEndObject();
}
}
}
Expand Down

0 comments on commit 06a70ca

Please sign in to comment.