You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Brian Egge (JIRA)" <ji...@apache.org> on 2007/06/05 04:06:26 UTC

[jira] Created: (CLI-131) Options class returns options in random order

Options class returns options in random order
---------------------------------------------

                 Key: CLI-131
                 URL: https://issues.apache.org/jira/browse/CLI-131
             Project: Commons CLI
          Issue Type: Improvement
          Components: CLI-1.x
    Affects Versions: 1.0, 1.1
            Reporter: Brian Egge
            Priority: Minor
             Fix For: 1.1


The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.

The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Updated: (CLI-131) Options class returns options in random order

Posted by "Brian Egge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Egge updated CLI-131:
---------------------------

    Attachment:     (was: bug131.patch)

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Updated: (CLI-131) Options class returns options in random order

Posted by "Brian Egge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Egge updated CLI-131:
---------------------------

    Attachment: bug131b.patch

Fix two test cases which broke because of the change in ordering.

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch, bug131b.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Commented: (CLI-131) Options class returns options in random order

Posted by "Brian Egge (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501451 ] 

Brian Egge commented on CLI-131:
--------------------------------

CheckStyle uses the commons-cli and still supports Java 1.3, so I may need to have a think about this fix.  

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Commented: (CLI-131) Options class returns options in random order

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501442 ] 

Henri Yandell commented on CLI-131:
-----------------------------------

Under 1.3, you get the following error.

    [junit] Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/Node

Which is a bit odd as I have xml-apis.jar in my ANT_HOME.

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Commented: (CLI-131) Options class returns options in random order

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501838 ] 

Henri Yandell commented on CLI-131:
-----------------------------------

Patches applied. Thanks Brian :)

I moved the HelpFormatterTest stuff into TestHelpFormatter. I'll rename that file to the more logical HelpFormatterTest in a moment.

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch, bug131b.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Closed: (CLI-131) Options class returns options in random order

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed CLI-131.
-----------------------------

    Resolution: Fixed

Rename done.

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch, bug131b.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Updated: (CLI-131) Options class returns options in random order

Posted by "Brian Egge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Egge updated CLI-131:
---------------------------

    Attachment: bug131.patch

Fix the issue by sorting the options inside the HelpFormatter class.  This fix would be the least likely to cause problems with existing usage.

Another option would be to have the Options class use TreeMaps instead of HashMaps.  

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Commented: (CLI-131) Options class returns options in random order

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501436 ] 

Henri Yandell commented on CLI-131:
-----------------------------------

The usual JDK version worries. Can't remember if we're meant to be supporting 1.2 and 1.3. Personally; I vote 1.4.

Sounds like a good improvement to me otherwise.

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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


[jira] Updated: (CLI-131) Options class returns options in random order

Posted by "Brian Egge (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Egge updated CLI-131:
---------------------------

    Attachment: bug131.patch

Changed the HashMaps to LinkedHashMaps will preserve the insertion order.  Fix and test case attached.

> Options class returns options in random order
> ---------------------------------------------
>
>                 Key: CLI-131
>                 URL: https://issues.apache.org/jira/browse/CLI-131
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1
>            Reporter: Brian Egge
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: bug131.patch
>
>
> The help formatter auto usage returns the options in a somewhat random order.  This is because the options are inserted in a HashMap, and then a copy of the collection is returned with the getOptions() method.
> The getOptions method should return the options in the order they were added, or in a sorted order.

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


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