Skip to content

Commit bfcb8e2

Browse files
committed
Only clone when text is not empty
1 parent c14fc56 commit bfcb8e2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ protected void insertAtPreferredLocation(Element parent, Element child, Counter
271271
lastText = (Text) next;
272272
}
273273
}
274-
if ((lastText != null) && (lastText.getTextTrim().isEmpty())) {
274+
if ((lastText != null) && (!lastText.getTextTrim().isEmpty())) {
275275
lastText = lastText.clone();
276276
} else {
277277
lastText = factory.text(lineSeparator + indentation.repeat(counter.getDepth()));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void should_not_add_extra_line_break() throws Exception {
362362
Approvals.verify(sw.toString());
363363
}
364364

365-
@ValueSource(strings = {"extra-line-pom.xml", "extra-line-pom_alt.xml"})
365+
@ValueSource(strings = { "extra-line-pom.xml", "extra-line-pom_alt.xml" })
366366
@ParameterizedTest
367367
void should_not_add_extra_line_break_alt(String inputFile) throws Exception {
368368
Path pom = Paths.get(getClass().getResource(inputFile).toURI());

0 commit comments

Comments
 (0)