Skip to content

Commit 139ad75

Browse files
committed
Update versions for SPDX libraries
1 parent ce69a13 commit 139ad75

8 files changed

Lines changed: 153 additions & 26 deletions

File tree

pom.xml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,17 @@
120120
<dependency>
121121
<groupId>org.spdx</groupId>
122122
<artifactId>java-spdx-library</artifactId>
123-
<version>2.0.0-RC1</version>
123+
<version>2.0.0-RC2</version>
124124
</dependency>
125125
<dependency>
126126
<groupId>org.spdx</groupId>
127127
<artifactId>spdx-rdf-store</artifactId>
128-
<version>2.0.0-RC1</version>
128+
<version>2.0.0-RC2</version>
129129
</dependency>
130130
<dependency>
131131
<groupId>org.spdx</groupId>
132132
<artifactId>spdx-jackson-store</artifactId>
133-
<version>2.0.0-RC1</version>
133+
<version>2.0.0-RC2</version>
134134
</dependency>
135135
<dependency>
136136
<groupId>org.apache.ws.xmlschema</groupId>
@@ -140,12 +140,12 @@
140140
<dependency>
141141
<groupId>org.spdx</groupId>
142142
<artifactId>spdx-spreadsheet-store</artifactId>
143-
<version>2.0.0-RC1</version>
143+
<version>2.0.0-RC2</version>
144144
</dependency>
145145
<dependency>
146146
<groupId>org.spdx</groupId>
147147
<artifactId>spdx-tagvalue-store</artifactId>
148-
<version>2.0.0-RC1</version>
148+
<version>2.0.0-RC2</version>
149149
</dependency>
150150
<dependency>
151151
<groupId>com.networknt</groupId>
@@ -161,7 +161,7 @@
161161
<dependency>
162162
<groupId>org.spdx</groupId>
163163
<artifactId>spdx-v3jsonld-store</artifactId>
164-
<version>1.0.0-RC2</version>
164+
<version>1.0.0-RC3</version>
165165
</dependency>
166166
<dependency>
167167
<groupId>org.apache.poi</groupId>
@@ -175,12 +175,6 @@
175175
<version>5.2.0</version>
176176
<scope>compile</scope>
177177
</dependency>
178-
<dependency>
179-
<groupId>org.spdx</groupId>
180-
<artifactId>spdx-rdf-store</artifactId>
181-
<version>2.0.0-RC1</version>
182-
<scope>compile</scope>
183-
</dependency>
184178
</dependencies>
185179
<build>
186180
<resources>

src/main/java/org/spdx/tools/SpdxConverter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ public static void convert(String fromFilePath, String toFilePath) throws SpdxCo
143143
* @param toFilePath Path of output file for the conversion
144144
* @param fromFileType Serialization type of the file to convert from
145145
* @param toFileType Serialization type of the file to convert to
146-
* @param excludeLicenseDetails If true, don't copy over properties of the listed licenses
147146
* @throws SpdxConverterException
148147
*/
149148
public static void convert(String fromFilePath, String toFilePath, SerFileType fromFileType,
@@ -293,7 +292,7 @@ private static void copyV2ToV3(ISerializableModelStore fromStore,
293292
CreationInfo defaultCreationInfo = Spdx2to3Converter.convertCreationInfo(fromDoc.getCreationInfo(),
294293
toStore, toUriPrefix);
295294
Spdx2to3Converter converter = new Spdx2to3Converter(toStore, copyManager, defaultCreationInfo,
296-
SpdxModelFactory.getLatestSpecVersion(), toUriPrefix);
295+
SpdxModelFactory.getLatestSpecVersion(), toUriPrefix, !excludeLicenseDetails);
297296
converter.convertAndStore(fromDoc);
298297
// Make sure we get all files, packages and snippets - any relationships and annotations will be copied
299298
// as properties. Note that the conversion of the document should already have been copied.

src/main/java/org/spdx/tools/Verify.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,9 @@ public static void main(String[] args) {
128128
* @param filePath File path to the SPDX file to be verified
129129
* @param fileType
130130
* @return A list of verification errors - if empty, the SPDX file is valid
131-
* @throws InvalidFileNameException
132-
* @throws IOException
133-
* @throws SpdxVerificationException
134-
* @throws Errors where the SPDX file can not be parsed or the filename is invalid
131+
* @throws InvalidFileNameException on invalid file name or file not found
132+
* @throws IOException on IO error
133+
* @throws SpdxVerificationException where the SPDX file can not be parsed or the filename is invalid
135134
*/
136135
public static List<String> verify(String filePath, SerFileType fileType) throws SpdxVerificationException {
137136
Objects.requireNonNull(filePath);

src/main/java/org/spdx/tools/compare/DocumentSheet.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ private void setCellEqualValue(Cell cell) {
394394
}
395395

396396
/**
397-
* @param docNames
398397
* @throws SpdxCompareException
399398
* @throws InvalidSPDXAnalysisException
400399
*/

src/main/java/org/spdx/tools/compare/MultiDocumentSpreadsheet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public void importVerificationErrors(
427427
}
428428

429429
/**
430-
* @throws AnalyzeException
430+
* @throws SpreadsheetException
431431
*
432432
*/
433433
public void close() throws SpreadsheetException {

src/test/java/org/spdx/tools/SpdxConverterTestV3.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.nio.file.Path;
1313
import java.util.List;
1414
import java.util.Objects;
15+
import java.util.Optional;
1516

1617
import org.junit.After;
1718
import org.junit.Before;
@@ -20,6 +21,7 @@
2021
import org.spdx.library.ModelCopyManager;
2122
import org.spdx.library.SpdxModelFactory;
2223
import org.spdx.library.model.v3_0_1.core.Element;
24+
import org.spdx.library.model.v3_0_1.core.NamespaceMap;
2325
import org.spdx.library.model.v3_0_1.core.SpdxDocument;
2426
import org.spdx.library.model.v3_0_1.software.SpdxFile;
2527
import org.spdx.library.model.v3_0_1.software.SpdxPackage;
@@ -106,6 +108,12 @@ public void testV2JsonToV3JsonLD() throws SpdxConverterException, InvalidSPDXAna
106108

107109
assertEquals(sourcePackage.getName().get(), resultPackage.getName().get());
108110
assertEquals(sourceFile.getName().get(), resultFile.getName().get());
111+
112+
assertEquals(1, resultDoc.getNamespaceMaps().size());
113+
Optional<NamespaceMap> map = resultDoc.getNamespaceMaps().stream().findFirst();
114+
assertTrue(map.isPresent());
115+
assertEquals("http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301#", map.get().getNamespace());
116+
assertEquals("DocumentRef-spdx-tool-1.2", map.get().getPrefix());
109117
// TODO: create a more extensive set of checks
110118
}
111119

src/test/java/org/spdx/tools/VerifyTest.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class VerifyTest extends TestCase {
3030
static final String TEST_YAML_FILE_PATH = TEST_DIR + File.separator + "SPDXYAMLExample-2.3.spdx.yaml";
3131
static final String TEST_WARNING_FILE_PATH = TEST_DIR + File.separator + "SPDXTagExample-v2.2-warning.spdx";
3232
static final String BAD_JSON_FILE_PATH = TEST_DIR + File.separator + "BadJSON.spdx.json";
33+
static final String DOUBLE_JSON_LD_FILE_PATH = TEST_DIR + File.separator + "double.jsonld";
3334

3435
protected void setUp() throws Exception {
3536
super.setUp();
@@ -44,7 +45,7 @@ protected void tearDown() throws Exception {
4445

4546
public void testUpsupportedVersionFields() throws SpdxVerificationException {
4647
List<String> result = Verify.verify(TEST_V23_FIELDS_IN_V22_FILE, SerFileType.JSON);
47-
assertTrue(result.size() > 0);
48+
assertFalse(result.isEmpty());
4849
}
4950

5051
public void testVerifyTagFile() throws SpdxVerificationException {
@@ -72,13 +73,13 @@ public void testVerify() throws SpdxVerificationException {
7273

7374
public void testVerifyWarning() throws SpdxVerificationException {
7475
List<String> result = Verify.verify(TEST_WARNING_FILE_PATH, SerFileType.TAG);
75-
assertTrue(result.size() > 0);
76+
assertFalse(result.isEmpty());
7677
assertTrue(result.get(0).contains("deprecated"));
7778
}
7879

7980
public void testVerifyBadJSON() throws SpdxVerificationException {
8081
List<String> result = Verify.verify(BAD_JSON_FILE_PATH, SerFileType.JSON);
81-
assertTrue(result.size() == 4);
82+
assertEquals(4, result.size());
8283
}
8384

8485
public void testVerifyJsonLD() throws SpdxVerificationException {
@@ -89,10 +90,15 @@ public void testVerifyJsonLD() throws SpdxVerificationException {
8990
// Test specific spec versions for the JSON format
9091
public void testVerifyJSONVersion() throws SpdxVerificationException {
9192
List<String> result = Verify.verify(JSON_V2_2_FILE_PATH, SerFileType.JSON);
92-
assertTrue(result.size() == 0);
93+
assertEquals(0, result.size());
9394
result = Verify.verify(JSON_V2_3_FILE_PATH, SerFileType.JSON);
94-
assertTrue(result.size() == 0);
95+
assertEquals(0, result.size());
9596
result = Verify.verify(JSON_BAD_VERSION_FILE_PATH, SerFileType.JSON); // a 2.3 version syntax with a 2.2 specversion
96-
assertTrue(result.size() > 0);
97+
assertFalse(result.isEmpty());
98+
}
99+
100+
public void testVerifyDouble() throws SpdxVerificationException {
101+
List<String> result = Verify.verify(DOUBLE_JSON_LD_FILE_PATH, SerFileType.JSONLD);
102+
assertEquals(0, result.size());
97103
}
98104
}

testResources/double.jsonld

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"@context": "https://spdx.org/rdf/3.0.1/spdx-context.jsonld",
3+
"@graph": [
4+
{
5+
"type": "Organization",
6+
"spdxId": "SPDXRef-MyOrganization:-73f9a129-5eea-4de8-b38b-96832cc72d57",
7+
"name": "MyOrganization",
8+
"creationInfo": "_:creationinfo"
9+
},
10+
{
11+
"type": "CreationInfo",
12+
"@id": "_:creationinfo",
13+
"specVersion": "3.0.1",
14+
"createdBy": [
15+
"SPDXRef-MyOrganization:-73f9a129-5eea-4de8-b38b-96832cc72d57"
16+
],
17+
"created": "2025-01-07T07:01:21Z"
18+
},
19+
{
20+
"type": "SpdxDocument",
21+
"spdxId": "SPDXRef-Document:-8b2134c3-1472-48c3-bbd9-53cdef129f09",
22+
"creationInfo": "_:creationinfo",
23+
"dataLicense": "SPDXRef-License:-DataLicenseCC1.0",
24+
"profileConformance": [
25+
"core",
26+
"software",
27+
"security",
28+
"simpleLicensing"
29+
],
30+
"rootElement": [
31+
"BOM:ROOT"
32+
]
33+
},
34+
{
35+
"type": "simplelicensing_LicenseExpression",
36+
"spdxId": "SPDXRef-License:-DataLicenseCC1.0",
37+
"name": "Data License CC 1.0",
38+
"description": "Refer to this element if another element's data license is CC 1.0",
39+
"creationInfo": "_:creationinfo",
40+
"simplelicensing_licenseExpression": "CC-BY-1.0"
41+
},
42+
{
43+
"type": "simplelicensing_LicenseExpression",
44+
"spdxId": "SPDXRef-License:-NoAssertion",
45+
"name": "NoAssertion",
46+
"description": "Refer to this element if another element's license can't be asserted.",
47+
"creationInfo": "_:creationinfo",
48+
"simplelicensing_licenseExpression": "NOASSERTION"
49+
},
50+
{
51+
"type": "software_Package",
52+
"spdxId": "SPDX-ID:-73fde02b-0fda-50b2-ad2e-a219f85c7ce4",
53+
"creationInfo": "_:creationinfo",
54+
"name": "An example software",
55+
"originatedBy": [
56+
"Organization: An example organization"
57+
],
58+
"software_copyrightText": "NOASSERTION",
59+
"software_primaryPurpose": "application",
60+
"description": "This is an example software"
61+
},
62+
{
63+
"type": "security_Vulnerability",
64+
"spdxId": "SPDXRef-Vulnerability:-CVE-2016-4285",
65+
"name": "CVE-2016-4285",
66+
"creationInfo": "_:creationinfo",
67+
"externalIdentifier": [
68+
{
69+
"type": "ExternalIdentifier",
70+
"externalIdentifierType": "cve",
71+
"identifier": "CVE-2016-4285",
72+
"identifierLocator": [
73+
"https://nvd.nist.gov/vuln/detail/CVE-2016-4285"
74+
]
75+
}
76+
]
77+
},
78+
{
79+
"type": "security_CvssV3VulnAssessmentRelationship",
80+
"spdxId": "SPDXRef-CVSSAssessment:-CVE-2016-4285",
81+
"creationInfo": "_:creationinfo",
82+
"relationshipType": "hasAssessmentFor",
83+
"security_score": "8.8",
84+
"security_severity": "high",
85+
"security_vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
86+
"from": "SPDXRef-Vulnerability:-CVE-2016-4285",
87+
"to": [
88+
"SPDX-ID:-73fde02b-0fda-50b2-ad2e-a219f85c7ce4"
89+
]
90+
},
91+
{
92+
"type": "security_VexAffectedVulnAssessmentRelationship",
93+
"spdxId": "SPDXRef-VexAffectedRelationship:-CVE-2016-4285",
94+
"creationInfo": "_:creationinfo",
95+
"relationshipType": "affects",
96+
"security_actionStatement": "no_assertion",
97+
"from": "SPDXRef-Vulnerability:-CVE-2016-4285",
98+
"to": [
99+
"SPDX-ID:-73fde02b-0fda-50b2-ad2e-a219f85c7ce4"
100+
]
101+
},
102+
{
103+
"type": "software_Sbom",
104+
"spdxId": "BOM:ROOT",
105+
"creationInfo": "_:creationinfo",
106+
"software_sbomType": [
107+
"analyzed"
108+
],
109+
"rootElement": [
110+
"SPDX-ID:-73fde02b-0fda-50b2-ad2e-a219f85c7ce4"
111+
],
112+
"element": [
113+
"SPDXRef-License:-DataLicenseCC1.0",
114+
"SPDXRef-License:-NoAssertion",
115+
"SPDX-ID:-73fde02b-0fda-50b2-ad2e-a219f85c7ce4",
116+
"SPDXRef-Vulnerability:-CVE-2016-4285",
117+
"SPDXRef-CVSSAssessment:-CVE-2016-4285",
118+
"SPDXRef-VexAffectedRelationship:-CVE-2016-4285"
119+
]
120+
}
121+
]
122+
}

0 commit comments

Comments
 (0)