commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15046] New: - MissingArgumentException: no argument for <option> is thrown when the option's parameter equals to an existing option.
Date Wed, 04 Dec 2002 03:41:24 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15046>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15046

MissingArgumentException: no argument for <option> is thrown when the option's parameter
equals to an existing option.

           Summary: MissingArgumentException: no argument for <option> is
                    thrown when the option's parameter equals to an existing
                    option.
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CLI
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: ledestin@amur.ru


MissingArgumentException: no argument for <option> is thrown when the option's
parameter equals to an existing option. Example:
-l option1
-m option2

//this will throw exception
$app -l m

Test case follows:
import junit.framework.*;
import org.apache.log4j.*;
import org.apache.commons.cli.*;

public class CliTest extends TestCase {
	CommandLineParser parser;
	
	public CliTest(String name) {
		super(name);
	}
	protected void setUp() throws Exception {
		parser = new PosixParser();
	}
	public void testParamNamedAsOption() throws Exception {
		final String[] CLI_ARGS = new String[] {"-z", "c"};
		Option option = new Option("z", "timezone", true, 
			"affected option");
		Options cliOptions = new Options();
		cliOptions.addOption(option);
		parser.parse(cliOptions, CLI_ARGS);
		
		//now add conflicting option
		cliOptions.addOption("c", "conflict", true, "conflict option");
		parser.parse(cliOptions, CLI_ARGS);
	}
}

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message