You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/07/01 12:04:49 UTC
(maven-shared-utils) branch fix/prettyprint-npe-null-lineindent created (now b38df77)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a change to branch fix/prettyprint-npe-null-lineindent
in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git
at b38df77 PrettyPrintXMLWriter: handle null lineIndent/lineSeparator in constructors
This branch includes the following new commits:
new 581ca4a Add failing test: PrettyPrintXMLWriter with null lineIndent
new b38df77 PrettyPrintXMLWriter: handle null lineIndent/lineSeparator in constructors
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-shared-utils) 02/02: PrettyPrintXMLWriter: handle null lineIndent/lineSeparator in constructors
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch fix/prettyprint-npe-null-lineindent
in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git
commit b38df77f1e57ad66b017c6ba914b4f63c0558323
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Wed Jul 1 08:04:39 2026 -0400
PrettyPrintXMLWriter: handle null lineIndent/lineSeparator in constructors
---
.../maven/shared/utils/xml/PrettyPrintXMLWriter.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java b/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java
index f611d2f..523a106 100644
--- a/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java
+++ b/src/main/java/org/apache/maven/shared/utils/xml/PrettyPrintXMLWriter.java
@@ -95,7 +95,12 @@ public class PrettyPrintXMLWriter implements XMLWriter {
* @param doctype can be null
*/
public PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String encoding, String doctype) {
- this(writer, lineIndent.toCharArray(), "\n".toCharArray(), encoding, doctype);
+ this(
+ writer,
+ lineIndent != null ? lineIndent.toCharArray() : DEFAULT_LINE_INDENT,
+ "\n".toCharArray(),
+ encoding,
+ doctype);
}
/**
@@ -135,7 +140,12 @@ public class PrettyPrintXMLWriter implements XMLWriter {
*/
public PrettyPrintXMLWriter(
PrintWriter writer, String lineIndent, String lineSeparator, String encoding, String doctype) {
- this(writer, lineIndent.toCharArray(), lineSeparator.toCharArray(), encoding, doctype);
+ this(
+ writer,
+ lineIndent != null ? lineIndent.toCharArray() : DEFAULT_LINE_INDENT,
+ lineSeparator != null ? lineSeparator.toCharArray() : "\n".toCharArray(),
+ encoding,
+ doctype);
}
/**
(maven-shared-utils) 01/02: Add failing test: PrettyPrintXMLWriter with null lineIndent
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch fix/prettyprint-npe-null-lineindent
in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git
commit 581ca4afbbce35a85cfcc77827e65729dab45e20
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Wed Jul 1 08:04:14 2026 -0400
Add failing test: PrettyPrintXMLWriter with null lineIndent
---
.../apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java b/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java
index ee210cb..b798cb8 100644
--- a/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java
@@ -93,6 +93,13 @@ public class PrettyPrintXmlWriterTest {
assertEquals(expectedResult(" "), w.toString());
}
+ @Test
+ public void testPrettyPrintXMLWriterWithNullLineIndent() throws IOException {
+ PrettyPrintXMLWriter w = new PrettyPrintXMLWriter(new StringWriter(), (String) null);
+ w.startElement("div");
+ w.endElement();
+ }
+
@Test
public void testEscapeXmlAttributeWindows() throws IOException {
// Windows