File tree Expand file tree Collapse file tree
java/org/apache/commons/cli
test/org/apache/commons/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//cli/src/java/org/apache/commons/cli/Attic/CommandLineParserFactory.java,v 1.1 2002/07/04 22:32:12 jkeyes Exp $
3- * $Revision: 1.1 $
4- * $Date: 2002/07/04 22:32:12 $
2+ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//cli/src/java/org/apache/commons/cli/Attic/CommandLineParserFactory.java,v 1.2 2002/07/25 21:40:08 jkeyes Exp $
3+ * $Revision: 1.2 $
4+ * $Date: 2002/07/25 21:40:08 $
55 *
66 * ====================================================================
77 *
@@ -76,9 +76,12 @@ public class CommandLineParserFactory {
7676 * @return the CommandLineParser
7777 */
7878 public static CommandLineParser newParser () {
79- String parserImpl = System .getProperty ( "org.apache.commons.cli.parser" );
79+ return newParser ( DEFAULT_PARSER );
80+ }
81+
82+ public static CommandLineParser newParser ( String classname ) {
8083 try {
81- return (CommandLineParser )Class .forName ( parserImpl ).newInstance ();
84+ return (CommandLineParser )Class .forName ( classname ).newInstance ();
8285 }
8386 catch ( Exception exp ) {
8487 // could not create according to parserImpl so default to
Original file line number Diff line number Diff line change @@ -35,10 +35,7 @@ public ApplicationTest(String name)
3535 */
3636 public void testAnt () {
3737 // use the GNU parser
38- System .setProperty ( "org.apache.commons.cli.parser" ,
39- "org.apache.commons.cli.GnuParser" );
40-
41- CommandLineParser parser = CommandLineParserFactory .newParser ();
38+ CommandLineParser parser = CommandLineParserFactory .newParser ( "org.apache.commons.cli.GnuParser" );
4239 Options options = new Options ();
4340 options .addOption ( "help" , false , "print this message" );
4441 options .addOption ( "projecthelp" , false , "print project help information" );
Original file line number Diff line number Diff line change 55 * version 1.1, a copy of which has been included with this distribution in
66 * the LICENSE file.
77 *
8- * $Id: GnuParseTest.java,v 1.1 2002/07/04 22:32:12 jkeyes Exp $
8+ * $Id: GnuParseTest.java,v 1.2 2002/07/25 21:40:08 jkeyes Exp $
99 */
1010
1111package org .apache .commons .cli ;
@@ -30,9 +30,6 @@ public GnuParseTest( String name )
3030
3131 public void setUp ()
3232 {
33- System .setProperty ( "org.apache.commons.cli.parser" ,
34- "org.apache.commons.cli.GnuParser" );
35-
3633 _options = new Options ()
3734 .addOption ("a" ,
3835 "enable-a" ,
@@ -47,7 +44,7 @@ public void setUp()
4744 false ,
4845 "turn [c] on or off" );
4946
50- _parser = CommandLineParserFactory .newParser ();
47+ _parser = CommandLineParserFactory .newParser ( "org.apache.commons.cli.GnuParser" );
5148 }
5249
5350 public void tearDown ()
You can’t perform that action at this time.
0 commit comments