Constructors accepting a String lineIndent parameter document that it "can be null" (e.g. PrettyPrintXMLWriter(Writer, String)), but then call lineIndent.toCharArray() without a null check, throwing NullPointerException.
Impacted constructors:
PrettyPrintXMLWriter(PrintWriter, String) (line 65) → PrettyPrintXMLWriter(PrintWriter, String, String, String) (line 98)
PrettyPrintXMLWriter(Writer, String) (line 73)
PrettyPrintXMLWriter(Writer, String, String, String) (line 107)
PrettyPrintXMLWriter(PrintWriter, String, String, String, String) (line 138)
Also setLineSeparator(String) and setLineIndenter(String) have the same pattern, though their Javadocs don't say null is allowed.
When null is passed, the expected behavior should be to fall back to the default: two spaces for line indent, newline for line separator.
Constructors accepting a
String lineIndentparameter document that it "can be null" (e.g.PrettyPrintXMLWriter(Writer, String)), but then calllineIndent.toCharArray()without a null check, throwingNullPointerException.Impacted constructors:
PrettyPrintXMLWriter(PrintWriter, String)(line 65) →PrettyPrintXMLWriter(PrintWriter, String, String, String)(line 98)PrettyPrintXMLWriter(Writer, String)(line 73)PrettyPrintXMLWriter(Writer, String, String, String)(line 107)PrettyPrintXMLWriter(PrintWriter, String, String, String, String)(line 138)Also
setLineSeparator(String)andsetLineIndenter(String)have the same pattern, though their Javadocs don't say null is allowed.When null is passed, the expected behavior should be to fall back to the default: two spaces for line indent, newline for line separator.