@@ -19,6 +19,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
1919import java .io .IOException ;
2020import java .util .Collection ;
2121import java .util .List ;
22+ import java .util .Objects ;
2223
2324import org .apache .commons .cli .help .FilterHelpAppendable ;
2425import org .apache .commons .cli .help .TableDefinition ;
@@ -46,7 +47,7 @@ public void appendHeader(final int level, final CharSequence text) throws IOExce
4647 if (level < 1 ) {
4748 throw new IllegalArgumentException ("level must be at least 1" );
4849 }
49- appendFormat ("<h%s>%s</h%1$s>%n" , level , StringEscapeUtils .escapeHtml4 (text .toString ()));
50+ appendFormat ("<h%s>%s</h%1$s>%n" , level , StringEscapeUtils .escapeHtml4 (Objects .toString (text )));
5051 }
5152 }
5253
@@ -62,7 +63,7 @@ public void appendList(final boolean ordered, final Collection<CharSequence> lis
6263 @ Override
6364 public void appendParagraph (final CharSequence paragraph ) throws IOException {
6465 if (StringUtils .isNotEmpty (paragraph )) {
65- appendFormat ("<p>%s</p>%n" , StringEscapeUtils .escapeHtml4 (paragraph .toString ()));
66+ appendFormat ("<p>%s</p>%n" , StringEscapeUtils .escapeHtml4 (Objects .toString (paragraph )));
6667 }
6768 }
6869
@@ -93,6 +94,6 @@ public void appendTable(final TableDefinition table) throws IOException {
9394
9495 @ Override
9596 public void appendTitle (final CharSequence title ) throws IOException {
96- appendFormat ("<span class='commons_cli_title'>%s</span>%n" , StringEscapeUtils .escapeHtml4 (title .toString ()));
97+ appendFormat ("<span class='commons_cli_title'>%s</span>%n" , StringEscapeUtils .escapeHtml4 (Objects .toString (title )));
9798 }
9899}
0 commit comments