Hi John,
> I have recently tested this out (a test case has been added to
> org.apache.common.cli.BugsTest) and could not reproduce the error.
>
> Can you include a test that you show is failing. Thanks,
it seems that I run into a JBuilder issue yesterday. I found this bug in the
1.0-release and replaced the jar with daily build after I found your mails and the
report in the bugtracking system. But it seems that JBuilder caches the classes
somehow (I didn't end the environment, just reloaded the project...). Today I tried
again with an extended testcase and restarted the whole JBuilder after replacing the
commons-cli-jar and found that it works like a charm with the daily build-version. The
1.0-release contains the bug as you know...
Here's the testcase:
import junit.framework.*;
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", "-y", "1"};
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);
}
public void testParamNamedAsOptionNumerical() throws Exception {
final String[] CLI_ARGS = new String[] {"-s", "1"};
Option option = new Option("s", "step", true,
"startstep");
Options cliOptions = new Options();
cliOptions.addOption(option);
parser.parse(cliOptions, CLI_ARGS);
//now add conflicting option
cliOptions.addOption("1", "conflict", true, "jump to step1");
parser.parse(cliOptions, CLI_ARGS);
}
}
Thanks for your afford,
Jörg
PS: IMHO the bug report could be closed, or at least someone should add a comment that
that issue is solved in CVS...
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>