Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-35

HelpFormatter doesn't sort options properly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 1.1
    • Component/s: CLI-1.x
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Bugzilla Id:
      24184

      Description

      HelpFormatter is using an inner class Comparator implementation to sort Option
      objects, however it seems to be a bit confused about what types of object it is
      sorting. The inner class is called StringBufferComparator, although it's
      actually sorting Option objects. Further, it simply compares the object's
      toString() values rather than using the getKey() method which would perform the
      sort that the comments seem to indicate is desired. The sort that is actually
      performed doesn't appear to modify the ordering of the list at all.

        Activity

        Hide
        rfletch6@yahoo.co.uk Robert Fletcher added a comment -

        Created an attachment (id=8773)
        patch

        Show
        rfletch6@yahoo.co.uk Robert Fletcher added a comment - Created an attachment (id=8773) patch
        Hide
        roxspring Rob Oxspring added a comment -

        Patch applied (at last),

        Thanks,

        Rob

        Show
        roxspring Rob Oxspring added a comment - Patch applied (at last), Thanks, Rob

          People

          • Assignee:
            Unassigned
            Reporter:
            rfletch6@yahoo.co.uk Robert Fletcher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development