You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/05/10 03:50:14 UTC

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

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: commons-dev@jakarta.apache.org
        ReportedBy: nigel_king@mlc.com.au


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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org