Opened ticket: https://issues.apache.org/jira/browse/CLI-351 to track.
I have found the issue and a fix.

On Mon, Sep 29, 2025 at 7:38 PM Gary Gregory <[email protected]> wrote:

> I can reproduce this. Any thoughts on a fix, Claude?
>
> Gary
>
> On Mon, Sep 29, 2025 at 12:40 PM Damien Carbonne
> <[email protected]> wrote:
> >
> > Hi,
> >
> > Starting with commons-cli-1.10.0, HelpFormatter enters an infinite loop
> > when its is passed a header or footer that contains 2 or more new line
> > (\n) characters.
> >
> > The following code shows this behaviour:
> >
> >          final HelpFormatter formatter = HelpFormatter.builder().get();
> >
> >          // OK
> >          formatter.printHelp("CL syntax",
> >                              "Header",
> >                              Collections.emptyList(),
> >                              "Footer",
> >                              true);
> >
> >          // KO Header (same behaviour with footer)
> >          formatter.printHelp("CL syntax",
> >                              "Header\n\n", // This makes printHelp enter
> > into an infinite loop
> >                              Collections.emptyList(),
> >                              "Footer",
> >                              true);
> >
> > It looks like a regression. Using several new line characters with
> > previous versions of CLI was working.
> > Even if using new line character in header or footer was forbidden, this
> > should not end in an infinite loop.
> >
> > Regards,
> >
> > Damien Carbonne
> >
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

-- 
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to