Fix XML configuration line endings
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0752fed1 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0752fed1 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0752fed1 Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext Commit: 0752fed1f6448ea04bbc0400b5c74b3d837376d4 Parents: e18fcb7 Author: Mikael Ståldal <mikael.stal...@magine.com> Authored: Fri Sep 2 15:25:59 2016 +0200 Committer: Mikael Ståldal <mikael.stal...@magine.com> Committed: Fri Sep 2 15:25:59 2016 +0200 ---------------------------------------------------------------------- .../builder/impl/DefaultConfigurationBuilder.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0752fed1/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java index 62fd716..5e702ab 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/DefaultConfigurationBuilder.java @@ -22,6 +22,9 @@ import java.io.StringWriter; import java.lang.reflect.Constructor; import java.util.List; import java.util.Map; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.Filter; @@ -44,10 +47,6 @@ import org.apache.logging.log4j.core.config.builder.api.ScriptComponentBuilder; import org.apache.logging.log4j.core.config.builder.api.ScriptFileComponentBuilder; import org.apache.logging.log4j.core.util.Throwables; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - /** * @param <T> The BuiltConfiguration type. * @since 2.4 @@ -226,7 +225,7 @@ public class DefaultConfigurationBuilder<T extends BuiltConfiguration> implement private void writeXmlConfiguration(XMLStreamWriter xmlWriter) throws XMLStreamException { xmlWriter.writeStartDocument(); - xmlWriter.writeCharacters(System.lineSeparator()); + xmlWriter.writeCharacters("\n"); xmlWriter.writeStartElement("Configuration"); if (name != null) { @@ -254,7 +253,7 @@ public class DefaultConfigurationBuilder<T extends BuiltConfiguration> implement xmlWriter.writeAttribute("monitorInterval", String.valueOf(monitorInterval)); } - xmlWriter.writeCharacters(System.lineSeparator()); + xmlWriter.writeCharacters("\n"); writeXmlSection(xmlWriter, properties); writeXmlSection(xmlWriter, scripts); @@ -268,7 +267,7 @@ public class DefaultConfigurationBuilder<T extends BuiltConfiguration> implement writeXmlSection(xmlWriter, loggers); xmlWriter.writeEndElement(); // "Configuration" - xmlWriter.writeCharacters(System.lineSeparator()); + xmlWriter.writeCharacters("\n"); xmlWriter.writeEndDocument(); } @@ -285,7 +284,7 @@ public class DefaultConfigurationBuilder<T extends BuiltConfiguration> implement xmlWriter.writeStartElement(component.getPluginType()); writeXmlAttributes(xmlWriter, component); if (!component.getComponents().isEmpty()) { - xmlWriter.writeCharacters(System.lineSeparator()); + xmlWriter.writeCharacters("\n"); } for (Component subComponent : component.getComponents()) { writeXmlComponent(xmlWriter, subComponent, nesting + 1); @@ -302,7 +301,7 @@ public class DefaultConfigurationBuilder<T extends BuiltConfiguration> implement xmlWriter.writeEmptyElement(component.getPluginType()); writeXmlAttributes(xmlWriter, component); } - xmlWriter.writeCharacters(System.lineSeparator()); + xmlWriter.writeCharacters("\n"); } private void writeXmlIndent(XMLStreamWriter xmlWriter, int nesting) throws XMLStreamException {