Fix StringUtils.quoteArgument(String) when input contains single and double quotes#309
Conversation
|
Sorry, but that changes the documented API of the method. |
|
@sebbASF The last arg is |
|
Ok, sorry - (haven't had my coffee yet). On further review, I agree with that there is a problem with the existing code, as it can strip quotes that are unmatched in type - and number. This PR should fix that. It would be helpful to have some more tests, e.g. to show when IAE is thrown. |
|
@sebbASF Updated unit tests to add IAE check. |
|
Thanks, however the new test fails checkstyle - line too long. |
|
@sebbASF Fixed. |
|
Thanks for your work on this |
|
@sebbASF |
|
Sorry, it's been a while. Maybe the PR template should include a task to update changes.xml? |
Hi Sebb. We could do that but this is a task for the person doing the merging, or someone who knows what to put in an entry, and it should not be in a PR unless the PR author has an Apache ID to put in the dev field, AND then changes.xml can have conflicts with other PRs as soon as another is merged. So... it might be simpler to say nothing. |
What's the purpose of this PR?
Issue:
When using CommandLine to parse the command
bash -c "echo 'hi'"it returns[bash, -c, "echo 'hi"].However the expected result is
[bash, -c, "echo 'hi'"].Cause:
In handleQuoting mode, the
org.apache.commons.exec.util.StringUtils#quoteArgumentwill directly delete the last quote char.Tasks
Thanks for your contribution to Apache Commons! Your help is appreciated!
Before you push a pull request, review this list:
mvn; that'smvnon the command line by itself.