Skip to content

Commit

Permalink
Generate a warning if attempting to serialize SPDX V3 data
Browse files Browse the repository at this point in the history
Fixes #73

Signed-off-by: Gary O'Neall <[email protected]>
  • Loading branch information
goneall committed Oct 12, 2024
1 parent 0b10246 commit 251ab7a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/spdx/jacksonstore/MultiFormatStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ public synchronized void serialize(OutputStream stream, @Nullable CoreModelObjec
List<String> allDocuments = getAllItems(null, SpdxConstantsCompatV2.CLASS_SPDX_DOCUMENT)
.map(tv -> tv.getObjectUri().substring(0, tv.getObjectUri().indexOf('#')))
.collect(Collectors.toList());
if (allDocuments.isEmpty()) {
logger.warn("No SPDX Spec Version 2 Documents were found to serialize. Note: For SPDX Spec version 3, the spdx-v3jsonld-store should be used");
}
output = allDocuments.size() == 1 ? serializer.docToJsonNode(allDocuments.get(0)) :
serializer.docsToJsonNode(allDocuments);
}
Expand Down

0 comments on commit 251ab7a

Please sign in to comment.