commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dustin Cote (JIRA)" <>
Subject [jira] [Commented] (CLI-262) Util.stripLeadingAndTrailingQuotes strips quotes that are unmatched
Date Fri, 03 Feb 2017 20:55:51 GMT


Dustin Cote commented on CLI-262:

[~sashivit01] I don't know, I opened this a year ago and maybe things have changed. The code
you are showing isn't checking for unmatched quotes either so I doubt it. The description
in the JIRA is pretty clear I think in terms of outlining a test case for you. For your specific

-option 'command "suboption"' 

actually returned 
command "suboption

which is unexpected from a user standpoint. Maybe simple code inspection isn't the answer
and I might suggest trying the test case out on the latest version in case someone has since
fixed it? Because I've opened this a year ago (and got no traction) I've lost a bit of interest
in fixing it but if you want to start it back up, please let me know and I'll try to look
into how I ran into this in the first place.

> Util.stripLeadingAndTrailingQuotes strips quotes that are unmatched
> -------------------------------------------------------------------
>                 Key: CLI-262
>                 URL:
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: Parser
>            Reporter: Dustin Cote
>            Priority: Minor
> Util.stripLeadingAndTrailingQuotes is described as:
> {code}
> /**
>      * Remove the leading and trailing quotes from <code>str</code>.
>      * E.g. if str is '"one two"', then 'one two' is returned.
>      *
>      * @param str The string from which the leading and trailing quotes
>      * should be removed.
>      *
>      * @return The string without the leading and trailing quotes.
>      */
> {code}
> However, in cases where you have 
> {code}
> "'one two'
> {code}
> the returned result is:
> {code}
> 'one two'
> {code}
> This leads to unexpected results.  For example, an option like:
> {code}
> -option 'command "suboption"' 
> {code}
> ends up being parsed as:
> {code}
> command "suboption
> {code}
> The method should be modified to only strip unmatched quotes or a new method should be
made and added to the API.

This message was sent by Atlassian JIRA

View raw message