Skip to content

XmlParser - unable to parse XML SBOM with evidence entries #938

Description

@rsvoboda

XmlParser - unable to parse XML SBOM with evidence entries

Parsing fails with

[ERROR]   CycloneIT.test:15->parseSbomXml:21 » Parse com.fasterxml.jackson.databind.exc.MismatchedInputException:
  Cannot deserialize value of type `java.util.ArrayList<org.cyclonedx.model.component.evidence.Occurrence>`
  from Object value (token `JsonToken.START_OBJECT`)
  at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: org.cyclonedx.model.Bom["metadata"]->
  org.cyclonedx.model.Component["evidence"]->org.cyclonedx.model.Evidence["occurrences"])

Reproducer:

Code is just:

    @Test
    void test() throws Exception {
        Bom bom = parseSbomXml(new File("."), "quarkus-run-cyclonedx.xml");
    }

    static Bom parseSbomXml(File testDir, String sbomFileName) throws Exception {
        File sbomFile = new File(testDir, "target/" + sbomFileName);
        assertTrue(sbomFile.exists());
        return new XmlParser().parse(sbomFile);
    }

SBOM XML is generated by Quarkus cyclonedx extension (https://quarkus.io/guides/cyclonedx/) during build phase. cc @aloubyansky

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions