-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
AgentOptions fails to parse options where destfile contains a comma #358
Comments
@jochenberger Well, this is a limitation of the current agent options syntax. Any ideas for a syntax extension to properly handle such cases? |
If your keys are always lowercase letters, I suggest a RegExp-based approach String optionString = "destfile=build/jacoco/foo, bar.exec,append=true,dumponexit=true,output=file,jmx=false"
Pattern p = ~",(?=[a-z]+=)"
String [] items = p.split(optionString)
assert items == ["destfile=build/jacoco/foo, bar.exec", "append=true", "dumponexit=true", "output=file", "jmx=false"] |
I'm not convinced it's worth the effort, but you could check if the first key is escaped=true and then parse the option string "manually" (without split) so that '' or whatever can be used as an escape char. |
The agent parameter format has its limitations. Also file names with = characters will fail to parse. Also built-in agents fail to parse such file names, e.g.
Therefore I tempted to close this as "wontfix". If we have a compelling use case I would rather suggest to offer an alternative way to configure the agent (e.g. property file) which does not have such syntax limitations. For offline instrumentation this is already supported. |
My suggested fix also works for |
I also wonder about strong use case for comma in filename. |
Well, I have a directory that contains a comma. And I wonder why jacoco should explicitly forbid that. |
Thanks for contributing this fix! I just merged #359. |
@marchof I'm reopening this ticket, because I had hard time debugging patch for Gradle for new configuration option and this change was the root cause:
Notice incorrect spelling in second case - instead it should be lowercase |
And same happens with existing options:
|
In case of invalid agent arguments (e.g. usage of upper case letters) such arguments must be reported properly.
In case of invalid agent arguments (e.g. usage of upper case letters) such arguments must be reported properly.
The text was updated successfully, but these errors were encountered: