diff --git a/src/main/java/org/spdx/library/LicenseInfoFactory.java b/src/main/java/org/spdx/library/LicenseInfoFactory.java
index 5d425a20..ee9ecde2 100644
--- a/src/main/java/org/spdx/library/LicenseInfoFactory.java
+++ b/src/main/java/org/spdx/library/LicenseInfoFactory.java
@@ -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 InvalidLicenseExpression is returned.
* @throws DefaultStoreNotInitializedException if the default model store is not initialized
+ * @throws InvalidLicenseStringException no longer used, a InvalidLicenseExpression 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();
}
@@ -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 InvalidLicenseExpression is returned.
* @throws DefaultStoreNotInitializedException if the default model store is not initialized
+ * @throws InvalidLicenseStringException no longer used, a InvalidLicenseExpression 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 customIdToUri) throws InvalidLicenseStringException, DefaultStoreNotInitializedException {
+ @Nullable List customIdToUri) throws InvalidLicenseStringException, DefaultStoreNotInitializedException, InvalidLicenseStringException {
if (Objects.isNull(store)) {
store = DefaultModelStore.getDefaultModelStore();
}
diff --git a/src/test/java/org/spdx/utility/license/LicenseExpressionParserTestV2.java b/src/test/java/org/spdx/utility/license/LicenseExpressionParserTestV2.java
index a825ccb9..e6611139 100644
--- a/src/test/java/org/spdx/utility/license/LicenseExpressionParserTestV2.java
+++ b/src/test/java/org/spdx/utility/license/LicenseExpressionParserTestV2.java
@@ -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());