Skip to content

Commit 122d83a

Browse files
authored
Merge pull request #123 from spdx/improveparseerror
Improve parse exception error handling
2 parents 4919741 + 5e3a907 commit 122d83a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/java/org/spdx/library/model/license/LicenseExpressionParser.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ private static AnyLicenseInfo parseLicenseExpression(String[] tokens, IModelStor
183183
}
184184
if (exceptionId.isPresent()) {
185185
licenseException = LicenseInfoFactory.getListedExceptionById(exceptionId.get());
186+
} else if (token.startsWith(SpdxConstants.NON_STD_LICENSE_ID_PRENUM)) {
187+
throw new LicenseParserException("WITH must be followed by a license exception. "+token+" is a Listed License type.");
186188
} else {
187189
licenseException = (LicenseException) SpdxModelFactory.createModelObject(store,
188190
documentUri, token, SpdxConstants.CLASS_SPDX_LICENSE_EXCEPTION, copyManager);

0 commit comments

Comments
 (0)