You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2019/08/19 15:06:54 UTC

[jclouds] branch 2.1.x updated: Use Guava charset enum

This is an automated email from the ASF dual-hosted git repository.

nacx pushed a commit to branch 2.1.x
in repository https://gitbox.apache.org/repos/asf/jclouds.git


The following commit(s) were added to refs/heads/2.1.x by this push:
     new 14ba1ab  Use Guava charset enum
14ba1ab is described below

commit 14ba1abcfb23e648109907f2a1c7e5a815041080
Author: Ignasi Barrera <na...@apache.org>
AuthorDate: Mon Aug 19 17:06:44 2019 +0200

    Use Guava charset enum
---
 core/src/main/java/org/jclouds/http/functions/ParseSax.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/src/main/java/org/jclouds/http/functions/ParseSax.java b/core/src/main/java/org/jclouds/http/functions/ParseSax.java
index a277922..c304306 100644
--- a/core/src/main/java/org/jclouds/http/functions/ParseSax.java
+++ b/core/src/main/java/org/jclouds/http/functions/ParseSax.java
@@ -25,7 +25,6 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
-import java.nio.charset.StandardCharsets;
 
 import javax.annotation.Resource;
 
@@ -35,15 +34,16 @@ import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.logging.Logger;
 import org.jclouds.rest.InvocationContext;
 import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Closeables2;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.DefaultHandler;
 
+import com.google.common.base.Charsets;
 import com.google.common.base.Function;
 import com.google.common.base.Throwables;
-import org.jclouds.util.Closeables2;
 
 /**
  * This object will parse the body of an HttpResponse and return the result of type <T> back to the
@@ -94,7 +94,7 @@ public class ParseSax<T> implements Function<HttpResponse, T>, InvocationContext
       String from = null;
       try {
          byte[] fromBytes = closeClientButKeepContentStream(response);
-         from = new String(fromBytes, StandardCharsets.UTF_8);
+         from = new String(fromBytes, Charsets.UTF_8);
          validateXml(from);
          // Use InputStream to skip over byte order mark.
          return doParse(new InputSource(new ByteArrayInputStream(fromBytes)));
@@ -135,7 +135,7 @@ public class ParseSax<T> implements Function<HttpResponse, T>, InvocationContext
 
    protected T doParse(InputSource from) throws IOException, SAXException {
       checkNotNull(from, "xml inputsource");
-      from.setEncoding(StandardCharsets.UTF_8.name());
+      from.setEncoding(Charsets.UTF_8.name());
       parser.setContentHandler(getHandler());
       // This method should accept documents with a BOM (Byte-order mark)
       parser.parse(from);