brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #652: BROOKLYN-489: Fix XmlUtil.xpath character...
Date Tue, 25 Apr 2017 19:52:09 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/652#discussion_r113293256
  
    --- Diff: core/src/main/java/org/apache/brooklyn/util/core/xstream/XmlUtil.java ---
    @@ -65,7 +66,7 @@ public static String xpath(String xml, String xpath) {
         public static Object xpath(String xml, String xpath, QName returnType) {
             try {
                 DocumentBuilder builder = SharedDocumentBuilder.get();
    -            Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
    +            Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
    --- End diff --
    
    Better use `new InputSource( new StringReader( xml ) );`. Otherwise it's not clear how
`builder.parse(InputStream)` will decode the input. Probably will use the standard system
encoding again (since we don't have prologues on the files).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message