Skip to content

Improve license parsing error messages#339

Merged
goneall merged 1 commit intomasterfrom
issue338
Sep 22, 2025
Merged

Improve license parsing error messages#339
goneall merged 1 commit intomasterfrom
issue338

Conversation

@goneall
Copy link
Member

@goneall goneall commented Jul 3, 2025

Fixes #338

Dependes on updates to the SPDX Models versions 2 and 3 which add a new class "InvalidLicenseExpression" which is used to produce the errors.

This changes the behavior of the license parser from throwing an exception to returning an InvalidLicenseExpression where the verify routine will return the error message.

goneall added a commit to spdx/spdx-java-model-2_X that referenced this pull request Jul 3, 2025
Supports improvements to the license parsing error handling.

See spdx/Spdx-Java-Library#339 for reference.
goneall added a commit to spdx/spdx-model-to-java that referenced this pull request Jul 3, 2025
Supports improvements to the license parsing error handling.

See spdx/Spdx-Java-Library#339 for reference.
goneall added a commit to spdx/spdx-java-model-2_X that referenced this pull request Jul 3, 2025
Supports improvements to the license parsing error handling.

See spdx/Spdx-Java-Library#339 for reference.
@bact bact added enhancement New feature or request error-handling How errors are caught, processed, and communicated and removed enhancement New feature or request labels Jul 4, 2025
goneall added a commit to spdx/spdx-model-to-java that referenced this pull request Jul 6, 2025
Supports improvements to the license parsing error handling.

See spdx/Spdx-Java-Library#339 for reference.
@goneall goneall mentioned this pull request Sep 17, 2025
9 tasks
Fixes #338

Dependes on updates to the SPDX Models versions 2 and 3 which add
a new class "InvalidLicenseExpression" which is used to produce the
errors.

This changes the behavior of the license parser from throwing an
exception to returning an InvalidLicenseExpression where the verify
routine will return the error message.
@goneall goneall marked this pull request as ready for review September 22, 2025 17:17
@goneall goneall requested review from bact and pmonks September 22, 2025 17:17
Copy link
Collaborator

@pmonks pmonks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: I didn't actually try compiling and running this code.

This change seems pretty straightforward, though it does break backwards compatibility, so perhaps an update to the docs is worthwhile?

IIRC we don't (yet) create a GitHub release for each new version of the library, but perhaps that's worth considering, since that generates fairly reasonable releases notes automatically (even though they are otherwise not very useful in the Java/Maven ecosystem)?

We might also choose a PR naming convention that indicates whether a change is breaking or not (perhaps a [BREAKING CHANGE] suffix, or similar verbiage), since that would make the automated release notes more useful to consumers.

@goneall
Copy link
Member Author

goneall commented Sep 22, 2025

IIRC we don't (yet) create a GitHub release for each new version of the library, but perhaps that's worth considering, since that generates fairly reasonable releases notes automatically (even though they are otherwise not very useful in the Java/Maven ecosystem)?

We do actually create GitHub releases in addition to the Maven releases.

@goneall goneall merged commit ce8b54d into master Sep 22, 2025
1 check passed
@goneall goneall deleted the issue338 branch September 22, 2025 17:53
@pmonks
Copy link
Collaborator

pmonks commented Sep 22, 2025

Ah ok. It must be filtered out by the GitHub mobile client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error-handling How errors are caught, processed, and communicated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error handling for invalid license expressions

3 participants