Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/org/spdx/library/LicenseInfoFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ public static SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId)th
* @param copyManager allows for copying of any properties set which use other model stores or document URI's. If null, the default will be used.
* @return an SPDXLicenseInfo created from the string. If the license expression is not parseable, a <code>InvalidLicenseExpression</code> is returned.
* @throws DefaultStoreNotInitializedException if the default model store is not initialized
* @throws InvalidLicenseStringException no longer used, a <code>InvalidLicenseExpression</code> is returned on parsing errors - retained for compatibility in the method signature
*/
public static org.spdx.library.model.v2.license.AnyLicenseInfo parseSPDXLicenseStringCompatV2(String licenseString, @Nullable IModelStore store,
@Nullable String documentUri, @Nullable IModelCopyManager copyManager) throws DefaultStoreNotInitializedException {
@Nullable String documentUri, @Nullable IModelCopyManager copyManager) throws DefaultStoreNotInitializedException, InvalidLicenseStringException {
if (Objects.isNull(store)) {
store = DefaultModelStore.getDefaultModelStore();
}
Expand Down Expand Up @@ -217,12 +218,13 @@ private static org.spdx.library.model.v2.license.AnyLicenseInfo fixSingleMemberS
* @param customIdToUri Mapping of the id prefixes used in the license expression to the namespace preceding the external ID
* @return an SPDXLicenseInfo created from the string. If the license expression is not parseable, a <code>InvalidLicenseExpression</code> is returned.
* @throws DefaultStoreNotInitializedException if the default model store is not initialized
* @throws InvalidLicenseStringException no longer used, a <code>InvalidLicenseExpression</code> is returned on parsing errors - retained for compatibility in the method signature
*/
public static AnyLicenseInfo parseSPDXLicenseString(String licenseString, @Nullable IModelStore store,
@Nullable String customLicensePrefix,
@Nullable CreationInfo creationInfo,
@Nullable IModelCopyManager copyManager,
@Nullable List<DictionaryEntry> customIdToUri) throws InvalidLicenseStringException, DefaultStoreNotInitializedException {
@Nullable List<DictionaryEntry> customIdToUri) throws InvalidLicenseStringException, DefaultStoreNotInitializedException, InvalidLicenseStringException {
if (Objects.isNull(store)) {
store = DefaultModelStore.getDefaultModelStore();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ public void testRegressionSameTerms() throws InvalidSPDXAnalysisException {
}

public void testInvalidExceptionOnly() throws InvalidSPDXAnalysisException {
# "389-exception" is a valid license exception,
# but a license expression has to be presented with a license,
# to form a valid license expression.
// "389-exception" is a valid license exception,
// but a license expression has to be presented with a license,
// to form a valid license expression.
AnyLicenseInfo result = LicenseInfoFactory.parseSPDXLicenseStringCompatV2("389-exception");
assertTrue(result instanceof InvalidLicenseExpression);
assertEquals("389-exception", ((InvalidLicenseExpression)result).getLicenseExpression());
Expand Down
Loading