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]

Reply via email to