Commons CLI
  1. Commons CLI
  2. CLI-162

infinite loop in the wrapping code of HelpFormatter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: Help formatter
    • Labels:
      None

      Description

      If there is not enough space to display a word on a single line, HelpFormatter goes into a infinite loops until the JVM crashes with an OutOfMemoryError.

      Test case:

      Options options = new Options();
      options.addOption("h", "help", false, "This is a looooong description");
      
      HelpFormatter formatter = new HelpFormatter();
      formatter.setWidth(20);
      formatter.printHelp("app", options); // hang & crash
      

      An helpful exception indicating the insufficient width would be more appropriate than an OutOfMemoryError.

      1. CLI-162-additional.patch
        2 kB
        Henri Yandell
      2. CLI-162-take2.patch
        2 kB
        Henri Yandell

        Issue Links

          Activity

          Emmanuel Bourg created issue -
          Henri Yandell made changes -
          Field Original Value New Value
          Link This issue is cloned as CLI-174 [ CLI-174 ]
          Henri Yandell made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Fix Version/s 1.2 [ 12312674 ]
          Fix Version/s 1.3 [ 12313321 ]
          ggregory@seagullsw.com made changes -
          Status Closed [ 6 ] Reopened [ 4 ]
          Resolution Fixed [ 1 ]
          Henri Yandell made changes -
          Attachment CLI-162-take2.patch [ 12400385 ]
          Henri Yandell made changes -
          Attachment CLI-162-additional.patch [ 12400574 ]
          Henri Yandell made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Mark Thomas made changes -
          Workflow jira [ 12436041 ] Default workflow, editable Closed status [ 12601477 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Emmanuel Bourg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development