Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schreiber2015-10-15 03:49:33 -0400
committerMartin Schreiber2015-10-15 03:49:33 -0400
commitd780642ddd8181131ab764b681ca5c763301d105 (patch)
treeb424578e350056425e5987110fafa816ad0f9315
parentd8bd5c55fd2589718c27bded1d7cab02401a2e88 (diff)
downloadorg.eclipse.tycho-d780642ddd8181131ab764b681ca5c763301d105.tar.gz
org.eclipse.tycho-d780642ddd8181131ab764b681ca5c763301d105.tar.xz
org.eclipse.tycho-d780642ddd8181131ab764b681ca5c763301d105.zip
Bug 479746 Use UTF-8 as default encoding for writing POM
When there is no encoding specified in the xml prolog, UTF-8 is used as default encoding for writing the pom file, instead of falling back to the platform default (file.encoding system property) Bug: 479746 Change-Id: Ice614b2cfcf08a4844dd6bb95e2f5e83d640d69e Signed-off-by: Martin Schreiber <m.schreiber@bachmann.info>
-rw-r--r--tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java b/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java
index 3f5e4810a..ae3ffbead 100644
--- a/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java
+++ b/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java
@@ -38,6 +38,7 @@ import de.pdark.decentxml.XMLWriter;
public class MutablePomFile {
public static final String POM_XML = "pom.xml";
+ private static final String DEFAULT_XML_ENCODING = "UTF-8";
private static XMLParser parser = new XMLParser();
@@ -75,8 +76,8 @@ public class MutablePomFile {
}
public static void write(MutablePomFile pom, OutputStream out) throws IOException {
- Writer w = pom.document.getEncoding() != null ? new OutputStreamWriter(out, pom.document.getEncoding())
- : new OutputStreamWriter(out);
+ String encoding = pom.document.getEncoding() != null ? pom.document.getEncoding() : DEFAULT_XML_ENCODING;
+ Writer w = new OutputStreamWriter(out, encoding);
XMLWriter xw = new XMLWriter(w);
try {
pom.setVersionInXML();

Back to the top