Skip to content

Commit 774e6d1

Browse files
committed
Using textRaw for safe null check
1 parent 075fc38 commit 774e6d1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/io/fabric8/maven/LineBreakProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ protected void printElement(Writer out, FormatStack fstack, NamespaceStack nstac
2121
List<Element> children = element.getChildren();
2222
boolean addBreak = (idxElement > -1 && !children.isEmpty());
2323
if (addBreak) {
24-
out.write(fstack.getLineSeparator());
25-
out.write(fstack.getLevelIndent());
24+
textRaw(out, fstack.getLineSeparator());
25+
textRaw(out, fstack.getLevelIndent());
2626
}
2727
super.printElement(out, fstack, nstack, element);
2828
}

src/test/java/io/fabric8/maven/XMLFormatTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class XMLFormatTest {
1919

2020
@Test
2121
public void should_ident() {
22-
XMLFormat xmlFormat = XMLFormat.builder().indent(" ").textMode(XMLFormat.TextMode.TRIM).build();
22+
XMLFormat xmlFormat = XMLFormat.builder().indent(" ").build();
2323
String result = xmlFormat.format(new StringReader("<root><child/></root>"));
2424
Approvals.verify(result);
2525
}
@@ -28,7 +28,7 @@ public void should_ident() {
2828
public void should_ident_and_insert_line_break_on_major_sections() {
2929
InputStream resourceAsStream = getClass().getResourceAsStream("no-spaces-pom.xml");
3030
assertThat(resourceAsStream).isNotNull();
31-
XMLFormat xmlFormat = XMLFormat.builder().indent(" ").textMode(XMLFormat.TextMode.TRIM)
31+
XMLFormat xmlFormat = XMLFormat.builder().indent(" ")
3232
.insertLineBreakBetweenMajorSections().build();
3333
String result = xmlFormat.format(new InputStreamReader(resourceAsStream));
3434
Approvals.verify(result);

0 commit comments

Comments
 (0)