From 3411e80ff06e3f7b78bb035c1af92d151a5c9229 Mon Sep 17 00:00:00 2001 From: Victor Palma <74139941+vickmp@users.noreply.github.com> Date: Tue, 13 Sep 2022 10:33:05 +0200 Subject: [PATCH] B #5243: Fix encoding in java binding (#2279) (cherry picked from commit bcd319feb3bd3d7950df9dbe27ea0f9623e0aade) --- src/oca/java/src/org/opennebula/client/OneSystem.java | 6 +++--- src/oca/java/src/org/opennebula/client/Pool.java | 2 +- src/oca/java/src/org/opennebula/client/PoolElement.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/oca/java/src/org/opennebula/client/OneSystem.java b/src/oca/java/src/org/opennebula/client/OneSystem.java index 6122e11925..f88d869cf7 100644 --- a/src/oca/java/src/org/opennebula/client/OneSystem.java +++ b/src/oca/java/src/org/opennebula/client/OneSystem.java @@ -101,7 +101,7 @@ public class OneSystem DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse( - new ByteArrayInputStream(r.getMessage().getBytes())); + new ByteArrayInputStream(r.getMessage().getBytes("UTF-8"))); xml = doc.getDocumentElement(); } @@ -140,7 +140,7 @@ public class OneSystem DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse( - new ByteArrayInputStream(r.getMessage().getBytes())); + new ByteArrayInputStream(r.getMessage().getBytes("UTF-8"))); xml = doc.getDocumentElement(); } @@ -190,7 +190,7 @@ public class OneSystem DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse( - new ByteArrayInputStream(r.getMessage().getBytes())); + new ByteArrayInputStream(r.getMessage().getBytes("UTF-8"))); xml = doc.getDocumentElement(); } diff --git a/src/oca/java/src/org/opennebula/client/Pool.java b/src/oca/java/src/org/opennebula/client/Pool.java index ec4362df87..f8baeb055f 100644 --- a/src/oca/java/src/org/opennebula/client/Pool.java +++ b/src/oca/java/src/org/opennebula/client/Pool.java @@ -190,7 +190,7 @@ public abstract class Pool{ builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); doc = builder.parse( - new ByteArrayInputStream(info.getMessage().getBytes())); + new ByteArrayInputStream(info.getMessage().getBytes("UTF-8"))); xml = doc.getDocumentElement(); poolElements = (NodeList) xpath.evaluate(elementName, xml, XPathConstants.NODESET); diff --git a/src/oca/java/src/org/opennebula/client/PoolElement.java b/src/oca/java/src/org/opennebula/client/PoolElement.java index d86bc9388a..2f55d732b0 100644 --- a/src/oca/java/src/org/opennebula/client/PoolElement.java +++ b/src/oca/java/src/org/opennebula/client/PoolElement.java @@ -93,7 +93,7 @@ public abstract class PoolElement { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse( - new ByteArrayInputStream(info.getMessage().getBytes())); + new ByteArrayInputStream(info.getMessage().getBytes("UTF-8"))); xml = doc.getDocumentElement(); }