-
-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Trying to deserialize the following JSON BOM:
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"components": [
{
"type": "library",
"name": "acme-library",
"licenses": [
{
"license": {
"name": "foo",
"licensing": {
"purchaser": {
"organization": {
"contact": [
{
"name": ""
}
]
}
}
}
}
}
]
}
]
}Fails with:
Caused by: java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.asText()" because the return value of "com.fasterxml.jackson.databind.JsonNode.get(String)" is null
at org.cyclonedx.util.deserializer.OrganizationalChoiceDeserializer.deserializeOrganization(OrganizationalChoiceDeserializer.java:54)
at org.cyclonedx.util.deserializer.OrganizationalChoiceDeserializer.deserialize(OrganizationalChoiceDeserializer.java:45)
at org.cyclonedx.util.deserializer.OrganizationalChoiceDeserializer.deserialize(OrganizationalChoiceDeserializer.java:32)
Because OrganizationalChoiceDeserializer assumes name to always be present, despite it not being a mandatory field according to the spec:
Lines 52 to 54 in 225e7bf
| private OrganizationalEntity deserializeOrganization(JsonParser jp, JsonNode organizationNode) throws JsonProcessingException { | |
| OrganizationalEntity organization = new OrganizationalEntity(); | |
| organization.setName(organizationNode.get("name").asText()); |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working