John Keyes wrote:
I don't see any obvious errors. Can you write the test
in plain java and see if that works. If not then post
the class here and I'll have a look at it. Sorry for the abruptness but I am busy at the moment.
Jython is an interpretor written in java, so the behavior of the test will be the same in java... That's said, I wrote my test in plain java, and the exception is the same...
java FooMain -url http://foo.com
usage: java FooMain
-url <myurl> an url
Exception in thread "main" org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -u
at org.apache.commons.cli.Parser.processOption(Parser.java:253)
at org.apache.commons.cli.Parser.parse(Parser.java:170)
at org.apache.commons.cli.Parser.parse(Parser.java:114)
at FooMain.main(FooMain.java:16)
I downloaded sources from cvs, and rebuild the jar. But the problem is still there.
So I searched deeper in the code...
In the PosixParser class, the flatten method is used to parse the command line. In my case (option -url), the token starts with "-" and has a length > 2
so we got
// requires bursting
else
{
burstToken(token, stopAtNonOption);
}
But I don't understand what this method does... the tokens -u, -r and -l are added in the internal ArrayList (named tokens) but the -url token isn't ! So later in the parse method, the hasOption failed, because the -u value has not been added in the options container (main method of the test)...
Well, I changed the else statement in the flatten method of PosixParser
else
{
burstToken(token, stopAtNonOption);
}by
else
{
tokens.add(token);
//burstToken(token, stopAtNonOption);
}the -url is added in the tokens ArrayList and my main program works :
java FooMain -url http://foo.com usage: java FooMain -url <myurl> an url url parameter : http://foo.com
Well, what do you think about that ? thanks
Fred
-- XPath free testing software : http://lantern.sourceforge.net Fr�d�ric Laurent http://www.opikanoba.org
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
