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

Fix bugs in CLI error handling #1570

Merged
merged 3 commits into from
Feb 19, 2024
Merged

Fix bugs in CLI error handling #1570

merged 3 commits into from
Feb 19, 2024

Conversation

tsaglam
Copy link
Member

@tsaglam tsaglam commented Feb 19, 2024

Due to a missing null check, a null pointer exception was caused in the exception handling of the CLI class.

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "picocli.CommandLine$Model$ArgSpec.isOption()" because the return value of "picocli.CommandLine$ParameterException.getArgSpec()" is null
	at de.jplag.cli.CLI.parseOptions(CLI.java:147)
	at de.jplag.cli.CLI.main(CLI.java:77)

This occurs when a user enters a cli flag that does not exist, e.g. --foo-bar.

Furthermore, the CLI API error messages were not properly passed through. Now, the messages of wrapped exceptions are logged as well.

@tsaglam tsaglam added bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change labels Feb 19, 2024
@tsaglam tsaglam changed the title Fix bug in CLI exception handling that leads to a null pointer exception Fix bugs in CLI error handling Feb 19, 2024
@tsaglam tsaglam marked this pull request as ready for review February 19, 2024 14:30
Copy link

sonarcloud bot commented Feb 19, 2024

Quality Gate Passed Quality Gate passed for 'JPlag Plagiarism Detector'

Issues
0 New issues

Measures
0 Security Hotspots
58.3% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@tsaglam tsaglam merged commit 1c87e2e into develop Feb 19, 2024
9 checks passed
@tsaglam tsaglam deleted the fix/cli-exception branch February 19, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants