Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-262

Util.stripLeadingAndTrailingQuotes strips quotes that are unmatched

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Parser
    • None

    Description

      Util.stripLeadingAndTrailingQuotes is described as:

      /**
           * 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.
           */
      

      However, in cases where you have

      "'one two'
      

      the returned result is:

      'one two'
      

      This leads to unexpected results. For example, an option like:

      -option 'command "suboption"' 
      

      ends up being parsed as:

      command "suboption
      

      The method should be modified to only strip unmatched quotes or a new method should be made and added to the API.

      Attachments

        Activity

          People

            Unassigned Unassigned
            cotedm Dustin Cote
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: