You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by bu...@apache.org on 2001/09/01 20:10:27 UTC

[Bug 3255] - CLArgsParser loops infinitely on OPTIONAL options

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

frankm@bayarea.net changed:

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |



------- Additional Comments From frankm@bayarea.net  2001-09-01 11:10 -------
Unfortunately, while a short option with an argument works, the other forms
don't.  Using the test program below, I get the following:

java ArgTest -T -a
[before parsing]
[after parsing]
[[Option , [null] ], [Option , [a] ]]

java ArgTest --trace -a
[before parsing]
[after parsing]
[]

java ArgTest --trace=foo -a
[before parsing]
[after parsing]
[]

----------------------------

import org.apache.avalon.excalibur.cli.*;

class ArgTest {
    private static final int                ALL_OPT           = 'a';
    private static final int                TAINT_OPT         = 'T';
 
    protected final static CLOptionDescriptor TAINT           =
        new CLOptionDescriptor( "taint",
                                CLOptionDescriptor.ARGUMENT_OPTIONAL,
                                TAINT_OPT,
                                "turn on tainting checks (optional level)." );
 
    protected final static CLOptionDescriptor ALL             =
        new CLOptionDescriptor( "all",
                                CLOptionDescriptor.ARGUMENT_DISALLOWED,
                                ALL_OPT,
                                "all");
 
 
    public static void main(String[] args) {
        final CLOptionDescriptor[] options = new CLOptionDescriptor[]
        {
            ALL, TAINT
        };
 
        System.out.println("[before parsing]");
 
        final CLArgsParser parser = new CLArgsParser( args, options );
 
        System.out.println("[after parsing]");
 
        System.out.println(parser.getArguments());
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org