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

CLI wrongly interprets non-existing options #1490

Open
Godin opened this issue Jun 28, 2023 · 0 comments
Open

CLI wrongly interprets non-existing options #1490

Godin opened this issue Jun 28, 2023 · 0 comments
Labels
component: cli type: bug 🐛 Something isn't working

Comments

@Godin
Copy link
Member

Godin commented Jun 28, 2023

Execution of

java -jar jacoco-0.8.10/lib/jacococli.jar report --excludes

leads to

"--excludes" is not a valid option

as expected.

However execution of

java -jar jacoco-0.8.10/lib/jacococli.jar report --classfiles Example.class --html report --sourcefiles . --excludes=bar

unexpectedly leads to

Exception in thread "main" java.io.UnsupportedEncodingException: bar

i.e. --excludes=bar is interpreted as --encoding bar.

Execution of

java -jar jacoco-0.8.10/lib/jacococli.jar report --classfiles Example.class --html report --foo=bar

unexpectedly leads to creation of a file bar containing XML report, i.e. --foo=bar is interpreted as --xml.

Seems that this happens due to the following code in args4j
https://github.com/kohsuke/args4j/blob/args4j-site-2.0.28/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L586-L599
https://github.com/kohsuke/args4j/blob/args4j-site-2.0.28/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L481-L483

@Godin Godin added type: bug 🐛 Something isn't working component: cli labels Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: cli type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant