Repository: jclouds-labs
Updated Branches:
  refs/heads/master 3b0e07d06 -> 399cd1d0a


Prefer Charsets.UTF_8 over string literal

Found with modernizer-maven-plugin.


Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/399cd1d0
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/399cd1d0
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/399cd1d0

Branch: refs/heads/master
Commit: 399cd1d0ac217f522769fe157800d0bb898f4f61
Parents: 3b0e07d
Author: Andrew Gaul <[email protected]>
Authored: Thu Sep 18 18:09:43 2014 -0700
Committer: Andrew Gaul <[email protected]>
Committed: Thu Sep 18 18:09:43 2014 -0700

----------------------------------------------------------------------
 .../fujitsu/fgcp/handlers/ResponseNotSuccessHandler.java      | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/399cd1d0/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/ResponseNotSuccessHandler.java
----------------------------------------------------------------------
diff --git 
a/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/ResponseNotSuccessHandler.java
 
b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/ResponseNotSuccessHandler.java
index 6f3f59c..69e7a1a 100644
--- 
a/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/ResponseNotSuccessHandler.java
+++ 
b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/ResponseNotSuccessHandler.java
@@ -19,7 +19,6 @@ package org.jclouds.fujitsu.fgcp.handlers;
 import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
 import static org.jclouds.http.HttpUtils.releasePayload;
 
-import java.io.UnsupportedEncodingException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -32,6 +31,8 @@ import org.jclouds.http.HttpResponseException;
 import org.jclouds.rest.AuthorizationException;
 import org.jclouds.rest.ResourceNotFoundException;
 
+import com.google.common.base.Charsets;
+
 /**
  * This will parse the XML payload and set an appropriate exception on the
  * command object.
@@ -53,7 +54,7 @@ public class ResponseNotSuccessHandler implements 
HttpErrorHandler {
       Exception exception = null;
       try {
          byte[] data = closeClientButKeepContentStream(response);
-         String message = data != null ? new String(data, "UTF-8") : null;
+         String message = data != null ? new String(data, Charsets.UTF_8) : 
null;
          if (message != null) {
             Matcher ms = ERROR_STATUS_PATTERN.matcher(message);
             Matcher mm = ERROR_MESSAGE_PATTERN.matcher(message);
@@ -66,8 +67,6 @@ public class ResponseNotSuccessHandler implements 
HttpErrorHandler {
                exception = refineException(new HttpResponseException(command, 
response, status + ": " + errorMessage));
             }
          }
-      } catch (UnsupportedEncodingException e) {
-         // should never happen as UTF-8 is always supported
       } finally {
          if (exception == null) {
             exception = new HttpResponseException(command, response);

Reply via email to