commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r680644 [1/2] - in /commons/proper/cli/branches/cli-1.x: ./ src/conf/ src/java/org/apache/commons/cli/ src/test/org/apache/commons/cli/
Date Tue, 29 Jul 2008 08:13:50 GMT
Author: ebourg
Date: Tue Jul 29 01:13:48 2008
New Revision: 680644

URL: http://svn.apache.org/viewvc?rev=680644&view=rev
Log:
Style update

Added:
    commons/proper/cli/branches/cli-1.x/src/conf/HEADER.txt
      - copied, changed from r658681, commons/proper/configuration/branches/configuration2_experimental/conf/HEADER.txt
    commons/proper/cli/branches/cli-1.x/src/conf/checkstyle.xml
      - copied, changed from r658686, commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml
Modified:
    commons/proper/cli/branches/cli-1.x/pom.xml
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/AlreadySelectedException.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/BasicParser.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLine.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLineParser.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/GnuParser.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingArgumentException.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingOptionException.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionBuilder.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionGroup.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionValidator.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Options.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/ParseException.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Parser.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PatternOptionBuilder.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PosixParser.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/UnrecognizedOptionException.java
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Util.java
    commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ArgumentIsOptionTest.java
    commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/UtilTest.java

Modified: commons/proper/cli/branches/cli-1.x/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/pom.xml?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/pom.xml (original)
+++ commons/proper/cli/branches/cli-1.x/pom.xml Tue Jul 29 01:13:48 2008
@@ -129,13 +129,16 @@
   </dependencies>
 
   <properties>
+    <maven.compile.source>1.3</maven.compile.source>
+    <maven.compile.target>1.3</maven.compile.target>
     <commons.componentid>cli</commons.componentid>
+    <commons.release.version>1.2</commons.release.version>
+    <commons.release.name>commons-configuration-${commons.release.version}</commons.release.name>
     <commons.osgi.symbolicName>org.apache.commons.cli</commons.osgi.symbolicName>
-    <commons.release.version>1.1</commons.release.version>
     <commons.binary.suffix></commons.binary.suffix>
     <commons.jira.id>CLI</commons.jira.id>
     <commons.jira.pid>12310463</commons.jira.pid>
-  </properties> 
+  </properties>
 
   <build>
     <sourceDirectory>src/java</sourceDirectory>
@@ -186,6 +189,17 @@
         </configuration>
       </plugin>
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <configLocation>src/conf/checkstyle.xml</configLocation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+      </plugin>
+      <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>cobertura-maven-plugin</artifactId>
         <version>2.2</version>

Copied: commons/proper/cli/branches/cli-1.x/src/conf/HEADER.txt (from r658681, commons/proper/configuration/branches/configuration2_experimental/conf/HEADER.txt)
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/conf/HEADER.txt?p2=commons/proper/cli/branches/cli-1.x/src/conf/HEADER.txt&p1=commons/proper/configuration/branches/configuration2_experimental/conf/HEADER.txt&r1=658681&r2=680644&rev=680644&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/conf/HEADER.txt (original)
+++ commons/proper/cli/branches/cli-1.x/src/conf/HEADER.txt Tue Jul 29 01:13:48 2008
@@ -1,4 +1,4 @@
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Copied: commons/proper/cli/branches/cli-1.x/src/conf/checkstyle.xml (from r658686, commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml)
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/conf/checkstyle.xml?p2=commons/proper/cli/branches/cli-1.x/src/conf/checkstyle.xml&p1=commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml&r1=658686&r2=680644&rev=680644&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/conf/checkstyle.xml (original)
+++ commons/proper/cli/branches/cli-1.x/src/conf/checkstyle.xml Tue Jul 29 01:13:48 2008
@@ -21,9 +21,11 @@
     <module name="Translation"/>
 
     <!-- Exceptions -->
+    <!--
     <module name="SuppressionFilter">
         <property name="file" value="conf/checkstyle-suppressions.xml"/>
     </module>
+    -->
 
     <module name="TreeWalker">
 
@@ -58,8 +60,7 @@
         <!-- Checks for Headers                              -->
         <!-- See http://checkstyle.sf.net/config_header.html -->
         <module name="Header">
-            <property name="headerFile" value="conf/HEADER.txt"/>
-            <property name="ignoreLines" value="2"/>
+            <property name="headerFile" value="src/conf/HEADER.txt"/>
         </module>
 
         <!-- Following interprets the header file as regular expressions. -->
@@ -157,10 +158,12 @@
         <!-- Miscellaneous other checks.                   -->
         <!-- See http://checkstyle.sf.net/config_misc.html -->
         <module name="ArrayTypeStyle"/>
+        <!--
         <module name="GenericIllegalRegexp">
             <property name="format" value="\s+$"/>
             <property name="message" value="Line has trailing spaces."/>
         </module>
+        -->
         <module name="TodoComment"/>
         <module name="UpperEll"/>
 

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/AlreadySelectedException.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/AlreadySelectedException.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/AlreadySelectedException.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/AlreadySelectedException.java Tue Jul 29 01:13:48 2008
@@ -22,7 +22,7 @@
  * has been provided.
  *
  * @author John Keyes ( john at integralsource.com )
- * @see ParseException
+ * @version $Revision$, $Date$
  */
 public class AlreadySelectedException extends ParseException
 {
@@ -53,8 +53,8 @@
      */
     public AlreadySelectedException(OptionGroup group, Option option)
     {
-        this("The option '" + option.getKey() + "' was specified but an option from this group " +
-                "has already been selected: '" + group.getSelected() + "'");
+        this("The option '" + option.getKey() + "' was specified but an option from this group "
+                + "has already been selected: '" + group.getSelected() + "'");
         this.group = group;
         this.option = option;
     }
@@ -62,6 +62,7 @@
     /**
      * Returns the option group where another option has been selected.
      *
+     * @return the related option group
      * @since 1.2
      */
     public OptionGroup getOptionGroup()
@@ -72,6 +73,7 @@
     /**
      * Returns the option that was added to the group and triggered the exception.
      *
+     * @return the related option
      * @since 1.2
      */
     public Option getOption()

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/BasicParser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/BasicParser.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/BasicParser.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/BasicParser.java Tue Jul 29 01:13:48 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.cli;
 
 /**
@@ -21,13 +22,13 @@
  * the {@link Parser#flatten(Options,String[],boolean) flatten} method.
  *
  * @author John Keyes (john at integralsource.com)
- * @see Parser
+ * @version $Revision$, $Date$
  */
-public class BasicParser extends Parser {
-
+public class BasicParser extends Parser
+{
     /**
      * <p>A simple implementation of {@link Parser}'s abstract
-     * {@link Parser#flatten(Options,String[],boolean) flatten} method.</p>
+     * {@link Parser#flatten(Options, String[], boolean) flatten} method.</p>
      *
      * <p><b>Note:</b> <code>options</code> and <code>stopAtNonOption</code>
      * are not used in this <code>flatten</code> method.</p>
@@ -38,10 +39,9 @@
      * when an non option is found.
      * @return The <code>arguments</code> String array.
      */
-    protected String[] flatten(Options options, String[] arguments, 
-                               boolean stopAtNonOption)
+    protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
     {
         // just echo the arguments
         return arguments;
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLine.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLine.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLine.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLine.java Tue Jul 29 01:13:48 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.cli;
 
 import java.io.Serializable;
@@ -24,9 +25,8 @@
 import java.util.List;
 import java.util.Properties;
 
-/** 
- * <p>Represents list of arguments parsed against
- * a {@link Options} descriptor.<p>
+/**
+ * Represents list of arguments parsed against a {@link Options} descriptor.
  *
  * <p>It allows querying of a boolean {@link #hasOption(String opt)},
  * in addition to retrieving the {@link #getOptionValue(String opt)}
@@ -38,9 +38,10 @@
  * @author bob mcwhirter (bob @ werken.com)
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  * @author John Keyes (john at integralsource.com)
+ * @version $Revision$, $Date$
  */
-public class CommandLine implements Serializable {
-
+public class CommandLine implements Serializable
+{
     private static final long serialVersionUID = 1L;
 
     /** the unrecognised options/arguments */
@@ -49,9 +50,6 @@
     /** the processed options */
     private List options = new ArrayList();
 
-    /** Map of unique options for ease to get complete list of options */
-//    private Set allOptions = new HashSet();
-
     /**
      * Creates a command line.
      */
@@ -68,7 +66,7 @@
      */
     public boolean hasOption(String opt)
     {
-        return options.contains( resolveOption(opt));
+        return options.contains(resolveOption(opt));
     }
 
     /** 
@@ -151,10 +149,10 @@
     {
         List values = new ArrayList();
 
-        for ( Iterator it = options.iterator(); it.hasNext(); )
+        for (Iterator it = options.iterator(); it.hasNext();)
         {
             Option option = (Option) it.next();
-            if (opt.equals(option.getOpt()) || opt.equals( option.getLongOpt()))
+            if (opt.equals(option.getOpt()) || opt.equals(option.getLongOpt()))
             {
                 values.addAll(option.getValuesList());
             }
@@ -164,24 +162,26 @@
     }
 
     /**
-     * <p>Retrieves the option object given the long or short option as a String</p>
+     * Retrieves the option object given the long or short option as a String
+     * 
      * @param opt short or long name of the option
      * @return Canonicalized option
      */
-    private Option resolveOption( String opt )
+    private Option resolveOption(String opt)
     {
         opt = Util.stripLeadingHyphens(opt);
-        for ( Iterator it = options.iterator(); it.hasNext(); )
+        for (Iterator it = options.iterator(); it.hasNext();)
         {
             Option option = (Option) it.next();
             if (opt.equals(option.getOpt()))
             {
                 return option;
             }
-            if (opt.equals( option.getLongOpt()))
+
+            if (opt.equals(option.getLongOpt()))
             {
                 return option;
-        }
+            }
 
         }
         return null;
@@ -203,7 +203,7 @@
      * Retrieve the argument, if any, of an option.
      *
      * @param opt name of the option
-     * @param defaultValue is the default value to be returned if the option 
+     * @param defaultValue is the default value to be returned if the option
      * is not specified
      * @return Value of the argument if option is set, and has an argument,
      * otherwise <code>defaultValue</code>.
@@ -219,7 +219,7 @@
      * Retrieve the argument, if any, of an option.
      *
      * @param opt character name of the option
-     * @param defaultValue is the default value to be returned if the option 
+     * @param defaultValue is the default value to be returned if the option
      * is not specified
      * @return Value of the argument if option is set, and has an argument,
      * otherwise <code>defaultValue</code>.
@@ -262,7 +262,7 @@
                 {
                     // no explicit value, handle it as a boolean
                     props.put(values.get(0), "true");
-                }                
+                }
             }
         }
 
@@ -326,8 +326,7 @@
     }
 
     /**
-     * Add an option to the command line.  The values of 
-     * the option are stored.
+     * Add an option to the command line.  The values of the option are stored.
      *
      * @param opt the processed option
      */
@@ -339,7 +338,7 @@
     /**
      * Returns an iterator over the Option members of CommandLine.
      *
-     * @return an <code>Iterator</code> over the processed {@link Option} 
+     * @return an <code>Iterator</code> over the processed {@link Option}
      * members of this {@link CommandLine}
      */
     public Iterator iterator()

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLineParser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLineParser.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLineParser.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/CommandLineParser.java Tue Jul 29 01:13:48 2008
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.cli;
 
-import java.util.Properties;
+package org.apache.commons.cli;
 
 /**
- * A class that implements the <code>CommandLineParser</code> interface 
+ * A class that implements the <code>CommandLineParser</code> interface
  * can parse a String array according to the {@link Options} specified
  * and return a {@link CommandLine}.
  *
  * @author John Keyes (john at integralsource.com)
+ * @version $Revision$, $Date$
  */
-public interface CommandLineParser {
-
+public interface CommandLineParser
+{
     /**
      * Parse the arguments according to the specified options.
      *
@@ -37,8 +37,7 @@
      * @throws ParseException if there are any problems encountered
      * while parsing the command line tokens.
      */
-    CommandLine parse(Options options, String[] arguments)
-               throws ParseException;
+    CommandLine parse(Options options, String[] arguments) throws ParseException;
 
     /**
      * Parse the arguments according to the specified options and
@@ -52,11 +51,10 @@
      * @throws ParseException if there are any problems encountered
      * while parsing the command line tokens.
      */
-    /* To maintain binary compatibility, this is commented out. 
-       It is still in the abstract Parser class, so most users will 
-       still reap the benefit. 
-    CommandLine parse(Options options, String[] arguments, 
-                      Properties properties)
+    /* To maintain binary compatibility, this is commented out.
+       It is still in the abstract Parser class, so most users will
+       still reap the benefit.
+    CommandLine parse(Options options, String[] arguments, Properties properties)
                throws ParseException;
      */
 
@@ -72,9 +70,7 @@
      * @throws ParseException if there are any problems encountered
      * while parsing the command line tokens.
      */
-    CommandLine parse(Options options, String[] arguments, 
-                      boolean stopAtNonOption)
-               throws ParseException;
+    CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException;
 
     /**
      * Parse the arguments according to the specified options and
@@ -89,11 +85,10 @@
      * @throws ParseException if there are any problems encountered
      * while parsing the command line tokens.
      */
-    /* To maintain binary compatibility, this is commented out. 
-       It is still in the abstract Parser class, so most users will 
-       still reap the benefit. 
-    CommandLine parse(Options options, String[] arguments, 
-                      Properties properties, boolean stopAtNonOption)
-               throws ParseException;
+    /* To maintain binary compatibility, this is commented out.
+       It is still in the abstract Parser class, so most users will
+       still reap the benefit.
+    CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption)
+            throws ParseException;
      */
 }

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/GnuParser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/GnuParser.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/GnuParser.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/GnuParser.java Tue Jul 29 01:13:48 2008
@@ -21,32 +21,29 @@
 import java.util.List;
 
 /**
- * The class GnuParser provides an implementation of the 
- * {@link Parser#flatten(Options,String[],boolean) flatten} method.
+ * The class GnuParser provides an implementation of the
+ * {@link Parser#flatten(Options, String[], boolean) flatten} method.
  *
  * @author John Keyes (john at integralsource.com)
- * @see Parser
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
-public class GnuParser extends Parser {
-
+public class GnuParser extends Parser
+{
     /**
-     * <p>This flatten method does so using the following rules:
+     * This flatten method does so using the following rules:
      * <ol>
-     *  <li>If an {@link Option} exists for the first character of 
-     *  the <code>arguments</code> entry <b>AND</b> an {@link Option} 
-     *  does not exist for the whole <code>argument</code> then
-     *  add the first character as an option to the processed tokens
-     *  list e.g. "-D" and add the rest of the entry to the also.</li>
-     *  <li>Otherwise just add the token to the processed tokens list.
-     *  </li>
+     *   <li>If an {@link Option} exists for the first character of
+     *   the <code>arguments</code> entry <b>AND</b> an {@link Option}
+     *   does not exist for the whole <code>argument</code> then
+     *   add the first character as an option to the processed tokens
+     *   list e.g. "-D" and add the rest of the entry to the also.</li>
+     *   <li>Otherwise just add the token to the processed tokens list.</li>
      * </ol>
-     * </p>
      *
-     * @param options The Options to parse the arguments by.
-     * @param arguments The arguments that have to be flattened.
-     * @param stopAtNonOption specifies whether to stop 
-     * flattening when a non option has been encountered
+     * @param options         The Options to parse the arguments by.
+     * @param arguments       The arguments that have to be flattened.
+     * @param stopAtNonOption specifies whether to stop flattening when
+     *                        a non option has been encountered
      * @return a String array of the flattened arguments
      */
     protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java Tue Jul 29 01:13:48 2008
@@ -30,8 +30,10 @@
  *
  * @author Slawek Zachcial
  * @author John Keyes (john at integralsource.com)
+ * @version $Revision$, $Date$
  */
-public class HelpFormatter {
+public class HelpFormatter
+{
     // --------------------------------------------------------------- Constants
 
     /** default number of characters per line */
@@ -149,7 +151,7 @@
      */
     public int getWidth()
     {
-        return this.defaultWidth;
+        return defaultWidth;
     }
 
     /**
@@ -169,7 +171,7 @@
      */
     public int getLeftPadding()
     {
-        return this.defaultLeftPad;
+        return defaultLeftPad;
     }
 
     /**
@@ -189,7 +191,7 @@
      */
     public int getDescPadding()
     {
-        return this.defaultDescPad;
+        return defaultDescPad;
     }
 
     /**
@@ -209,7 +211,7 @@
      */
     public String getSyntaxPrefix()
     {
-        return this.defaultSyntaxPrefix;
+        return defaultSyntaxPrefix;
     }
 
     /**
@@ -229,7 +231,7 @@
      */
     public String getNewLine()
     {
-        return this.defaultNewLine;
+        return defaultNewLine;
     }
 
     /**
@@ -249,7 +251,7 @@
      */
     public String getOptPrefix()
     {
-        return this.defaultOptPrefix;
+        return defaultOptPrefix;
     }
 
     /**
@@ -269,7 +271,7 @@
      */
     public String getLongOptPrefix()
     {
-        return this.defaultLongOptPrefix;
+        return defaultLongOptPrefix;
     }
 
     /**
@@ -289,7 +291,7 @@
      */
     public String getArgName()
     {
-        return this.defaultArgName;
+        return defaultArgName;
     }
 
     /**
@@ -297,9 +299,9 @@
      * 
      * Defaults to case-insensitive alphabetical sorting by option key
      */
-    public Comparator getOptionComparator() 
+    public Comparator getOptionComparator()
     {
-        return this.optionComparator;
+        return optionComparator;
     }
 
     /**
@@ -307,25 +309,22 @@
      * 
      * Passing in a null parameter will set the ordering to the default mode
      */
-    public void setOptionComparator(Comparator comparator) 
+    public void setOptionComparator(Comparator comparator)
     {
-        if ( comparator == null ) 
+        if (comparator == null)
         {
             this.optionComparator = new OptionComparator();
-        } 
-        else 
+        }
+        else
         {
             this.optionComparator = comparator;
         }
     }
 
-
-    // ------------------------------------------------------------------ Public
-
     /**
-     * <p>Print the help for <code>options</code> with the specified
+     * Print the help for <code>options</code> with the specified
      * command line syntax.  This method prints help information to
-     * System.out.</p>
+     * System.out.
      *
      * @param cmdLineSyntax the syntax for this application
      * @param options the Options instance
@@ -336,60 +335,56 @@
     }
 
     /**
-     * <p>Print the help for <code>options</code> with the specified
+     * Print the help for <code>options</code> with the specified
      * command line syntax.  This method prints help information to 
-     * System.out.</p>
+     * System.out.
      *
      * @param cmdLineSyntax the syntax for this application
      * @param options the Options instance
-     * @param autoUsage whether to print an automatically generated 
+     * @param autoUsage whether to print an automatically generated
      * usage statement
      */
-    public void printHelp(String cmdLineSyntax, Options options, 
-                          boolean autoUsage)
+    public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage)
     {
         printHelp(defaultWidth, cmdLineSyntax, null, options, null, autoUsage);
     }
 
     /**
-     * <p>Print the help for <code>options</code> with the specified
+     * Print the help for <code>options</code> with the specified
      * command line syntax.  This method prints help information to
-     * System.out.</p>
+     * System.out.
      *
      * @param cmdLineSyntax the syntax for this application
      * @param header the banner to display at the begining of the help
      * @param options the Options instance
      * @param footer the banner to display at the end of the help
      */
-    public void printHelp(String cmdLineSyntax, String header, Options options, 
-                          String footer)
+    public void printHelp(String cmdLineSyntax, String header, Options options, String footer)
     {
         printHelp(cmdLineSyntax, header, options, footer, false);
     }
 
     /**
-     * <p>Print the help for <code>options</code> with the specified
+     * Print the help for <code>options</code> with the specified
      * command line syntax.  This method prints help information to 
-     * System.out.</p>
+     * System.out.
      *
      * @param cmdLineSyntax the syntax for this application
      * @param header the banner to display at the begining of the help
      * @param options the Options instance
      * @param footer the banner to display at the end of the help
-     * @param autoUsage whether to print an automatically generated 
+     * @param autoUsage whether to print an automatically generated
      * usage statement
      */
-    public void printHelp(String cmdLineSyntax, String header, Options options, 
-                          String footer, boolean autoUsage)
+    public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)
     {
-        printHelp(defaultWidth, cmdLineSyntax, header, options, footer, 
-                  autoUsage);
+        printHelp(defaultWidth, cmdLineSyntax, header, options, footer, autoUsage);
     }
 
     /**
-     * <p>Print the help for <code>options</code> with the specified
+     * Print the help for <code>options</code> with the specified
      * command line syntax.  This method prints help information to
-     * System.out.</p>
+     * System.out.
      *
      * @param width the number of characters to be displayed on each line
      * @param cmdLineSyntax the syntax for this application
@@ -397,16 +392,15 @@
      * @param options the Options instance
      * @param footer the banner to display at the end of the help
      */
-    public void printHelp(int width, String cmdLineSyntax, String header, 
-                          Options options, String footer)
+    public void printHelp(int width, String cmdLineSyntax, String header, Options options, String footer)
     {
         printHelp(width, cmdLineSyntax, header, options, footer, false);
     }
 
     /**
-     * <p>Print the help for <code>options</code> with the specified
+     * Print the help for <code>options</code> with the specified
      * command line syntax.  This method prints help information to
-     * System.out.</p>
+     * System.out.
      *
      * @param width the number of characters to be displayed on each line
      * @param cmdLineSyntax the syntax for this application
@@ -416,19 +410,18 @@
      * @param autoUsage whether to print an automatically generated 
      * usage statement
      */
-    public void printHelp(int width, String cmdLineSyntax, String header, 
+    public void printHelp(int width, String cmdLineSyntax, String header,
                           Options options, String footer, boolean autoUsage)
     {
         PrintWriter pw = new PrintWriter(System.out);
 
-        printHelp(pw, width, cmdLineSyntax, header, options, defaultLeftPad, 
-                  defaultDescPad, footer, autoUsage);
+        printHelp(pw, width, cmdLineSyntax, header, options, defaultLeftPad, defaultDescPad, footer, autoUsage);
         pw.flush();
     }
 
     /**
-     * <p>Print the help for <code>options</code> with the specified
-     * command line syntax.</p>
+     * Print the help for <code>options</code> with the specified
+     * command line syntax.
      *
      * @param pw the writer to which the help will be written
      * @param width the number of characters to be displayed on each line
@@ -445,14 +438,13 @@
                           String header, Options options, int leftPad, 
                           int descPad, String footer)
     {
-        printHelp(pw, width, cmdLineSyntax, header, options, leftPad, descPad, 
-                  footer, false);
+        printHelp(pw, width, cmdLineSyntax, header, options, leftPad, descPad, footer, false);
     }
 
 
     /**
-     * <p>Print the help for <code>options</code> with the specified
-     * command line syntax.</p>
+     * Print the help for <code>options</code> with the specified
+     * command line syntax.
      *
      * @param pw the writer to which the help will be written
      * @param width the number of characters to be displayed on each line
@@ -464,11 +456,11 @@
      * @param descPad the number of characters of padding to be prefixed
      * to each description line
      * @param footer the banner to display at the end of the help
-     * @param autoUsage whether to print an automatically generated 
+     * @param autoUsage whether to print an automatically generated
      * usage statement
      */
-    public void printHelp(PrintWriter pw, int width, String cmdLineSyntax, 
-                          String header, Options options, int leftPad, 
+    public void printHelp(PrintWriter pw, int width, String cmdLineSyntax,
+                          String header, Options options, int leftPad,
                           int descPad, String footer, boolean autoUsage)
     {
         if ((cmdLineSyntax == null) || (cmdLineSyntax.length() == 0))
@@ -507,12 +499,10 @@
      * @param options The command line Options
      *
      */
-    public void printUsage(PrintWriter pw, int width, String app, 
-                           Options options)
+    public void printUsage(PrintWriter pw, int width, String app, Options options)
     {
         // initialise the string buffer
-        StringBuffer buff = new StringBuffer(defaultSyntaxPrefix).append(app)
-                                                                 .append(" ");
+        StringBuffer buff = new StringBuffer(defaultSyntaxPrefix).append(app).append(" ");
 
         // create a list for processed option groups
         final Collection processedGroups = new ArrayList();
@@ -521,7 +511,7 @@
         Option option;
 
         List optList = new ArrayList(options.getOptions());
-        Collections.sort(optList, getOptionComparator() );
+        Collections.sort(optList, getOptionComparator());
         // iterate over the options
         for (Iterator i = optList.iterator(); i.hasNext();)
         {
@@ -563,8 +553,7 @@
 
 
         // call printWrapped
-        printWrapped(pw, width, buff.toString().indexOf(' ') + 1, 
-                     buff.toString());
+        printWrapped(pw, width, buff.toString().indexOf(' ') + 1, buff.toString());
     }
 
     /**
@@ -575,8 +564,7 @@
      * @param group the group to append
      * @see #appendOption(StringBuffer,Option,boolean)
      */
-    private void appendOptionGroup(final StringBuffer buff, 
-                                          final OptionGroup group)
+    private void appendOptionGroup(final StringBuffer buff, final OptionGroup group)
     {
         if (!group.isRequired())
         {
@@ -584,7 +572,7 @@
         }
 
         List optList = new ArrayList(group.getOptions());
-        Collections.sort(optList, getOptionComparator() );
+        Collections.sort(optList, getOptionComparator());
         // for each option in the OptionGroup
         for (Iterator i = optList.iterator(); i.hasNext();)
         {
@@ -610,9 +598,7 @@
      * @param option the Option to append
      * @param required whether the Option is required or not
      */
-    private static void appendOption(final StringBuffer buff, 
-                                     final Option option, 
-                                     final boolean required)
+    private static void appendOption(final StringBuffer buff, final Option option, final boolean required)
     {
         if (!required)
         {
@@ -642,8 +628,8 @@
     }
 
     /**
-     * <p>Print the cmdLineSyntax to the specified writer, using the
-     * specified width.</p>
+     * Print the cmdLineSyntax to the specified writer, using the
+     * specified width.
      *
      * @param pw The printWriter to write the help to
      * @param width The number of characters per line for the usage statement.
@@ -653,8 +639,7 @@
     {
         int argPos = cmdLineSyntax.indexOf(' ') + 1;
 
-        printWrapped(pw, width, defaultSyntaxPrefix.length() + argPos, 
-                     defaultSyntaxPrefix + cmdLineSyntax);
+        printWrapped(pw, width, defaultSyntaxPrefix.length() + argPos, defaultSyntaxPrefix + cmdLineSyntax);
     }
 
     /**
@@ -679,7 +664,7 @@
     }
 
     /**
-     * <p>Print the specified text to the specified PrintWriter.</p>
+     * Print the specified text to the specified PrintWriter.
      *
      * @param pw The printWriter to write the help to
      * @param width The number of characters to display per line
@@ -691,15 +676,14 @@
     }
 
     /**
-     * <p>Print the specified text to the specified PrintWriter.</p>
+     * Print the specified text to the specified PrintWriter.
      *
      * @param pw The printWriter to write the help to
      * @param width The number of characters to display per line
      * @param nextLineTabStop The position on the next line for the first tab.
      * @param text The text to be written to the PrintWriter
      */
-    public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, 
-                             String text)
+    public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text)
     {
         StringBuffer sb = new StringBuffer(text.length());
 
@@ -710,8 +694,8 @@
     // --------------------------------------------------------------- Protected
 
     /**
-     * <p>Render the specified Options and return the rendered Options
-     * in a StringBuffer.</p>
+     * Render the specified Options and return the rendered Options
+     * in a StringBuffer.
      *
      * @param sb The StringBuffer to place the rendered Options into.
      * @param width The number of characters to display per line
@@ -723,9 +707,7 @@
      *
      * @return the StringBuffer with the rendered Options contents.
      */
-    protected StringBuffer renderOptions(StringBuffer sb, int width, 
-                                         Options options, int leftPad, 
-                                         int descPad)
+    protected StringBuffer renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad)
     {
         final String lpad = createPadding(leftPad);
         final String dpad = createPadding(descPad);
@@ -737,30 +719,27 @@
         int max = 0;
         StringBuffer optBuf;
         List prefixList = new ArrayList();
-        Option option;
+
         List optList = options.helpOptions();
 
-        Collections.sort(optList, getOptionComparator() );
+        Collections.sort(optList, getOptionComparator());
 
         for (Iterator i = optList.iterator(); i.hasNext();)
         {
-            option = (Option) i.next();
+            Option option = (Option) i.next();
             optBuf = new StringBuffer(8);
 
             if (option.getOpt() == null)
             {
-                optBuf.append(lpad).append("   " + defaultLongOptPrefix)
-                      .append(option.getLongOpt());
+                optBuf.append(lpad).append("   " + defaultLongOptPrefix).append(option.getLongOpt());
             }
             else
             {
-                optBuf.append(lpad).append(defaultOptPrefix)
-                      .append(option.getOpt());
+                optBuf.append(lpad).append(defaultOptPrefix).append(option.getOpt());
 
                 if (option.hasLongOpt())
                 {
-                    optBuf.append(',').append(defaultLongOptPrefix)
-                          .append(option.getLongOpt());
+                    optBuf.append(',').append(defaultLongOptPrefix).append(option.getLongOpt());
                 }
             }
 
@@ -777,14 +756,14 @@
             }
 
             prefixList.add(optBuf);
-            max = (optBuf.length() > max)       ? optBuf.length() : max;
+            max = (optBuf.length() > max) ? optBuf.length() : max;
         }
 
         int x = 0;
 
         for (Iterator i = optList.iterator(); i.hasNext();)
         {
-            option = (Option) i.next();
+            Option option = (Option) i.next();
             optBuf = new StringBuffer(prefixList.get(x++).toString());
 
             if (optBuf.length() < max)
@@ -813,8 +792,8 @@
     }
 
     /**
-     * <p>Render the specified text and return the rendered Options
-     * in a StringBuffer.</p>
+     * Render the specified text and return the rendered Options
+     * in a StringBuffer.
      *
      * @param sb The StringBuffer to place the rendered text into.
      * @param width The number of characters to display per line
@@ -857,16 +836,16 @@
     }
 
     /**
-     * Finds the next text wrap position after <code>startPos</code> for the 
+     * Finds the next text wrap position after <code>startPos</code> for the
      * text in <code>text</code> with the column width <code>width</code>.
      * The wrap point is the last postion before startPos+width having a 
      * whitespace character (space, \n, \r).
      *
      * @param text The text being searched for the wrap position
      * @param width width of the wrapped text
-     * @param startPos position from which to start the lookup whitespace 
+     * @param startPos position from which to start the lookup whitespace
      * character
-     * @return postion on which the text must be wrapped or -1 if the wrap 
+     * @return postion on which the text must be wrapped or -1 if the wrap
      * position is at the end of the text
      */
     protected int findWrapPos(String text, int width, int startPos)
@@ -875,11 +854,11 @@
 
         // the line ends before the max wrap pos or a new line char found
         if (((pos = text.indexOf('\n', startPos)) != -1 && pos <= width)
-            || ((pos = text.indexOf('\t', startPos)) != -1 && pos <= width))
+                || ((pos = text.indexOf('\t', startPos)) != -1 && pos <= width))
         {
-            return pos+1;
+            return pos + 1;
         }
-        else if ((startPos + width) >= text.length())
+        else if (startPos + width >= text.length())
         {
             return -1;
         }
@@ -891,7 +870,7 @@
         char c;
 
         while ((pos >= startPos) && ((c = text.charAt(pos)) != ' ')
-               && (c != '\n') && (c != '\r'))
+                && (c != '\n') && (c != '\r'))
         {
             --pos;
         }
@@ -912,11 +891,11 @@
             ++pos;
         }
 
-        return (pos == text.length())        ? (-1) : pos;
+        return (pos == text.length()) ? (-1) : pos;
     }
 
     /**
-     * <p>Return a String of padding of length <code>len</code>.</p>
+     * Return a String of padding of length <code>len</code>.
      *
      * @param len The length of the String of padding to create.
      *
@@ -935,7 +914,7 @@
     }
 
     /**
-     * <p>Remove the trailing whitespace from the specified String.</p>
+     * Remove the trailing whitespace from the specified String.
      *
      * @param s The String to remove the trailing padding from.
      *
@@ -962,28 +941,27 @@
     // ---------------------------------------------------------------- Private
     // ---------------------------------------------------------- Inner classes
     /**
-     * <p>This class implements the <code>Comparator</code> interface
-     * for comparing Options.</p>
+     * This class implements the <code>Comparator</code> interface
+     * for comparing Options.
      */
-    private static class OptionComparator
-        implements Comparator {
+    private static class OptionComparator implements Comparator
+    {
 
         /**
-         * <p>Compares its two arguments for order. Returns a negative 
-         * integer, zero, or a positive integer as the first argument 
-         * is less than, equal to, or greater than the second.</p>
+         * Compares its two arguments for order. Returns a negative
+         * integer, zero, or a positive integer as the first argument
+         * is less than, equal to, or greater than the second.
          *
          * @param o1 The first Option to be compared.
          * @param o2 The second Option to be compared.
-         *
-         * @return a negative integer, zero, or a positive integer as 
-         * the first argument is less than, equal to, or greater than the 
-         * second.
+         * @return a negative integer, zero, or a positive integer as
+         *         the first argument is less than, equal to, or greater than the
+         *         second.
          */
         public int compare(Object o1, Object o2)
         {
-            Option opt1 = (Option)o1;
-            Option opt2 = (Option)o2;
+            Option opt1 = (Option) o1;
+            Option opt2 = (Option) o2;
 
             return opt1.getKey().compareToIgnoreCase(opt2.getKey());
         }

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingArgumentException.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingArgumentException.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingArgumentException.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingArgumentException.java Tue Jul 29 01:13:48 2008
@@ -22,7 +22,7 @@
  * is not provided with an argument.
  *
  * @author John Keyes (john at integralsource.com)
- * @see ParseException
+ * @version $Revision$, $Date$
  */
 public class MissingArgumentException extends ParseException
 {
@@ -57,6 +57,7 @@
      * Return the option requiring an argument that wasn't provided
      * on the command line.
      *
+     * @return the related option
      * @since 1.2
      */
     public Option getOption()

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingOptionException.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingOptionException.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingOptionException.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/MissingOptionException.java Tue Jul 29 01:13:48 2008
@@ -24,7 +24,7 @@
  * Thrown when a required option has not been provided.
  *
  * @author John Keyes ( john at integralsource.com )
- * @see ParseException
+ * @version $Revision$, $Date$
  */
 public class MissingOptionException extends ParseException
 {
@@ -58,6 +58,7 @@
     /**
      * Return the list of options (as strings) missing in the command line parsed.
      *
+     * @return the missing options
      * @since 1.2
      */
     public List getMissingOptions()

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java Tue Jul 29 01:13:48 2008
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.cli;
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.List;
 
 /** <p>Describes a single command-line option.  It maintains
  * information regarding the short-name of the option, the long-name,
@@ -32,48 +34,44 @@
  *
  * @author bob mcwhirter (bob @ werken.com)
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
-public class Option implements Cloneable, Serializable {
-
+public class Option implements Cloneable, Serializable
+{
     private static final long serialVersionUID = 1L;
 
-    /** constant that specifies the number of argument values has 
-        not been specified */
+    /** constant that specifies the number of argument values has not been specified */
     public static final int UNINITIALIZED = -1;
 
     /** constant that specifies the number of argument values is infinite */
     public static final int UNLIMITED_VALUES = -2;
 
-    /** opt the name of the option */
+    /** the name of the option */
     private String opt;
 
-    /** longOpt is the long representation of the option */
+    /** the long representation of the option */
     private String longOpt;
 
-    /** argName specifies the name of the argument for this option */
+    /** the name of the argument for this option */
     private String argName = "arg";
 
     /** description of the option */
     private String description;
 
-    /** required specifies whether this option is required to be present */
+    /** specifies whether this option is required to be present */
     private boolean required;
 
     /** specifies whether the argument value of this Option is optional */
     private boolean optionalArg;
 
-    /** 
-     * numberOfArgs specifies the number of argument values this option 
-     * can have 
-     */
+    /** the number of argument values this option can have */
     private int numberOfArgs = UNINITIALIZED;
 
     /** the type of this Option */
     private Object type;
 
     /** the list of argument values **/
-    private ArrayList values = new ArrayList();
+    private List values = new ArrayList();
 
     /** the character that is the value separator */
     private char valuesep;
@@ -87,8 +85,7 @@
      * @throws IllegalArgumentException if there are any non valid
      * Option characters in <code>opt</code>.
      */
-    public Option(String opt, String description)
-           throws IllegalArgumentException
+    public Option(String opt, String description) throws IllegalArgumentException
     {
         this(opt, null, false, description);
     }
@@ -103,8 +100,7 @@
      * @throws IllegalArgumentException if there are any non valid
      * Option characters in <code>opt</code>.
      */
-    public Option(String opt, boolean hasArg, String description)
-           throws IllegalArgumentException
+    public Option(String opt, boolean hasArg, String description) throws IllegalArgumentException
     {
         this(opt, null, hasArg, description);
     }
@@ -120,8 +116,7 @@
      * @throws IllegalArgumentException if there are any non valid
      * Option characters in <code>opt</code>.
      */
-    public Option(String opt, String longOpt, boolean hasArg,
-                  String description)
+    public Option(String opt, String longOpt, boolean hasArg, String description)
            throws IllegalArgumentException
     {
         // ensure that the option is valid
@@ -161,10 +156,10 @@
         // if 'opt' is null, then it is a 'long' option
         if (opt == null)
         {
-            return this.longOpt;
+            return longOpt;
         }
 
-        return this.opt;
+        return opt;
     }
 
     /** 
@@ -179,7 +174,7 @@
      */
     public String getOpt()
     {
-        return this.opt;
+        return opt;
     }
 
     /**
@@ -189,7 +184,7 @@
      */
     public Object getType()
     {
-        return this.type;
+        return type;
     }
 
     /**
@@ -209,7 +204,7 @@
      */
     public String getLongOpt()
     {
-        return this.longOpt;
+        return longOpt;
     }
 
     /**
@@ -238,7 +233,7 @@
      */
     public boolean hasOptionalArg()
     {
-        return this.optionalArg;
+        return optionalArg;
     }
 
     /** 
@@ -248,7 +243,7 @@
      */
     public boolean hasLongOpt()
     {
-        return (this.longOpt != null);
+        return longOpt != null;
     }
 
     /** 
@@ -258,7 +253,7 @@
      */
     public boolean hasArg()
     {
-        return (this.numberOfArgs > 0) || (numberOfArgs == UNLIMITED_VALUES);
+        return numberOfArgs > 0 || numberOfArgs == UNLIMITED_VALUES;
     }
 
     /** 
@@ -268,7 +263,7 @@
      */
     public String getDescription()
     {
-        return this.description;
+        return description;
     }
 
     /**
@@ -289,7 +284,7 @@
      */
     public boolean isRequired()
     {
-        return this.required;
+        return required;
     }
 
     /**
@@ -319,7 +314,7 @@
      */
     public String getArgName()
     {
-        return this.argName;
+        return argName;
     }
 
     /**
@@ -331,7 +326,7 @@
      */
     public boolean hasArgName()
     {
-        return (this.argName != null && this.argName.length() > 0);
+        return argName != null && argName.length() > 0;
     }
 
     /** 
@@ -341,8 +336,7 @@
      */
     public boolean hasArgs()
     {
-        return (this.numberOfArgs > 1)
-                || (this.numberOfArgs == UNLIMITED_VALUES);
+        return numberOfArgs > 1 || numberOfArgs == UNLIMITED_VALUES;
     }
 
     /** 
@@ -373,7 +367,7 @@
      */
     public char getValueSeparator()
     {
-        return this.valuesep;
+        return valuesep;
     }
 
     /**
@@ -384,7 +378,7 @@
      */
     public boolean hasValueSeparator()
     {
-        return (this.valuesep > 0);
+        return valuesep > 0;
     }
 
     /** 
@@ -394,7 +388,7 @@
      */
     public int getArgs()
     {
-        return this.numberOfArgs;
+        return numberOfArgs;
     }
 
     /**
@@ -406,11 +400,11 @@
     {
         switch (numberOfArgs)
         {
-        case UNINITIALIZED:
-            throw new RuntimeException("NO_ARGS_ALLOWED");
+            case UNINITIALIZED:
+                throw new RuntimeException("NO_ARGS_ALLOWED");
 
-        default:
-            processValue(value);
+            default:
+                processValue(value);
         }
     }
 
@@ -445,21 +439,17 @@
                     break;
                 }
 
-
                 // store
                 add(value.substring(0, index));
 
-
                 // parse
                 value = value.substring(index + 1);
 
-
                 // get new index
                 index = value.indexOf(sep);
             }
         }
 
-
         // store the actual value or the last value that has been parsed
         add(value);
     }
@@ -480,9 +470,8 @@
             throw new RuntimeException("Cannot add value, list full.");
         }
 
-
         // store value
-        this.values.add(value);
+        values.add(value);
     }
 
     /**
@@ -494,7 +483,7 @@
      */
     public String getValue()
     {
-        return hasNoValues() ? null : (String) this.values.get(0);
+        return hasNoValues() ? null : (String) values.get(0);
     }
 
     /**
@@ -509,10 +498,9 @@
      * @throws IndexOutOfBoundsException if index is less than 1
      * or greater than the number of the values for this Option.
      */
-    public String getValue(int index)
-        throws IndexOutOfBoundsException
+    public String getValue(int index) throws IndexOutOfBoundsException
     {
-        return hasNoValues() ? null : (String) this.values.get(index);
+        return hasNoValues() ? null : (String) values.get(index);
     }
 
     /**
@@ -541,17 +529,16 @@
      */
     public String[] getValues()
     {
-        return hasNoValues()
-               ? null : (String[]) this.values.toArray(new String[this.values.size()]);
+        return hasNoValues() ? null : (String[]) values.toArray(new String[values.size()]);
     }
 
     /**
      * @return the values of this Option as a List
      * or null if there are no values
      */
-    public java.util.List getValuesList()
+    public List getValuesList()
     {
-        return this.values;
+        return values;
     }
 
     /** 
@@ -563,11 +550,11 @@
     {
         StringBuffer buf = new StringBuffer().append("[ option: ");
 
-        buf.append(this.opt);
+        buf.append(opt);
 
-        if (this.longOpt != null)
+        if (longOpt != null)
         {
-            buf.append(" ").append(this.longOpt);
+            buf.append(" ").append(longOpt);
         }
 
         buf.append(" ");
@@ -575,15 +562,17 @@
         if (hasArgs())
         {
             buf.append("[ARG...]");
-        } else if (hasArg()) {
+        }
+        else if (hasArg())
+        {
             buf.append(" [ARG]");
         }
 
-        buf.append(" :: ").append(this.description);
+        buf.append(" :: ").append(description);
 
-        if (this.type != null)
+        if (type != null)
         {
-            buf.append(" :: ").append(this.type);
+            buf.append(" :: ").append(type);
         }
 
         buf.append(" ]");
@@ -598,16 +587,16 @@
      */
     private boolean hasNoValues()
     {
-        return this.values.size() == 0;
+        return values.isEmpty();
     }
 
-    public boolean equals( Object o )
+    public boolean equals(Object o)
     {
-        if ( this == o )
+        if (this == o)
         {
             return true;
         }
-        if ( o == null || getClass() != o.getClass() )
+        if (o == null || getClass() != o.getClass())
         {
             return false;
         }
@@ -615,11 +604,11 @@
         Option option = (Option) o;
 
 
-        if ( opt != null ? !opt.equals( option.opt ) : option.opt != null )
+        if (opt != null ? !opt.equals(option.opt) : option.opt != null)
         {
             return false;
         }
-        if ( longOpt != null ? !longOpt.equals( option.longOpt ) : option.longOpt != null )
+        if (longOpt != null ? !longOpt.equals(option.longOpt) : option.longOpt != null)
         {
             return false;
         }
@@ -630,8 +619,8 @@
     public int hashCode()
     {
         int result;
-        result = ( opt != null ? opt.hashCode() : 0 );
-        result = 31 * result + ( longOpt != null ? longOpt.hashCode() : 0 );
+        result = (opt != null ? opt.hashCode() : 0);
+        result = 31 * result + (longOpt != null ? longOpt.hashCode() : 0);
         return result;
     }
 
@@ -645,25 +634,29 @@
      *
      * @throws RuntimeException
      */
-    public Object clone() {
-        try {
+    public Object clone()
+    {
+        try
+        {
             Option option = (Option) super.clone();
             option.values = new ArrayList(values);
             return option;
-        } catch(CloneNotSupportedException cnse) {
+        }
+        catch (CloneNotSupportedException cnse)
+        {
             throw new RuntimeException("A CloneNotSupportedException was thrown: " + cnse.getMessage());
         }
     }
 
     /**
-     * <p>Clear the Option values. After a 
-     * parse is complete, these are left with data in them 
-     * and they need clearing if another parse is done. </p>
+     * Clear the Option values. After a parse is complete, these are left with
+     * data in them and they need clearing if another parse is done.
      *
      * See: <a href="https://issues.apache.org/jira/browse/CLI-71">CLI-71</a>
      */
-    void clearValues() {
-        this.values.clear();
+    void clearValues()
+    {
+        values.clear();
     }
 
     /**
@@ -672,11 +665,10 @@
      * @deprecated
      * @throws UnsupportedOperationException
      */
-    public boolean addValue(String value) {
-        throw new UnsupportedOperationException(
-           "The addValue method is not intended for client use. " + 
-           "Subclasses should use the addValueForProcessing method instead. "
-           );
+    public boolean addValue(String value)
+    {
+        throw new UnsupportedOperationException("The addValue method is not intended for client use. "
+                + "Subclasses should use the addValueForProcessing method instead. ");
     }
 
 }

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionBuilder.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionBuilder.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionBuilder.java Tue Jul 29 01:13:48 2008
@@ -14,20 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.cli;
 
 /**
- * <p>OptionBuilder allows the user to create Options using descriptive
- * methods.</p>
- * <p>Details on the Builder pattern can be found at 
+ * OptionBuilder allows the user to create Options using descriptive methods.
+ *
+ * <p>Details on the Builder pattern can be found at
  * <a href="http://c2.com/cgi-bin/wiki?BuilderPattern">
  * http://c2.com/cgi-bin/wiki?BuilderPattern</a>.</p>
  *
  * @author John Keyes (john at integralsource.com)
+ * @version $Revision$, $Date$
  * @since 1.0
  */
-public class OptionBuilder {
-
+public final class OptionBuilder
+{
     /** long option */
     private static String longopt;
 
@@ -115,14 +117,13 @@
      */
     public static OptionBuilder hasArg(boolean hasArg)
     {
-        OptionBuilder.numberOfArgs = (hasArg == true) ? 1 : Option.UNINITIALIZED;
+        OptionBuilder.numberOfArgs = hasArg ? 1 : Option.UNINITIALIZED;
 
         return instance;
     }
 
     /**
-     * The next Option created will have the specified argument value 
-     * name.
+     * The next Option created will have the specified argument value name.
      *
      * @param name the name for the argument value
      * @return the OptionBuilder instance
@@ -221,8 +222,7 @@
     }
 
     /**
-     * The next Option created can have <code>num</code> 
-     * argument values.
+     * The next Option created can have <code>num</code> argument values.
      *
      * @param num the number of args that the option can have
      * @return the OptionBuilder instance
@@ -248,8 +248,7 @@
     }
 
     /**
-     * The next Option can have an unlimited number of
-     * optional arguments.
+     * The next Option can have an unlimited number of optional arguments.
      *
      * @return the OptionBuilder instance
      */
@@ -262,8 +261,7 @@
     }
 
     /**
-     * The next Option can have the specified number of 
-     * optional arguments.
+     * The next Option can have the specified number of optional arguments.
      *
      * @param numArgs - the maximum number of optional arguments
      * the next Option created can have.
@@ -278,7 +276,7 @@
     }
 
     /**
-     * The next Option created will have a value that will be an instance 
+     * The next Option created will have a value that will be an instance
      * of <code>type</code>.
      *
      * @param newType the type of the Options argument value
@@ -305,7 +303,7 @@
     }
 
     /**
-     * Create an Option using the current settings and with 
+     * Create an Option using the current settings and with
      * the specified Option <code>char</code>.
      *
      * @param opt the character representation of the Option
@@ -313,8 +311,7 @@
      * @throws IllegalArgumentException if <code>opt</code> is not
      * a valid character.  See Option.
      */
-    public static Option create(char opt)
-                         throws IllegalArgumentException
+    public static Option create(char opt) throws IllegalArgumentException
     {
         return create(String.valueOf(opt));
     }
@@ -323,11 +320,9 @@
      * Create an Option using the current settings
      *
      * @return the Option instance
-     * @throws IllegalArgumentException if <code>longOpt</code> has
-     * not been set.  
+     * @throws IllegalArgumentException if <code>longOpt</code> has not been set.
      */
-    public static Option create()
-                         throws IllegalArgumentException
+    public static Option create() throws IllegalArgumentException
     {
         if (longopt == null)
         {
@@ -338,22 +333,20 @@
     }
 
     /**
-     * Create an Option using the current settings and with 
+     * Create an Option using the current settings and with
      * the specified Option <code>char</code>.
      *
-     * @param opt the <code>java.lang.String</code> representation 
+     * @param opt the <code>java.lang.String</code> representation
      * of the Option
      * @return the Option instance
      * @throws IllegalArgumentException if <code>opt</code> is not
      * a valid character.  See Option.
      */
-    public static Option create(String opt)
-                         throws IllegalArgumentException
+    public static Option create(String opt) throws IllegalArgumentException
     {
         // create the option
         Option option = new Option(opt, description);
 
-
         // set the option properties
         option.setLongOpt(longopt);
         option.setRequired(required);
@@ -370,4 +363,4 @@
         // return the Option instance
         return option;
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionGroup.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionGroup.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionGroup.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionGroup.java Tue Jul 29 01:13:48 2008
@@ -27,10 +27,10 @@
  * A group of mutually exclusive options.
  *
  * @author John Keyes ( john at integralsource.com )
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
-public class OptionGroup implements Serializable {
-
+public class OptionGroup implements Serializable
+{
     private static final long serialVersionUID = 1L;
     
     /** hold the options */
@@ -77,7 +77,8 @@
     }
 
     /**
-     * set the selected option of this group to <code>name</code>.
+     * Set the selected option of this group to <code>name</code>.
+     *
      * @param option the option that is selected
      * @throws AlreadySelectedException if an option from this group has 
      * already been selected.
@@ -87,9 +88,9 @@
         // if no option has already been selected or the 
         // same option is being reselected then set the
         // selected member variable
-        if ((this.selected == null) || this.selected.equals(option.getOpt()))
+        if (selected == null || selected.equals(option.getOpt()))
         {
-            this.selected = option.getOpt();
+            selected = option.getOpt();
         }
         else
         {
@@ -120,11 +121,12 @@
      */
     public boolean isRequired()
     {
-        return this.required;
+        return required;
     }
 
     /**
-     * <p>Returns the stringified version of this OptionGroup.</p>
+     * Returns the stringified version of this OptionGroup.
+     * 
      * @return the stringified representation of this group
      */
     public String toString()

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionValidator.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionValidator.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/OptionValidator.java Tue Jul 29 01:13:48 2008
@@ -21,14 +21,16 @@
  * Validates an Option string.
  *
  * @author John Keyes ( john at integralsource.com )
+ * @version $Revision$, $Date$
  * @since 1.1
  */
-class OptionValidator {
-
+class OptionValidator
+{
     /**
-     * <p>Validates whether <code>opt</code> is a permissable Option
+     * Validates whether <code>opt</code> is a permissable Option
      * shortOpt.  The rules that specify if the <code>opt</code>
-     * is valid are:</p>
+     * is valid are:
+     *
      * <ul>
      *  <li><code>opt</code> is not NULL</li>
      *  <li>a single character <code>opt</code> that is either
@@ -75,19 +77,19 @@
     }
 
     /**
-     * <p>Returns whether the specified character is a valid Option.</p>
+     * Returns whether the specified character is a valid Option.
      *
      * @param c the option to validate
-     * @return true if <code>c</code> is a letter, ' ', '?' or '@', 
-     * otherwise false.
+     * @return true if <code>c</code> is a letter, ' ', '?' or '@',
+     *         otherwise false.
      */
     private static boolean isValidOpt(char c)
     {
-        return (isValidChar(c) || (c == ' ') || (c == '?') || c == '@');
+        return isValidChar(c) || c == ' ' || c == '?' || c == '@';
     }
 
     /**
-     * <p>Returns whether the specified character is a valid character.</p>
+     * Returns whether the specified character is a valid character.
      *
      * @param c the character to validate
      * @return true if <code>c</code> is a letter.

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Options.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Options.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Options.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Options.java Tue Jul 29 01:13:48 2008
@@ -27,7 +27,8 @@
 import java.util.List;
 import java.util.Map;
 
-/** <p>Main entry-point into the library.</p>
+/**
+ * <p>Main entry-point into the library.</p>
  *
  * <p>Options represents a collection of {@link Option} objects, which
  * describe the possible options for a command-line.<p>
@@ -40,12 +41,12 @@
  *
  * @author bob mcwhirter (bob @ werken.com)
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
-public class Options implements Serializable {
-
+public class Options implements Serializable
+{
     private static final long serialVersionUID = 1L;
-    
+
     /** a map of the options with the character key */
     private Map shortOpts = new HashMap();
 
@@ -58,13 +59,6 @@
     /** a map of the option groups */
     private Map optionGroups = new HashMap();
 
-    /** Construct a new Options descriptor
-     */
-    public Options()
-    {
-        // nothing to do
-    }
-
     /**
      * Add the specified option group.
      *
@@ -84,7 +78,6 @@
         {
             Option option = (Option) options.next();
 
-
             // an Option cannot be required if it is in an
             // OptionGroup, either the group is required or
             // nothing is required
@@ -96,10 +89,10 @@
 
         return this;
     }
-    
+
     /**
      * Lists the OptionGroups that are members of this Options instance.
-     * 
+     *
      * @return a Collection of OptionGroup instances.
      */
     Collection getOptionGroups()
@@ -107,7 +100,7 @@
         return new HashSet(optionGroups.values());
     }
 
-    /** 
+    /**
      * Add an option that only contains a short-name.
      * It may be specified as requiring an argument.
      *
@@ -123,7 +116,7 @@
         return this;
     }
 
-    /** 
+    /**
      * Add an option that contains a short-name and a long-name.
      * It may be specified as requiring an argument.
      *
@@ -133,8 +126,7 @@
      * @param description Self-documenting description
      * @return the resulting Options instance
      */
-    public Options addOption(String opt, String longOpt, boolean hasArg, 
-                             String description)
+    public Options addOption(String opt, String longOpt, boolean hasArg, String description)
     {
         addOption(new Option(opt, longOpt, hasArg, description));
 
@@ -144,7 +136,7 @@
     /**
      * Adds an option instance
      *
-     * @param opt the option that is to be added 
+     * @param opt the option that is to be added
      * @return the resulting Options instance
      */
     public Options addOption(Option opt)
@@ -158,10 +150,11 @@
         }
 
         // if the option is required add it to the required list
-        if (opt.isRequired() ) 
+        if (opt.isRequired())
         {
-            if( requiredOpts.contains(key) ) {
-                requiredOpts.remove( requiredOpts.indexOf(key) );
+            if (requiredOpts.contains(key))
+            {
+                requiredOpts.remove(requiredOpts.indexOf(key));
             }
             requiredOpts.add(key);
         }
@@ -171,7 +164,7 @@
         return this;
     }
 
-    /** 
+    /**
      * Retrieve a read-only list of options in this set
      *
      * @return read-only Collection of {@link Option} objects in this descriptor
@@ -191,7 +184,7 @@
         return new ArrayList(shortOpts.values());
     }
 
-    /** 
+    /**
      * Returns the required options.
      *
      * @return List of required options
@@ -201,7 +194,7 @@
         return requiredOpts;
     }
 
-    /** 
+    /**
      * Retrieve the {@link Option} matching the long or short name specified.
      * The leading hyphens in the name are ignored (up to 2).
      *
@@ -220,9 +213,8 @@
         return (Option) longOpts.get(opt);
     }
 
-    /** 
-     * Returns whether the named {@link Option} is a member
-     * of this {@link Options}.
+    /**
+     * Returns whether the named {@link Option} is a member of this {@link Options}.
      *
      * @param opt short or long name of the {@link Option}
      * @return true if the named {@link Option} is a member
@@ -235,9 +227,8 @@
         return shortOpts.containsKey(opt) || longOpts.containsKey(opt);
     }
 
-    /** 
-     * Returns the OptionGroup the <code>opt</code>
-     * belongs to.
+    /**
+     * Returns the OptionGroup the <code>opt</code> belongs to.
      * @param opt the option whose OptionGroup is being queried.
      *
      * @return the OptionGroup if <code>opt</code> is part
@@ -248,7 +239,7 @@
         return (OptionGroup) optionGroups.get(opt.getKey());
     }
 
-    /** 
+    /**
      * Dump state, suitable for debugging.
      *
      * @return Stringified form of this object

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/ParseException.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/ParseException.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/ParseException.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/ParseException.java Tue Jul 29 01:13:48 2008
@@ -21,7 +21,7 @@
  * Base for Exceptions thrown during parsing of a command-line.
  *
  * @author bob mcwhirter (bob @ werken.com)
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
 public class ParseException extends Exception
 {

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Parser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Parser.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Parser.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Parser.java Tue Jul 29 01:13:48 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.cli;
 
 import java.util.ArrayList;
@@ -25,14 +26,13 @@
 import java.util.Properties;
 
 /**
- * <p><code>Parser</code> creates {@link CommandLine}s.</p>
+ * <code>Parser</code> creates {@link CommandLine}s.
  *
  * @author John Keyes (john at integralsource.com)
- * @see Parser
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
-public abstract class Parser implements CommandLineParser {
-
+public abstract class Parser implements CommandLineParser
+{
     /** commandline instance */
     protected CommandLine cmd;
 
@@ -42,37 +42,37 @@
     /** list of required options strings */
     private List requiredOptions;
 
-    protected void setOptions(final Options options) {
+    protected void setOptions(final Options options)
+    {
         this.options = options;
         this.requiredOptions = new ArrayList(options.getRequiredOptions());
     }
 
-    protected Options getOptions() {
+    protected Options getOptions()
+    {
         return options;
     }
 
-    protected List getRequiredOptions() {
+    protected List getRequiredOptions()
+    {
         return requiredOptions;
     }
 
-
     /**
-     * <p>Subclasses must implement this method to reduce
-     * the <code>arguments</code> that have been passed to the parse 
-     * method.</p>
+     * Subclasses must implement this method to reduce
+     * the <code>arguments</code> that have been passed to the parse method.
      *
      * @param opts The Options to parse the arguments by.
      * @param arguments The arguments that have to be flattened.
-     * @param stopAtNonOption specifies whether to stop 
+     * @param stopAtNonOption specifies whether to stop
      * flattening when a non option has been encountered
      * @return a String array of the flattened arguments
      */
-    protected abstract String[] flatten(Options opts, String[] arguments, 
-                                        boolean stopAtNonOption);
+    protected abstract String[] flatten(Options opts, String[] arguments, boolean stopAtNonOption);
 
     /**
-     * <p>Parses the specified <code>arguments</code> 
-     * based on the specifed {@link Options}.</p>
+     * Parses the specified <code>arguments</code> based
+     * on the specifed {@link Options}.
      *
      * @param options the <code>Options</code>
      * @param arguments the <code>arguments</code>
@@ -80,51 +80,41 @@
      * @throws ParseException if an error occurs when parsing the
      * arguments.
      */
-    public CommandLine parse(Options options, String[] arguments)
-                      throws ParseException
+    public CommandLine parse(Options options, String[] arguments) throws ParseException
     {
         return parse(options, arguments, null, false);
     }
 
     /**
-     * Parse the arguments according to the specified options and
-     * properties.
+     * Parse the arguments according to the specified options and properties.
      *
-     * @param options the specified Options
-     * @param arguments the command line arguments
+     * @param options    the specified Options
+     * @param arguments  the command line arguments
      * @param properties command line option name-value pairs
      * @return the list of atomic option and value tokens
-     *
      * @throws ParseException if there are any problems encountered
-     * while parsing the command line tokens.
+     *                        while parsing the command line tokens.
      *
      * @since 1.1
      */
-    public CommandLine parse(Options options, String[] arguments, 
-                             Properties properties)
-        throws ParseException
+    public CommandLine parse(Options options, String[] arguments, Properties properties) throws ParseException
     {
         return parse(options, arguments, properties, false);
     }
 
     /**
-     * <p>Parses the specified <code>arguments</code> 
-     * based on the specifed {@link Options}.</p>
-     *
-     * @param options the <code>Options</code>
-     * @param arguments the <code>arguments</code>
-     * @param stopAtNonOption specifies whether to stop 
-     * interpreting the arguments when a non option has 
-     * been encountered and to add them to the CommandLines
-     * args list.
+     * Parses the specified <code>arguments</code>
+     * based on the specifed {@link Options}.
      *
+     * @param options         the <code>Options</code>
+     * @param arguments       the <code>arguments</code>
+     * @param stopAtNonOption specifies whether to stop interpreting the
+     *                        arguments when a non option has been encountered
+     *                        and to add them to the CommandLines args list.
      * @return the <code>CommandLine</code>
-     * @throws ParseException if an error occurs when parsing the
-     * arguments.
+     * @throws ParseException if an error occurs when parsing the arguments.
      */
-    public CommandLine parse(Options options, String[] arguments, 
-                             boolean stopAtNonOption)
-        throws ParseException
+    public CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException
     {
         return parse(options, arguments, null, stopAtNonOption);
     }
@@ -146,12 +136,12 @@
      *
      * @since 1.1
      */
-    public CommandLine parse(Options options, String[] arguments, 
-                             Properties properties, boolean stopAtNonOption)
-        throws ParseException
+    public CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption)
+            throws ParseException
     {
         // clear out the data in options in case it's been used before (CLI-71)
-        for (Iterator it = options.helpOptions().iterator(); it.hasNext();) {
+        for (Iterator it = options.helpOptions().iterator(); it.hasNext();)
+        {
             Option opt = (Option) it.next();
             opt.clearValues();
         }
@@ -168,9 +158,7 @@
             arguments = new String[0];
         }
 
-        List tokenList = Arrays.asList(flatten(getOptions(), 
-                                               arguments, 
-                                               stopAtNonOption));
+        List tokenList = Arrays.asList(flatten(getOptions(), arguments, stopAtNonOption));
 
         ListIterator iterator = tokenList.listIterator();
 
@@ -246,8 +234,7 @@
     }
 
     /**
-     * <p>Sets the values of Options using the values in 
-     * <code>properties</code>.</p>
+     * Sets the values of Options using the values in <code>properties</code>.
      *
      * @param properties The value properties to be processed.
      */
@@ -271,8 +258,7 @@
 
                 if (opt.hasArg())
                 {
-                    if ((opt.getValues() == null)
-                        || (opt.getValues().length == 0))
+                    if (opt.getValues() == null || opt.getValues().length == 0)
                     {
                         try
                         {
@@ -284,9 +270,9 @@
                         }
                     }
                 }
-                else if (!("yes".equalsIgnoreCase(value) 
-                           || "true".equalsIgnoreCase(value)
-                           || "1".equalsIgnoreCase(value)))
+                else if (!("yes".equalsIgnoreCase(value)
+                        || "true".equalsIgnoreCase(value)
+                        || "1".equalsIgnoreCase(value)))
                 {
                     // if the value is not yes, true or 1 then don't add the
                     // option to the CommandLine
@@ -316,7 +302,7 @@
 
     /**
      * <p>Process the argument values for the specified Option
-     * <code>opt</code> using the values retrieved from the 
+     * <code>opt</code> using the values retrieved from the
      * specified iterator <code>iter</code>.
      *
      * @param opt The current Option
@@ -326,8 +312,7 @@
      * @throws ParseException if an argument value is required
      * and it is has not been found.
      */
-    public void processArgs(Option opt, ListIterator iter)
-        throws ParseException
+    public void processArgs(Option opt, ListIterator iter) throws ParseException
     {
         // loop until an option is found
         while (iter.hasNext())
@@ -344,7 +329,7 @@
             // found a value
             try
             {
-                opt.addValueForProcessing( Util.stripLeadingAndTrailingQuotes(str) );
+                opt.addValueForProcessing(Util.stripLeadingAndTrailingQuotes(str));
             }
             catch (RuntimeException exp)
             {
@@ -353,26 +338,22 @@
             }
         }
 
-        if ((opt.getValues() == null) && !opt.hasOptionalArg())
+        if (opt.getValues() == null && !opt.hasOptionalArg())
         {
             throw new MissingArgumentException(opt);
         }
     }
 
     /**
-     * <p>Process the Option specified by <code>arg</code>
-     * using the values retrieved from the specfied iterator
-     * <code>iter</code>.
+     * Process the Option specified by <code>arg</code> using the values
+     * retrieved from the specfied iterator <code>iter</code>.
      *
      * @param arg The String value representing an Option
-     * @param iter The iterator over the flattened command 
-     * line arguments.
+     * @param iter The iterator over the flattened command line arguments.
      *
-     * @throws ParseException if <code>arg</code> does not
-     * represent an Option
+     * @throws ParseException if <code>arg</code> does not represent an Option
      */
-    protected void processOption(String arg, ListIterator iter)
-        throws ParseException
+    protected void processOption(String arg, ListIterator iter) throws ParseException
     {
         boolean hasOption = getOptions().hasOption(arg);
 
@@ -381,7 +362,7 @@
         {
             throw new UnrecognizedOptionException("Unrecognized option: " + arg, arg);
         }
-        
+
         // get the option represented by arg
         Option opt = (Option) getOptions().getOption(arg).clone();
 
@@ -412,7 +393,6 @@
             processArgs(opt, iter);
         }
 
-
         // set the option on the command line
         cmd.addOption(opt);
     }

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PatternOptionBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PatternOptionBuilder.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PatternOptionBuilder.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PatternOptionBuilder.java Tue Jul 29 01:13:48 2008
@@ -22,7 +22,7 @@
 import java.net.URL;
 import java.util.Date;
 
-/** 
+/**
  * <p>
  * Allows Options to be created from a single String.
  * The pattern contains various single character flags and via
@@ -46,15 +46,15 @@
  * <code>Options options = PatternOptionBuilder.parsePattern("vp:!f/");</code>
  *
  * <p>
- * TODO These need to break out to OptionType and also 
+ * TODO These need to break out to OptionType and also
  * to be pluggable.
  * </p>
  *
  * @author Henri Yandell (bayard @ generationjava.com)
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
-public class PatternOptionBuilder {
-
+public class PatternOptionBuilder
+{
     /** String class */
     public static final Class STRING_VALUE = String.class;
 
@@ -70,7 +70,7 @@
     /** Class class */
     public static final Class CLASS_VALUE = Class.class;
 
-    /// can we do this one?? 
+    /// can we do this one??
     // is meant to check that the file exists, else it errors.
     // ie) it's for reading not writing.
 
@@ -122,7 +122,7 @@
     /**
      * Returns whether <code>ch</code> is a value code, i.e.
      * whether it represents a class in a pattern.
-     * 
+     *
      * @param ch the specified character
      * @return true if <code>ch</code> is a value code, otherwise false.
      */
@@ -141,8 +141,7 @@
     }
 
     /**
-     * Returns the {@link Options} instance represented by 
-     * <code>pattern</code>.
+     * Returns the {@link Options} instance represented by <code>pattern</code>.
      *
      * @param pattern the pattern string
      * @return The {@link Options} instance
@@ -159,7 +158,7 @@
         {
             char ch = pattern.charAt(i);
 
-            // a value code comes after an option and specifies 
+            // a value code comes after an option and specifies
             // details about it
             if (!isValueCode(ch))
             {
@@ -168,7 +167,7 @@
                     OptionBuilder.hasArg(type != null);
                     OptionBuilder.isRequired(required);
                     OptionBuilder.withType(type);
-                    
+
                     // we have a previous one to deal with
                     options.addOption(OptionBuilder.create(opt));
                     required = false;
@@ -193,7 +192,7 @@
             OptionBuilder.hasArg(type != null);
             OptionBuilder.isRequired(required);
             OptionBuilder.withType(type);
-            
+
             // we have a final one to deal with
             options.addOption(OptionBuilder.create(opt));
         }



Mime
View raw message