[CONFIGURATION-765] Refactor XMLConfiguration.write(Writer) to add
XMLConfiguration.write(Writer, Transformer).
diff --git a/pom.xml b/pom.xml
index 3e2dfc3..406afd7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>commons-configuration2</artifactId>
- <version>2.6.1-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
<name>Apache Commons Configuration</name>
<inceptionYear>2001</inceptionYear>
@@ -537,7 +537,7 @@
<properties>
<commons.componentid>configuration</commons.componentid>
<commons.module.name>org.apache.commons.configuration2</commons.module.name>
- <commons.release.version>2.6.1</commons.release.version>
+ <commons.release.version>2.7</commons.release.version>
<commons.release.desc>(reworked 2.x version)</commons.release.desc>
<commons.release.2.name>commons-configuration-${commons.release.2.version}</commons.release.2.name>
<commons.release.2.version>1.10</commons.release.2.version>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2e083bd..7ed196f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -25,7 +25,7 @@
</properties>
<body>
- <release version="2.6.1" date="2019-09-13"
+ <release version="2.7" date="2019-MM-DD"
description="Minor release with new features and updated dependencies.">
<action dev="ggregory" type="fix" issue="CONFIGURATION-761" due-to="Gary Gregory">
Single argument DataConfiguration APIs always create empty arrays.
@@ -39,6 +39,9 @@
<action dev="ggregory" type="update" issue="CONFIGURATION-763" due-to="Gary Gregory">
Update com.fasterxml.jackson.core:jackson-databind from 2.9.9 to 2.10.0.
</action>
+ <action dev="ggregory" type="add" issue="CONFIGURATION-765" due-to="Gary Gregory">
+ Refactor XMLConfiguration.write(Writer) to add XMLConfiguration.write(Writer, Transformer).
+ </action>
</release>
<release version="2.6" date="2019-09-13"
description="Minor release with new features and updated dependencies.">
diff --git a/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java b/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
index 34547c2..d74005a 100644
--- a/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
+++ b/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
@@ -1044,7 +1044,18 @@
@Override
public void write(final Writer writer) throws ConfigurationException, IOException
{
- final Transformer transformer = createTransformer();
+ write(writer, createTransformer());
+ }
+
+ /**
+ * Saves the configuration to the specified writer.
+ *
+ * @param writer the writer used to save the configuration.
+ * @param transformer How to transform this configuration.
+ * @throws ConfigurationException if an error occurs.
+ * @since 2.7.0
+ */
+ public void write(final Writer writer, final Transformer transformer) throws ConfigurationException {
final Source source = new DOMSource(createDocument());
final Result result = new StreamResult(writer);
XMLDocumentHelper.transform(transformer, source, result);