Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure JPlag fails gracefully if JavaC is not available and Java code is analyzed #1835

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

tsaglam
Copy link
Member

@tsaglam tsaglam commented Jul 1, 2024

Sometimes users run JPlag without a full JDK, and thus JavaC is not available. This manifests in an error like this:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/source/util/SourcePositions
        at de.jplag.java.Parser.parse(Parser.java:24)

To this end, this PR checks if JavaC is available by trying to load a corresponding class. If this does not work, it fails gracefully. To implement this, the exceptions of the API were extended: Language modules can now throw a CriticalParsingException, which leads to termination. The core uses a new subclass of ExitException to wrap this and pass it to the top.

…tting exceptions for critical language issues.
@tsaglam tsaglam added enhancement Issue/PR that involves features, improvements and other changes minor Minor issue/feature/contribution/change language PR / Issue deals (partly) with new and/or existing languages for JPlag labels Jul 1, 2024
@tsaglam tsaglam requested review from a team July 1, 2024 15:06
@tsaglam tsaglam marked this pull request as ready for review July 1, 2024 15:06
@tsaglam tsaglam added this to the 6.0.0 milestone Jul 1, 2024
Copy link

sonarqubecloud bot commented Jul 2, 2024

Quality Gate Failed Quality Gate failed for 'JPlag Plagiarism Detector'

Failed conditions
46.7% Coverage on New Code (required ≥ 50%)

See analysis details on SonarCloud

@tsaglam tsaglam requested a review from TwoOfTwelve July 2, 2024 07:17
@tsaglam tsaglam merged commit 3602114 into develop Jul 3, 2024
43 of 44 checks passed
@tsaglam tsaglam deleted the feature/javac-check branch July 3, 2024 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue/PR that involves features, improvements and other changes language PR / Issue deals (partly) with new and/or existing languages for JPlag minor Minor issue/feature/contribution/change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants