Issue Details (XML | Word | Printable)

Key: CLI-51
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Henri Yandell
Reporter: Nigel King
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons CLI

[cli] Parameter value "-something" misinterpreted as a parameter

Created: 10/May/05 10:50 AM   Updated: 22/May/07 05:47 PM
Return to search
Component/s: CLI-1.x
Affects Version/s: Nightly Builds
Fix Version/s: 1.1

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works CL51.patch 2007-05-15 01:00 PM Brian Egge 2 kB
Text File Licensed for inclusion in ASF works CL51.patch 2007-05-13 07:28 AM Brian Egge 6 kB
Environment:
Operating System: Windows NT
Platform: PC

Bugzilla Id: 34831
Resolution Date: 22/May/07 05:47 PM

Sub-Tasks  All   Open   

 Description  « Hide
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.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.