Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Escaped quotes are not recognized #24

Open
lkiesow opened this issue Oct 16, 2017 · 0 comments
Open

Escaped quotes are not recognized #24

lkiesow opened this issue Oct 16, 2017 · 0 comments

Comments

@lkiesow
Copy link

lkiesow commented Oct 16, 2017

On a shell, the following works without problem:

% echo "-\"-"
-"-

But CommandLineUtils.translateCommandline will fail to parse this command line

import org.codehaus.plexus.util.cli.CommandLineUtils;

class TestQuotes {
  public static void main(String[] args) throws Exception {
    CommandLineUtils.translateCommandline("echo \"-\\\"-\"");
  }
}

Running this program:

java TestQuotes
Exception in thread "main" org.codehaus.plexus.util.cli.CommandLineException: unbalanced quotes in echo "-\"-"
        at org.codehaus.plexus.util.cli.CommandLineUtils.translateCommandline(CommandLineUtils.java:377)
        at TestQuotes.main(TestQuotes.java:5)

Clearly, it fails since it does not recognize the second quote to be escaped.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant