@@ -82,7 +82,7 @@ public static final class Builder implements Supplier<HelpFormatter> {
8282 /**
8383 * The output PrintWriter, defaults to wrapping {@link System#out}.
8484 */
85- private PrintWriter printStream = new PrintWriter ( System . out );
85+ private PrintWriter printStream = createDefaultPrintWriter ( );
8686
8787 @ Override
8888 public HelpFormatter get () {
@@ -174,6 +174,10 @@ public static Builder builder() {
174174 return new Builder ();
175175 }
176176
177+ private static PrintWriter createDefaultPrintWriter () {
178+ return new PrintWriter (System .out );
179+ }
180+
177181 /**
178182 * Number of characters per line
179183 *
@@ -264,7 +268,7 @@ public static Builder builder() {
264268 * Constructs a new instance.
265269 */
266270 public HelpFormatter () {
267- this (false , new PrintWriter ( System . out ));
271+ this (false , createDefaultPrintWriter ( ));
268272 }
269273
270274 /**
@@ -546,7 +550,6 @@ public void printHelp(final PrintWriter pw, final int width, final String cmdLin
546550 * @param descPad the number of characters of padding to be prefixed to each description line
547551 * @param footer the banner to display at the end of the help
548552 * @param autoUsage whether to print an automatically generated usage statement
549- *
550553 * @throws IllegalStateException if there is no room to print a line
551554 */
552555 public void printHelp (final PrintWriter pw , final int width , final String cmdLineSyntax , final String header , final Options options , final int leftPad ,
@@ -863,7 +866,6 @@ private Appendable renderWrappedTextBlock(final StringBuffer sb, final int width
863866 * Removes the trailing whitespace from the specified String.
864867 *
865868 * @param s The String to remove the trailing padding from.
866- *
867869 * @return The String of without the trailing padding
868870 */
869871 protected String rtrim (final String s ) {
0 commit comments