Skip to content

Commit f43397b

Browse files
committed
Update for external references compatibility
Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
1 parent 5421710 commit f43397b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

README-V3-UPGRADE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ With the support of SPDX 3.0, several changes have been made to the library code
44
Although we tried to keep breaking changes to a minimum, some of the changes were necessary due to breaking changes in the spec. itself.
55
We also took advantage of the changes to fix some annoying design flaws in the previous implementation of the library.
66

7+
## Changes to ExternalElement and ExternalExtractedLicenseInfo (SPDX Version 2.X classes)
8+
9+
- Constructors changed to take the document URI for the document containing the external element or license. This is different from the previous constructor which took the document URI of the document containing the reference and an ID of the form `DocumentRef-XX:[ID]` To accomodate compatibility, the constructors
10+
will check for the old DocumentRef format and attempt a conversion.
11+
- Added a method `referenceElementId(SpdxDocument documentReferencingExternal)` which will convert return the `DocumentRef-XX:[ID]`. This should be used in place of the getId which previously returned this format.
12+
13+
Note that this incompatibility was introduced due to using a common mode store API which in some cases will not have the documentUri as a required parameter
14+
715
## Changes to the SPI for the Model Store
816

917
### Change propertyName to propertyDescriptor

src/test/java/org/spdx/utility/license/LicenseExpressionParserTestV2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public void testExternalLicenseRef() throws InvalidSPDXAnalysisException {
223223
AnyLicenseInfo result = LicenseExpressionParser.parseLicenseExpressionCompatV2(externalExtractedId,
224224
modelStore, TEST_DOCUMENT_URI, null);
225225
assertTrue(result instanceof ExternalExtractedLicenseInfo);
226-
assertEquals(externalExtractedId, ((ExternalExtractedLicenseInfo)result).getId());
226+
assertEquals(externalExtractedId, ((ExternalExtractedLicenseInfo)result).toString());
227227
}
228228

229229
public void regressionMitWith() throws InvalidSPDXAnalysisException, InvalidLicenseStringException {

0 commit comments

Comments
 (0)