DO NOT REPLY [Bug 34831] New: - CLI misinterprets parameter value "-something" as a parameter

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DO NOT REPLY [Bug 34831] New: - CLI misinterprets parameter value "-something" as a parameter

Bugzilla from bugzilla@apache.org
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG?
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34831>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND?
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34831

           Summary: CLI misinterprets parameter value "-something" as a
                    parameter
           Product: Commons
           Version: Nightly Builds
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: critical
          Priority: P1
         Component: CLI
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


If a parameter value is passed that contains a hyphen as the (delimited) first
character, CLI parses this a parameter. For example using the call
java myclass -t "-something"
Results in the parser creating the invalid parameter -o (noting that it is
skipping the 's')

My code is using the Posix parser as follows
Options options = buildCommandLineOptions();
CommandLineParser parser = new PosixParser();
CommandLine commandLine = null;
try {
                       
        commandLine = parser.parse(options, args);
}
catch (ParseException e) {
                       
        System.out.println("Invalid parameters. " + e.getMessage() + NEW_LINE);
        System.exit(EXIT_CODE_ERROR);
}

This has been tested against the nightly build dated 20050503.

--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]