[ 
https://issues.apache.org/jira/browse/CLI-187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12737850#action_12737850
 ] 

Kristoff Kiefer commented on CLI-187:
-------------------------------------

I think I already found it.

Here is the result of my changes

Index: src/java/org/apache/commons/cli/OptionBuilder.java
===================================================================
--- src/java/org/apache/commons/cli/OptionBuilder.java  (revision 799814)
+++ src/java/org/apache/commons/cli/OptionBuilder.java  (working copy)
@@ -30,14 +30,19 @@
  */
 public final class OptionBuilder
 {
-    /** long option */
+    /**
+        * Default name for the Argument if unset in this OptionBuilder
+        */
+       private static final String DEFAULT_ARG_NAME = "arg";
+
+       /** long option */
     private static String longopt;
 
     /** option description */
     private static String description;
 
     /** argument name */
-    private static String argName;
+    private static String argName = DEFAULT_ARG_NAME;
 
     /** is required? */
     private static boolean required;
@@ -71,7 +76,7 @@
     private static void reset()
     {
         description = null;
-        argName = "arg";
+        argName = DEFAULT_ARG_NAME;
         longopt = null;
         type = null;
         required = false;


> OptionBuilder working incorrectly at first Invocation of create(...)
> --------------------------------------------------------------------
>
>                 Key: CLI-187
>                 URL: https://issues.apache.org/jira/browse/CLI-187
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: Options definition
>    Affects Versions: 1.3
>            Reporter: Kristoff Kiefer
>            Priority: Minor
>         Attachments: OptionBuilder.patch
>
>
> OptionBuilder is working incorrectly when invoked for the first time. Since 
> "argName" is null the arg-text will not be initialized for the first option 
> created. argName is set on the call to reset() though.
> So after the first Option created OptionBuilder works fine.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to