CycloneDX / CycloneDX/cyclonedx-core-java

Parsing ISO 8601 compliant metadata.timestamp returns null in bom

Open
#681 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
120
Forks
90
Avg merge
12h 43m
Merged PRs (30d)
18

Description

Parsing a bom with ISO 8601 compliant available metadata.timestamp using a version > 9.1.0 returns a bom object with value null
for metadata.timestamp.

Code to reproduce the behaviour (or run the test in BomParserTest in attached TestSbomImport):

```
import org.cyclonedx.model.Bom;
import org.cyclonedx.parsers.JsonParser;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

public class BomParserTest {
@Test
void manTest() {
try {
String bomContent = new String(Files.readAllBytes(new File("src/test/resources/bom.json").toPath()));
Bom b = new JsonParser().parse(bomContent.getBytes(StandardCharsets.UTF_8));
// works with 9.1.0 but not with later versions
assertNotNull(b.getMetadata().getTimestamp());
}
catch (Exception e) {
assertNull(e);
}
}
}
```
[TestSbomImport.zip](https://github.com/user-attachments/files/21527027/TestSbomImport.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.