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

Escaped quotes are not recognized #24

@lkiesow

Description

@lkiesow

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions