cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [3/3] cxf git commit: Switch to use StandardCharset.UTF_8 instead of string literal
Date Tue, 10 Nov 2015 17:19:56 GMT
Switch to use StandardCharset.UTF_8 instead of string literal


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/173ec897
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/173ec897
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/173ec897

Branch: refs/heads/master
Commit: 173ec8971c78dd7c8fc311617b6e25718af23da8
Parents: e10281a
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Tue Nov 10 17:19:19 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue Nov 10 17:19:19 2015 +0000

----------------------------------------------------------------------
 core/src/main/java/org/apache/cxf/BusFactory.java   |  3 ++-
 .../apache/cxf/attachment/AttachmentSerializer.java |  5 +++--
 .../org/apache/cxf/attachment/AttachmentUtil.java   |  8 +++++---
 .../java/org/apache/cxf/attachment/Rfc5987Util.java |  3 ++-
 .../bus/extension/TextExtensionFragmentParser.java  |  3 ++-
 .../cxf/bus/spring/BusApplicationContext.java       |  3 ++-
 .../apache/cxf/common/jaxb/JAXBContextCache.java    |  3 ++-
 .../java/org/apache/cxf/common/jaxb/JAXBUtils.java  |  5 +++--
 .../apache/cxf/common/util/Base64UrlUtility.java    |  8 ++------
 .../org/apache/cxf/common/util/Base64Utility.java   |  6 ++----
 .../org/apache/cxf/common/util/StringUtils.java     |  3 ++-
 .../org/apache/cxf/common/util/URIParserUtil.java   | 16 ++++++----------
 .../java/org/apache/cxf/common/util/UrlUtils.java   |  7 ++++---
 .../org/apache/cxf/helpers/HttpHeaderHelper.java    |  2 +-
 .../AbstractOutDatabindingInterceptor.java          |  3 ++-
 .../apache/cxf/interceptor/StaxOutInterceptor.java  |  3 ++-
 .../java/org/apache/cxf/io/CachedOutputStream.java  |  5 +++--
 .../main/java/org/apache/cxf/io/CachedWriter.java   |  3 ++-
 .../java/org/apache/cxf/staxutils/StaxUtils.java    |  5 +++--
 .../cxf/attachment/AttachmentDeserializerTest.java  |  5 +++--
 .../org/apache/cxf/attachment/Rfc5987UtilTest.java  |  5 +++--
 .../apache/cxf/common/util/Base64UtilityTest.java   |  5 +++--
 .../org/apache/cxf/io/CachedStreamTestBase.java     |  5 +++--
 .../staxutils/transform/OutTransformWriterTest.java |  9 +++++----
 .../cxf/staxutils/transform/TransformTestUtils.java |  3 ++-
 .../server/controllers/ApplicationController.java   |  2 +-
 .../server/controllers/MemoryOAuthDataProvider.java |  2 +-
 .../java/org/apache/cxf/jaxb/io/DataWriterImpl.java |  3 ++-
 .../cxf/ext/logging/LoggingInInterceptor.java       |  3 ++-
 .../org/apache/cxf/ext/logging/SOAPLoggingTest.java |  9 +++++----
 .../org/apache/cxf/jaxrs/impl/ResponseImpl.java     |  3 ++-
 .../cxf/jaxrs/interceptor/JAXRSOutInterceptor.java  |  5 +++--
 .../cxf/jaxrs/provider/BinaryDataProvider.java      |  3 ++-
 .../cxf/jaxrs/provider/DataBindingProvider.java     |  3 ++-
 .../cxf/jaxrs/provider/FormEncodingProvider.java    |  5 +++--
 .../cxf/jaxrs/provider/JAXBElementProvider.java     |  3 ++-
 .../cxf/jaxrs/provider/PrimitiveTextProvider.java   |  5 +++--
 .../apache/cxf/jaxrs/provider/SourceProvider.java   |  3 ++-
 .../cxf/jaxrs/provider/StringTextProvider.java      |  5 +++--
 .../apache/cxf/jaxrs/provider/XSLTJaxbProvider.java |  3 ++-
 .../java/org/apache/cxf/jaxrs/utils/FormUtils.java  |  8 ++++----
 .../java/org/apache/cxf/jaxrs/utils/HttpUtils.java  |  5 +++--
 .../java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java |  3 ++-
 .../org/apache/cxf/jaxrs/utils/ResourceUtils.java   |  3 ++-
 .../cxf/jaxrs/utils/schemas/SchemaHandler.java      |  3 ++-
 .../org/apache/cxf/jaxrs/impl/RequestImplTest.java  | 13 +++++++------
 .../jaxrs/provider/FormEncodingProviderTest.java    |  3 ++-
 .../cxf/jaxrs/provider/JAXBElementProviderTest.java |  7 ++++---
 .../jaxrs/provider/PrimitiveTextProviderTest.java   |  3 ++-
 .../org/apache/cxf/jaxrs/utils/FormUtilsTest.java   | 10 +++++++---
 .../org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java  |  5 +++--
 .../cxf/jaxws/interceptors/SwAOutInterceptor.java   |  9 +++------
 .../apache/cxf/js/rhino/JsServiceFactoryBean.java   |  3 ++-
 .../jaxrs/provider/aegis/AegisElementProvider.java  |  3 ++-
 .../cxf/jaxrs/provider/aegis/AegisJSONProvider.java |  3 ++-
 .../cxf/jaxrs/provider/json/JSONProvider.java       |  5 +++--
 .../cxf/jaxrs/provider/json/utils/JSONUtils.java    |  3 ++-
 .../provider/jsonp/AbstractJsonpOutInterceptor.java |  3 ++-
 .../provider/jsonp/JsonpJaxrsWriterInterceptor.java |  3 ++-
 .../jaxrs/provider/atom/AtomPojoProviderTest.java   |  6 +++---
 .../cxf/jaxrs/provider/dom4j/DOM4JProviderTest.java |  5 +++--
 .../jaxrs/ext/search/hbase/HBaseQueryVisitor.java   | 15 ++++-----------
 .../jose/jaxrs/AbstractJweDecryptingFilter.java     |  4 +++-
 .../jose/jaxrs/JwsJsonWriterInterceptor.java        |  3 ++-
 .../security/jose/jaxrs/JwsWriterInterceptor.java   |  3 ++-
 .../cxf/rs/security/jose/common/JoseUtils.java      |  9 ++-------
 .../rs/security/jose/jwe/JweCompactConsumer.java    |  9 ++-------
 .../rs/security/jose/jwe/JweDecryptionOutput.java   | 10 ++--------
 .../cxf/rs/security/jose/jwe/JweJsonConsumer.java   |  9 ++-------
 .../rs/security/jose/jwe/JweJwtCompactConsumer.java |  3 ++-
 .../jwe/PbesHmacAesWrapKeyEncryptionAlgorithm.java  |  4 ++--
 .../apache/cxf/rs/security/jose/jwk/JwkUtils.java   |  3 ++-
 .../jose/jwe/JweCompactReaderWriterTest.java        | 11 ++++++-----
 .../rs/security/jose/jwe/JwePbeHmacAesWrapTest.java |  5 +++--
 .../cxf/rs/security/oauth/utils/OAuthUtils.java     |  3 ++-
 .../oauth2/grants/saml/Saml2BearerGrantHandler.java |  6 ++++--
 .../oauth2/client/ClientCodeRequestFilter.java      |  5 +++--
 .../rs/security/oauth2/client/OAuthClientUtils.java |  3 ++-
 .../oauth2/grants/jwt/JwtBearerGrantHandler.java    |  3 ++-
 .../security/oauth2/provider/OAuthJSONProvider.java |  5 +++--
 .../security/oidc/rp/OidcIdTokenRequestFilter.java  |  5 +++--
 .../oidc/rp/OidcRpAuthenticationFilter.java         |  5 +++--
 .../AbstractRequestAssertionConsumerHandler.java    | 12 ++++--------
 .../saml/sso/AbstractServiceProviderFilter.java     |  3 ++-
 .../cxf/rs/security/saml/sso/MetadataWriter.java    |  3 ++-
 .../saml/sso/SAMLProtocolResponseValidator.java     |  3 ++-
 .../rs/security/saml/sso/SamlPostBindingFilter.java |  5 +++--
 .../saml/sso/SamlRedirectBindingFilter.java         | 13 +++++++------
 .../cxf/rs/security/saml/AbstractSamlInHandler.java |  3 ++-
 .../security/saml/AbstractSamlOutInterceptor.java   | 10 +++-------
 .../rs/security/saml/SamlEnvelopedInHandler.java    |  3 ++-
 .../rs/security/xml/AbstractXmlEncInHandler.java    |  3 ++-
 .../rs/security/xml/AbstractXmlSecInHandler.java    |  3 ++-
 .../cxf/rs/security/xml/XmlSecOutInterceptor.java   |  3 ++-
 .../apache/cxf/rt/security/crypto/CryptoUtils.java  |  5 +++--
 .../apache/cxf/rt/security/crypto/HmacUtils.java    |  8 ++------
 .../cxf/rt/security/crypto/MessageDigestUtils.java  |  6 ++----
 .../http_jetty/JettyHTTPDestinationTest.java        |  5 +++--
 .../cxf/transport/http/netty/server/util/Utils.java |  5 +++--
 .../http/netty/server/NettyHttpDestinationTest.java |  5 +++--
 .../https/httpclient/PublicSuffixMatcherLoader.java |  3 ++-
 .../apache/cxf/transport/jms/JMSMessageUtils.java   |  3 ++-
 .../apache/cxf/transport/jms/uri/JMSURIParser.java  |  3 ++-
 .../cxf/transport/jms/JMSMessageUtilTest.java       |  7 +++++--
 .../org/apache/cxf/ws/rm/CapturingXMLWriter.java    |  3 ++-
 .../cxf/ws/rm/soap/RetransmissionQueueImpl.java     |  3 ++-
 .../ws/security/wss4j/WSS4JStaxOutInterceptor.java  |  3 ++-
 .../org/apache/cxf/wsdl/JAXBExtensionHelper.java    |  3 ++-
 .../apache/cxf/wsdl11/ServiceWSDLBuilderTest.java   |  3 ++-
 .../cxf/ws/discovery/WSDiscoveryClientTest.java     |  5 +++--
 .../systest/jaxrs/JAXRSClientServerBookTest.java    |  3 ++-
 .../jaxrs/JAXRSClientServerProxySpringBookTest.java |  3 ++-
 ...ientServerResourceCreatedSpringProviderTest.java |  5 +++--
 .../jaxrs/JAXRSClientServerSpringBookTest.java      |  9 +++++----
 .../cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java |  3 ++-
 .../cxf/systest/handlers/SoapFaultHandlerTest.java  |  3 ++-
 .../cxf/systest/swa/SwANoMimeServiceImpl.java       | 14 +++-----------
 .../jaxrs/kerberos/JAXRSKerberosBookTest.java       |  3 ++-
 .../cxf/systest/kerberos/ldap/LDAPClaimsTest.java   |  3 ++-
 .../kerberos/wssec/kerberos/KerberosTokenTest.java  |  3 ++-
 .../kerberos/wssec/spnego/SpnegoTokenTest.java      |  3 ++-
 .../security/oauth/MemoryOAuthDataProvider.java     |  3 ++-
 .../apache/cxf/systest/servlet/CXFFilterTest.java   |  3 ++-
 .../apache/cxf/systest/servlet/CXFServletTest.java  |  3 ++-
 .../servlet/ExternalServicesServletTest.java        |  3 ++-
 .../cxf/systest/servlet/JsFrontEndServletTest.java  |  2 +-
 .../test/java/org/apache/cxf/systest/js/Server.java |  5 +++--
 .../org/apache/cxf/systest/mtom/MtomServerTest.java |  5 +++--
 .../org/apache/cxf/tools/util/FileWriterUtil.java   |  5 +++--
 .../apache/cxf/tools/util/URIParserUtilTest.java    |  5 +++--
 .../corba/processors/idl/IDLToWSDLProcessor.java    |  3 ++-
 .../org/apache/cxf/tools/corba/WSDLToIDLTest.java   |  7 ++++---
 .../generator/wsdl11/DateTypeCustomGenerator.java   |  3 ++-
 .../java2wsdl/generator/wsdl11/WSDL11Generator.java |  8 +++++---
 .../cxf/tools/wadlto/jaxrs/JAXRSContainer.java      |  3 ++-
 .../cxf/tools/wadlto/jaxrs/SourceGenerator.java     | 10 ++++++----
 .../cxf/tools/wsdlto/WSDLToJavaContainer.java       |  3 ++-
 .../wsdlto/javascript/WSDLToJavaScriptTest.java     |  5 +++--
 .../cxf/tools/wsdlto/jaxws/CodeGenBugTest.java      |  3 ++-
 139 files changed, 371 insertions(+), 306 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/BusFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/BusFactory.java b/core/src/main/java/org/apache/cxf/BusFactory.java
index 1019fcf..7f1dd01 100644
--- a/core/src/main/java/org/apache/cxf/BusFactory.java
+++ b/core/src/main/java/org/apache/cxf/BusFactory.java
@@ -22,6 +22,7 @@ package org.apache.cxf;
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.WeakHashMap;
@@ -378,7 +379,7 @@ public abstract class BusFactory {
             }
 
             if (is != null) {
-                try (BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8"))) {
+                try (BufferedReader rd = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
                     busFactoryClass = rd.readLine();
                     busFactoryCondition = rd.readLine();
                 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java b/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
index 539fcc6..d01f209 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
@@ -24,6 +24,7 @@ import java.io.OutputStream;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -144,7 +145,7 @@ public class AttachmentSerializer {
         out = message.getContent(OutputStream.class);
         encoding = (String) message.get(Message.ENCODING);
         if (encoding == null) {
-            encoding = "UTF-8";
+            encoding = StandardCharsets.UTF_8.name();
         }
         StringWriter writer = new StringWriter();
         writer.write("--");
@@ -200,7 +201,7 @@ public class AttachmentSerializer {
         if (attachmentId != null) {
             attachmentId = checkAngleBrackets(attachmentId);
             writer.write("Content-ID: <");
-            writer.write(URLDecoder.decode(attachmentId, "UTF-8"));
+            writer.write(URLDecoder.decode(attachmentId, StandardCharsets.UTF_8.name()));
             writer.write(">\r\n");
         }
         // headers like Content-Disposition need to be serialized

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
index 11ff76f..ec3407a 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
@@ -28,6 +28,7 @@ import java.net.URI;
 import java.net.URL;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.AbstractMap;
 import java.util.AbstractSet;
 import java.util.ArrayList;
@@ -209,7 +210,8 @@ public final class AttachmentUtil {
                 cid = ns;
             }
         }
-        return URLEncoder.encode(name, "UTF-8") + "@" + URLEncoder.encode(cid, "UTF-8");
+        return URLEncoder.encode(name, StandardCharsets.UTF_8.name()) + "@" 
+            + URLEncoder.encode(cid, StandardCharsets.UTF_8.name());
     }
 
     public static String getUniqueBoundaryValue() {
@@ -335,7 +337,7 @@ public final class AttachmentUtil {
             }
             // urldecode. Is this bad even without cid:? What does decode do with malformed %-signs, anyhow?
             try {
-                id = URLDecoder.decode(id, "UTF-8");
+                id = URLDecoder.decode(id, StandardCharsets.UTF_8.name());
             } catch (UnsupportedEncodingException e) {
                 //ignore, keep id as is
             }
@@ -526,7 +528,7 @@ public final class AttachmentUtil {
         // Is this right? - DD
         if (contentId.startsWith("cid:")) {
             try {
-                contentId = URLDecoder.decode(contentId.substring(4), "UTF-8");
+                contentId = URLDecoder.decode(contentId.substring(4), StandardCharsets.UTF_8.name());
             } catch (UnsupportedEncodingException ue) {
                 contentId = contentId.substring(4);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/attachment/Rfc5987Util.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/attachment/Rfc5987Util.java b/core/src/main/java/org/apache/cxf/attachment/Rfc5987Util.java
index 8da87f7..347e5d2 100644
--- a/core/src/main/java/org/apache/cxf/attachment/Rfc5987Util.java
+++ b/core/src/main/java/org/apache/cxf/attachment/Rfc5987Util.java
@@ -20,6 +20,7 @@ package org.apache.cxf.attachment;
 
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -38,7 +39,7 @@ public final class Rfc5987Util {
     }
 
     public static String encode(final String s) throws UnsupportedEncodingException {
-        return encode(s, "UTF-8");
+        return encode(s, StandardCharsets.UTF_8.name());
     }
 
     // http://stackoverflow.com/questions/11302361/ (continued next line)

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java b/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
index 3ee4f7c..f7804ee 100644
--- a/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
+++ b/core/src/main/java/org/apache/cxf/bus/extension/TextExtensionFragmentParser.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
@@ -71,7 +72,7 @@ public class TextExtensionFragmentParser {
      */
     public List<Extension> getExtensions(InputStream is) throws IOException {
         List<Extension> extensions = new ArrayList<Extension>();
-        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+        BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
         String line = reader.readLine();
         while (line != null) {
             final Extension extension = getExtensionFromTextLine(line);

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java b/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
index dc37c2c..36d951b 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
@@ -25,6 +25,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.security.AccessControlException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -156,7 +157,7 @@ public class BusApplicationContext extends ClassPathXmlApplicationContext {
                 Resource[] exts = resolver.getResources(DEFAULT_CXF_EXT_CFG_FILE);
                 for (Resource r : exts) {
                     try (InputStream is = r.getInputStream();
-                        BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8"))) {
+                        BufferedReader rd = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
                         String line = rd.readLine();
                         while (line != null) {
                             if (!"".equals(line)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java b/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
index 55bcd78..d6393d2 100644
--- a/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
+++ b/core/src/main/java/org/apache/cxf/common/jaxb/JAXBContextCache.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
@@ -403,7 +404,7 @@ public final class JAXBContextCache {
             //ignore
         }
         try (InputStream ins = loader.getResourceAsStream("/" + pkg.replace('.', '/') + "/jaxb.index");
-            BufferedReader reader = new BufferedReader(new InputStreamReader(ins, "UTF-8"))) {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(ins, StandardCharsets.UTF_8))) {
             if (!StringUtils.isEmpty(pkg)) {
                 pkg += ".";
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java b/core/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java
index f4e4b54..6440c37 100644
--- a/core/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/jaxb/JAXBUtils.java
@@ -37,6 +37,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -765,7 +766,7 @@ public final class JAXBUtils {
         return classes;
     }
     public static Object createFileCodeWriter(File f) throws JAXBException {
-        return createFileCodeWriter(f, "UTF-8");
+        return createFileCodeWriter(f, StandardCharsets.UTF_8.name());
     }
     public static Object createFileCodeWriter(File f, String encoding) throws JAXBException {
         try {
@@ -896,7 +897,7 @@ public final class JAXBUtils {
             if (entry.getValue() != null) {
                 BufferedReader reader = null;
                 try {
-                    reader = new BufferedReader(new InputStreamReader(entry.getValue(), "UTF-8"));
+                    reader = new BufferedReader(new InputStreamReader(entry.getValue(), StandardCharsets.UTF_8));
                     String pkg = entry.getKey();
                     ClassLoader loader = packageLoaders.get(pkg);
                     if (!StringUtils.isEmpty(pkg)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/common/util/Base64UrlUtility.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/Base64UrlUtility.java b/core/src/main/java/org/apache/cxf/common/util/Base64UrlUtility.java
index 25dc0df..cde9701 100644
--- a/core/src/main/java/org/apache/cxf/common/util/Base64UrlUtility.java
+++ b/core/src/main/java/org/apache/cxf/common/util/Base64UrlUtility.java
@@ -29,7 +29,7 @@ package org.apache.cxf.common.util;
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 
 public final class Base64UrlUtility {
@@ -42,11 +42,7 @@ public final class Base64UrlUtility {
     }
 
     public static String encode(String str) {
-        try {
-            return encode(str.getBytes("UTF-8"));
-        } catch (UnsupportedEncodingException ex) {
-            throw new RuntimeException(ex);
-        }
+        return encode(str.getBytes(StandardCharsets.UTF_8));
     }
     
     public static String encode(byte[] id) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java b/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java
index 1888d69..d101b39 100644
--- a/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java
+++ b/core/src/main/java/org/apache/cxf/common/util/Base64Utility.java
@@ -29,7 +29,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Writer;
 import java.nio.CharBuffer;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.logging.Logger;
 
@@ -85,8 +85,6 @@ public final class Base64Utility {
     private static final int PAD_SIZE4 = 2;
     private static final int PAD_SIZE8 = 3;
     
-    private static final Charset CHARSET_UTF8 = Charset.forName("UTF-8");
-    
     // class static initializer for building decode table
     static {
         for (int i = 0;  i < BDTSIZE;  i++) {
@@ -379,7 +377,7 @@ public final class Base64Utility {
 
     private static void writeCharArrayToStream(char[] chunk, int len, OutputStream os) throws IOException {
         // may be we can just cast to byte when creating chunk[] earlier on
-        byte[] bytes = CHARSET_UTF8.encode(CharBuffer.wrap(chunk, 0, len)).array();
+        byte[] bytes = StandardCharsets.UTF_8.encode(CharBuffer.wrap(chunk, 0, len)).array();
         os.write(bytes);
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/common/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/StringUtils.java b/core/src/main/java/org/apache/cxf/common/util/StringUtils.java
index 23e39e0..b90c078 100644
--- a/core/src/main/java/org/apache/cxf/common/util/StringUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/StringUtils.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -197,7 +198,7 @@ public final class StringUtils {
     }    
     
     public static byte[] toBytesUTF8(String str) {
-        return toBytes(str, "UTF-8");
+        return toBytes(str, StandardCharsets.UTF_8.name());
     }
     public static byte[] toBytesASCII(String str) {
         return toBytes(str, "US-ASCII");

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java b/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
index 8170709..9850ee5 100644
--- a/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
+++ b/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
@@ -20,11 +20,11 @@
 package org.apache.cxf.common.util;
 
 import java.io.File;
-import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.StringTokenizer;
@@ -222,15 +222,11 @@ public final class URIParserUtil {
         for (int x = 0; x < s.length(); x++) {
             char ch = s.charAt(x);
             if (isExcluded(ch)) {
-                try {
-                    byte[] bytes = Character.toString(ch).getBytes("UTF-8");
-                    for (int y = 0; y < bytes.length; y++) {
-                        b.append("%");
-                        b.append(HEX_DIGITS.charAt((bytes[y] & 0xFF) >> 4));
-                        b.append(HEX_DIGITS.charAt(bytes[y] & 0x0F));
-                    }
-                } catch (UnsupportedEncodingException e) {
-                    //should not happen
+                byte[] bytes = Character.toString(ch).getBytes(StandardCharsets.UTF_8);
+                for (int y = 0; y < bytes.length; y++) {
+                    b.append("%");
+                    b.append(HEX_DIGITS.charAt((bytes[y] & 0xFF) >> 4));
+                    b.append(HEX_DIGITS.charAt(bytes[y] & 0x0F));
                 }
             } else {
                 b.append(ch);

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java b/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java
index 8b2518e..3dd0087 100644
--- a/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/UrlUtils.java
@@ -23,6 +23,7 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.StringTokenizer;
@@ -43,7 +44,7 @@ public final class UrlUtils {
 
     public static String urlEncode(String value) {
         
-        return urlEncode(value, "UTF-8");
+        return urlEncode(value, StandardCharsets.UTF_8.name());
     }
     
     public static String urlEncode(String value, String enc) {
@@ -118,7 +119,7 @@ public final class UrlUtils {
 
     
     public static String urlDecode(String value) {
-        return urlDecode(value, "UTF-8");
+        return urlDecode(value, StandardCharsets.UTF_8.name());
     }
     
     /**
@@ -127,7 +128,7 @@ public final class UrlUtils {
      * @param value value to decode
      */
     public static String pathDecode(String value) {
-        return urlDecode(value, "UTF-8", true);
+        return urlDecode(value, StandardCharsets.UTF_8.name(), true);
     }
     
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java b/core/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
index 049691d..62dec05 100644
--- a/core/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
+++ b/core/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
@@ -108,7 +108,7 @@ public final class HttpHeaderHelper {
             return deflt;
         }
         //older versions of tomcat don't properly parse ContentType headers with stuff
-        //after charset="UTF-8"
+        //after charset=StandardCharsets.UTF_8
         int idx = enc.indexOf(";");
         if (idx != -1) {
             enc = enc.substring(0, idx);

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
index 0993e4b..0e3183b 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.interceptor;
 
 import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -178,7 +179,7 @@ public abstract class AbstractOutDatabindingInterceptor extends AbstractPhaseInt
         return info.getClass().getName().equals("org.apache.cxf.binding.soap.model.SoapBindingInfo") 
             && s.getDataBinding().getClass().getName().equals("org.apache.cxf.jaxb.JAXBDataBinding")
             && !MessageUtils.isDOMPresent(m)
-            && (enc == null || "UTF-8".equals(enc));
+            && (enc == null || StandardCharsets.UTF_8.name().equals(enc));
     }
     
     protected <T> DataWriter<T> getDataWriter(Message message, Service service, Class<T> output) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
index 9de2dac..8509036 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
@@ -21,6 +21,7 @@ package org.apache.cxf.interceptor;
 
 import java.io.OutputStream;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.ResourceBundle;
@@ -137,7 +138,7 @@ public class StaxOutInterceptor extends AbstractPhaseInterceptor<Message> {
         }
         
         if (encoding == null) {
-            encoding = "UTF-8";
+            encoding = StandardCharsets.UTF_8.name();
             message.put(Message.ENCODING, encoding);
         }
         return encoding;

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java b/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java
index 9464b51..e71adff 100644
--- a/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java
+++ b/core/src/main/java/org/apache/cxf/io/CachedOutputStream.java
@@ -31,6 +31,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.Reader;
+import java.nio.charset.StandardCharsets;
 import java.security.GeneralSecurityException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -310,7 +311,7 @@ public class CachedOutputStream extends OutputStream {
     }
     
     public void writeCacheTo(StringBuilder out, long limit) throws IOException {
-        writeCacheTo(out, "UTF-8", limit);
+        writeCacheTo(out, StandardCharsets.UTF_8.name(), limit);
     }
     
     public void writeCacheTo(StringBuilder out, String charsetName, long limit) throws IOException {
@@ -356,7 +357,7 @@ public class CachedOutputStream extends OutputStream {
     }
     
     public void writeCacheTo(StringBuilder out) throws IOException {
-        writeCacheTo(out, "UTF-8");
+        writeCacheTo(out, StandardCharsets.UTF_8.name());
     }
     
     public void writeCacheTo(StringBuilder out, String charsetName) throws IOException {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/io/CachedWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/io/CachedWriter.java b/core/src/main/java/org/apache/cxf/io/CachedWriter.java
index 8d33cdb..8fb3fdf 100644
--- a/core/src/main/java/org/apache/cxf/io/CachedWriter.java
+++ b/core/src/main/java/org/apache/cxf/io/CachedWriter.java
@@ -33,6 +33,7 @@ import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.security.GeneralSecurityException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -517,7 +518,7 @@ public class CachedWriter extends Writer {
                         }
                     };
                 }
-                return new InputStreamReader(fileInputStream, "UTF-8");
+                return new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
             } catch (FileNotFoundException e) {
                 throw new IOException("Cached file was deleted, " + e.toString());
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
index d7c2720..6b0eb42 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
@@ -28,6 +28,7 @@ import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -382,7 +383,7 @@ public final class StaxUtils {
 
     public static XMLStreamWriter createXMLStreamWriter(OutputStream out, String encoding) {
         if (encoding == null) {
-            encoding = "UTF-8";
+            encoding = StandardCharsets.UTF_8.name();
         }
         XMLOutputFactory factory = getXMLOutputFactory();
         try {
@@ -1695,7 +1696,7 @@ public final class StaxUtils {
      */
     public static XMLStreamReader createXMLStreamReader(InputStream in, String encoding) {
         if (encoding == null) {
-            encoding = "UTF-8";
+            encoding = StandardCharsets.UTF_8.name();
         }
 
         XMLInputFactory factory = getXMLInputFactory();

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java b/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
index 4014135..330ec9f 100644
--- a/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
+++ b/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
@@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PushbackInputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -84,7 +85,7 @@ public class AttachmentDeserializerTest extends Assert {
         Assert.assertTrue(m.find());
         
         msg = new MessageImpl();
-        msg.setContent(InputStream.class, new ByteArrayInputStream(message.getBytes("UTF-8")));
+        msg.setContent(InputStream.class, new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8)));
         msg.put(Message.CONTENT_TYPE, "multipart/related");
         AttachmentDeserializer ad = new AttachmentDeserializer(msg);
         ad.initializeAttachments();
@@ -427,7 +428,7 @@ public class AttachmentDeserializerTest extends Assert {
                 + "------=_Part_1"
                 + "\n\nContent-Transfer-Encoding: binary\n\n"
                 + "ABCD3\r\n"
-                + "------=_Part_1--").getBytes("UTF-8");
+                + "------=_Part_1--").getBytes(StandardCharsets.UTF_8);
         ByteArrayInputStream in = new ByteArrayInputStream(messageBytes) {
             public int read(byte[] b, int off, int len) {
                 return super.read(b, off, len >= 2 ? 2 : len); 

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/test/java/org/apache/cxf/attachment/Rfc5987UtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/attachment/Rfc5987UtilTest.java b/core/src/test/java/org/apache/cxf/attachment/Rfc5987UtilTest.java
index 17f04f05..e730909 100644
--- a/core/src/test/java/org/apache/cxf/attachment/Rfc5987UtilTest.java
+++ b/core/src/test/java/org/apache/cxf/attachment/Rfc5987UtilTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.attachment;
 
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -49,8 +50,8 @@ public class Rfc5987UtilTest {
 
     @Test
     public void test() throws Exception {
-        assertEquals(expected, Rfc5987Util.encode(input, "UTF-8"));
+        assertEquals(expected, Rfc5987Util.encode(input, StandardCharsets.UTF_8.name()));
 
-        assertEquals(input, Rfc5987Util.decode(expected, "UTF-8"));
+        assertEquals(input, Rfc5987Util.decode(expected, StandardCharsets.UTF_8.name()));
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java b/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java
index 213dcd0..a05ffaf 100644
--- a/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java
+++ b/core/src/test/java/org/apache/cxf/common/util/Base64UtilityTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.common.util;
 
 import java.io.ByteArrayOutputStream;
 import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.cxf.helpers.IOUtils;
 
@@ -43,7 +44,7 @@ public class Base64UtilityTest extends Assert {
     @Test
     public void testEncodeMultipleChunks() throws Exception {
         final String text = "The true sign of intelligence is not knowledge but imagination.";
-        byte[] bytes = text.getBytes("UTF-8");
+        byte[] bytes = text.getBytes(StandardCharsets.UTF_8);
         // multiple of 3 octets
         assertEquals(63, bytes.length);
         String s1 = new String(Base64Utility.encodeChunk(bytes, 0, bytes.length));
@@ -64,7 +65,7 @@ public class Base64UtilityTest extends Assert {
     public void testEncodeAndStream() throws Exception {
         final String text = "The true sign of intelligence is not knowledge but imagination.";
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        byte[] bytes = text.getBytes("UTF-8");
+        byte[] bytes = text.getBytes(StandardCharsets.UTF_8);
         Base64Utility.encodeAndStream(bytes, 0, bytes.length, bos);
         String decodedText = new String(Base64Utility.decode(bos.toString()));
         assertEquals(decodedText, text);

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java b/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
index 5a82792..9d69fe3 100755
--- a/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
+++ b/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -253,14 +254,14 @@ public abstract class CachedStreamTestBase extends Assert {
     protected static String readFromStream(InputStream is) throws IOException {
         try (ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
             IOUtils.copyAndCloseInput(is, buf);
-            return new String(buf.toByteArray(), "UTF-8");
+            return new String(buf.toByteArray(), StandardCharsets.UTF_8);
         }
     }
 
     protected static String readPartiallyFromStream(InputStream is, int len) throws IOException {
         try (ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
             IOUtils.copyAtLeast(is, buf, len);
-            return new String(buf.toByteArray(), "UTF-8");
+            return new String(buf.toByteArray(), StandardCharsets.UTF_8);
         }
     }
  

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java b/core/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java
index 564f0f5..181f9c4 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.staxutils.transform;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -51,7 +52,7 @@ public class OutTransformWriterTest extends Assert {
     @Test
     public void testDefaultNamespace() throws Exception {
         ByteArrayOutputStream os = new ByteArrayOutputStream();
-        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(os, "UTF-8");
+        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(os, StandardCharsets.UTF_8.name());
         
         Map<String, String> outMap = new HashMap<String, String>();
         outMap.put("{http://testbeans.com}*", "{http://testbeans.com/v2}*");
@@ -148,7 +149,7 @@ public class OutTransformWriterTest extends Assert {
 
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         XMLStreamWriter writer = 
-            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, "UTF-8"), 
+            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, StandardCharsets.UTF_8.name()), 
                                    null, Collections.singletonMap("{http://bar}a", "{http://bar}a=1 2 3"),
                                    null, null, false, null);
         StaxUtils.copy(new StreamSource(is), writer);
@@ -255,7 +256,7 @@ public class OutTransformWriterTest extends Assert {
         // writing each child separately (as the soap header children are serialized)
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         XMLStreamWriter writer =
-            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, "UTF-8"), 
+            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, StandardCharsets.UTF_8.name()), 
                                    map, null,
                                    null, null, false, null);
         boolean nsset = "ns3".equals(writer.getNamespaceContext().getPrefix("http://testbeans.com/double"));
@@ -520,7 +521,7 @@ public class OutTransformWriterTest extends Assert {
 
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         XMLStreamWriter writer = 
-            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, "UTF-8"), 
+            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, StandardCharsets.UTF_8.name()), 
                                    null, null, null, null, false, "");
         StaxUtils.copy(new StreamSource(is), writer);
         writer.flush();

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/core/src/test/java/org/apache/cxf/staxutils/transform/TransformTestUtils.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/transform/TransformTestUtils.java b/core/src/test/java/org/apache/cxf/staxutils/transform/TransformTestUtils.java
index 89b8cc5..df095bd 100755
--- a/core/src/test/java/org/apache/cxf/staxutils/transform/TransformTestUtils.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/transform/TransformTestUtils.java
@@ -21,6 +21,7 @@ package org.apache.cxf.staxutils.transform;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -111,7 +112,7 @@ public final class TransformTestUtils {
 
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         XMLStreamWriter writer = 
-            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, "UTF-8"), 
+            new OutTransformWriter(StaxUtils.createXMLStreamWriter(os, StandardCharsets.UTF_8.name()), 
                                    emap, append, dropEls, amap, attributesToElements, defaultNamespace);
         StaxUtils.copy(new StreamSource(TransformTestUtils.class.getResourceAsStream(file)), writer);
         writer.flush();

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/ApplicationController.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/ApplicationController.java b/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/ApplicationController.java
index a17264f..a6c72d3 100644
--- a/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/ApplicationController.java
+++ b/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/ApplicationController.java
@@ -68,7 +68,7 @@ public class ApplicationController implements ServletContextAware {
         String consumerKey = clientApp.getConsumerKey();
         if (StringUtils.isEmpty(consumerKey)) {
             consumerKey = tokenGen
-                .generate((principal.getName() + clientApp.getClientName()).getBytes("UTF-8"));
+                .generate((principal.getName() + clientApp.getClientName()).getBytes(StandardCharsets.UTF_8));
         }
 
         String secretKey = tokenGen.generate(new SecureRandom().generateSeed(20));

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java b/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
index e993cd7..37424a0 100644
--- a/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
+++ b/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
@@ -169,7 +169,7 @@ public class MemoryOAuthDataProvider implements OAuthDataProvider {
     protected String generateToken() throws OAuthServiceException {
         String token;
         try {
-            token = tokenGenerator.generate(UUID.randomUUID().toString().getBytes("UTF-8"));
+            token = tokenGenerator.generate(UUID.randomUUID().toString().getBytes(StandardCharsets.UTF_8));
         } catch (Exception e) {
             throw new OAuthServiceException("Unable to create token ", e.getCause());
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
index 8307f48..2ec2558 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
@@ -23,6 +23,7 @@ package org.apache.cxf.jaxb.io;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -130,7 +131,7 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
         try {
             
             marshaller = context.createMarshaller();
-            marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+            marshaller.setProperty(Marshaller.JAXB_ENCODING, StandardCharsets.UTF_8.name());
             marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
             marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
             marshaller.setListener(databinding.getMarshallerListener());

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
index aeb851d..d05d0d1 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.ext.logging;
 
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.util.StringUtils;
@@ -64,7 +65,7 @@ public class LoggingInInterceptor extends AbstractLoggingInterceptor {
     private void handleOutputStream(final LogEvent event, Message message, CachedOutputStream cos) throws IOException {
         String encoding = (String)message.get(Message.ENCODING);
         if (StringUtils.isEmpty(encoding)) {
-            encoding = "UTF-8";
+            encoding = StandardCharsets.UTF_8.name();
         }
         StringBuilder payload = new StringBuilder();
         cos.writeCacheTo(payload, encoding, limit);

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/SOAPLoggingTest.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/SOAPLoggingTest.java b/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/SOAPLoggingTest.java
index 80dbdec..2dbe150 100644
--- a/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/SOAPLoggingTest.java
+++ b/rt/features/logging/src/test/java/org/apache/cxf/ext/logging/SOAPLoggingTest.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.ext.logging;
 
 import java.net.MalformedURLException;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.List;
 
@@ -80,7 +81,7 @@ public class SOAPLoggingTest {
         Assert.assertEquals(SERVICE_URI, requestOut.getAddress());
         Assert.assertEquals("text/xml", requestOut.getContentType());
         Assert.assertEquals(EventType.REQ_OUT, requestOut.getType());
-        Assert.assertEquals("UTF-8", requestOut.getEncoding());
+        Assert.assertEquals(StandardCharsets.UTF_8.name(), requestOut.getEncoding());
         Assert.assertNotNull(requestOut.getExchangeId());
         Assert.assertEquals("POST", requestOut.getHttpMethod());
         Assert.assertNotNull(requestOut.getMessageId());
@@ -94,7 +95,7 @@ public class SOAPLoggingTest {
         Assert.assertEquals(SERVICE_URI, requestIn.getAddress());
         Assert.assertEquals("text/xml; charset=UTF-8", requestIn.getContentType());
         Assert.assertEquals(EventType.REQ_IN, requestIn.getType());
-        Assert.assertEquals("UTF-8", requestIn.getEncoding());
+        Assert.assertEquals(StandardCharsets.UTF_8.name(), requestIn.getEncoding());
         Assert.assertNotNull(requestIn.getExchangeId());
         Assert.assertEquals("POST", requestIn.getHttpMethod());
         Assert.assertNotNull(requestIn.getMessageId());
@@ -109,7 +110,7 @@ public class SOAPLoggingTest {
         Assert.assertNull(responseOut.getAddress());
         Assert.assertEquals("text/xml", responseOut.getContentType());
         Assert.assertEquals(EventType.RESP_OUT, responseOut.getType());
-        Assert.assertEquals("UTF-8", responseOut.getEncoding());
+        Assert.assertEquals(StandardCharsets.UTF_8.name(), responseOut.getEncoding());
         Assert.assertNotNull(responseOut.getExchangeId());
         
         // Not yet available
@@ -125,7 +126,7 @@ public class SOAPLoggingTest {
         Assert.assertNull(responseIn.getAddress());
         Assert.assertEquals("text/xml; charset=UTF-8", responseIn.getContentType());
         Assert.assertEquals(EventType.RESP_IN, responseIn.getType());
-        Assert.assertEquals("UTF-8", responseIn.getEncoding());
+        Assert.assertEquals(StandardCharsets.UTF_8.name(), responseIn.getEncoding());
         Assert.assertNotNull(responseIn.getExchangeId());
         
         // Not yet available

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
index f172737..12127b9 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java
@@ -26,6 +26,7 @@ import java.io.Reader;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.net.URI;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -406,7 +407,7 @@ public final class ResponseImpl extends Response {
         }
         if (stringEntity != null) {
             try {
-                return new ByteArrayInputStream(stringEntity.getBytes("UTF-8"));
+                return new ByteArrayInputStream(stringEntity.getBytes(StandardCharsets.UTF_8));
             } catch (Exception ex) {
                 throw new ProcessingException(ex);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
index 5cafd8c..634d07a 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
@@ -24,6 +24,7 @@ import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
@@ -394,7 +395,7 @@ public class JAXRSOutInterceptor extends AbstractOutDatabindingInterceptor {
         try {
             String errorMessage = JAXRSUtils.logMessageHandlerProblem(name, cls, ct);
             if (out != null) {
-                out.write(errorMessage.getBytes("UTF-8"));
+                out.write(errorMessage.getBytes(StandardCharsets.UTF_8));
             }
         } catch (IOException another) {
             // ignore
@@ -445,7 +446,7 @@ public class JAXRSOutInterceptor extends AbstractOutDatabindingInterceptor {
     
     private void writeResponseToStream(OutputStream os, Object responseObj) {
         try {
-            byte[] bytes = responseObj.toString().getBytes("UTF-8");
+            byte[] bytes = responseObj.toString().getBytes(StandardCharsets.UTF_8);
             os.write(bytes, 0, bytes.length);
         } catch (Exception ex) {
             LOG.severe("Problem with writing the data to the output stream");

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
index b0cd13a..980b076 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
@@ -33,6 +33,7 @@ import java.io.Reader;
 import java.io.Writer;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.security.DigestInputStream;
 import java.util.UUID;
 import java.util.logging.Logger;
@@ -177,7 +178,7 @@ public class BinaryDataProvider<T> extends AbstractConfigurableProvider
     
     private String getEncoding(MediaType mt) {
         String enc = mt.getParameters().get("charset");
-        return enc == null ? "UTF-8" : enc;
+        return enc == null ? StandardCharsets.UTF_8.name() : enc;
     }
     private String getCharset(MediaType mt) {
         return mt.getParameters().get("charset");

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
index 1a9532e..e5f5eed 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
@@ -23,6 +23,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Produces;
@@ -105,7 +106,7 @@ public class DataBindingProvider<T> implements MessageBodyReader<T>, MessageBody
         throws IOException {
         XMLStreamWriter writer = null;
         try {
-            String enc = HttpUtils.getSetEncoding(m, headers, "UTF-8");
+            String enc = HttpUtils.getSetEncoding(m, headers, StandardCharsets.UTF_8.name());
             writer = createWriter(clazz, genericType, enc, os);
             writeToWriter(writer, o);
         } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
index 1968763..3f78efe 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Encoded;
@@ -168,7 +169,7 @@ public class FormEncodingProvider<T> extends AbstractConfigurableProvider
             FormUtils.populateMapFromMultipart(params, body, PhaseInterceptorChain.getCurrentMessage(), 
                                                decode);
         } else {
-            String enc = HttpUtils.getEncoding(mt, "UTF-8");
+            String enc = HttpUtils.getEncoding(mt, StandardCharsets.UTF_8.name());
             
             Object servletRequest = mc != null ? mc.getHttpServletRequest() : null;
             if (servletRequest == null) {
@@ -222,7 +223,7 @@ public class FormEncodingProvider<T> extends AbstractConfigurableProvider
             (MultivaluedMap<String, String>)(obj instanceof Form ? ((Form)obj).asMap() : obj);
         boolean encoded = keepEncoded(anns);
         
-        String enc = HttpUtils.getSetEncoding(mt, headers, "UTF-8");
+        String enc = HttpUtils.getSetEncoding(mt, headers, StandardCharsets.UTF_8.name());
         
         FormUtils.writeMapToOutputStream(map, os, enc, encoded);
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
index 4c61df9..8f834b5 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
@@ -26,6 +26,7 @@ import java.io.Reader;
 import java.io.Writer;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -360,7 +361,7 @@ public class JAXBElementProvider<T> extends AbstractJAXBProvider<T>  {
         }
         
         StringBuilder pi = new StringBuilder();
-        pi.append(XML_PI_START + (enc == null ? "UTF-8" : enc) + "\"?>");
+        pi.append(XML_PI_START + (enc == null ? StandardCharsets.UTF_8.name() : enc) + "\"?>");
         os.write(pi.toString().getBytes());
         String startTag = null;
         String endTag = null;

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
index 31721b0..a585afe 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
@@ -23,6 +23,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Produces;
@@ -53,7 +54,7 @@ public class PrimitiveTextProvider<T> extends AbstractConfigurableProvider
 
     public T readFrom(Class<T> type, Type genType, Annotation[] anns, MediaType mt, 
                       MultivaluedMap<String, String> headers, InputStream is) throws IOException {
-        String string = IOUtils.toString(is, HttpUtils.getEncoding(mt, "UTF-8"));
+        String string = IOUtils.toString(is, HttpUtils.getEncoding(mt, StandardCharsets.UTF_8.name()));
         if (StringUtils.isEmpty(string)) {
             reportEmptyContentLength();
         }
@@ -82,7 +83,7 @@ public class PrimitiveTextProvider<T> extends AbstractConfigurableProvider
     public void writeTo(T obj, Class<?> type, Type genType, Annotation[] anns, 
                         MediaType mt, MultivaluedMap<String, Object> headers,
                         OutputStream os) throws IOException {
-        String encoding = HttpUtils.getSetEncoding(mt, headers, "UTF-8");
+        String encoding = HttpUtils.getSetEncoding(mt, headers, StandardCharsets.UTF_8.name());
         byte[] bytes = obj.toString().getBytes(encoding);
         os.write(bytes);
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
index 654a9ff..52bf495 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.logging.Logger;
 
 import javax.ws.rs.Consumes;
@@ -186,7 +187,7 @@ public class SourceProvider<T> extends AbstractConfigurableProvider implements
         MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
         throws IOException {
         
-        String encoding = HttpUtils.getSetEncoding(mt, headers, "UTF-8");
+        String encoding = HttpUtils.getSetEncoding(mt, headers, StandardCharsets.UTF_8.name());
         
         XMLStreamReader reader = 
             source instanceof Source ? StaxUtils.createXMLStreamReader((Source)source) 

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/StringTextProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/StringTextProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/StringTextProvider.java
index e6e25da..6d26a99 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/StringTextProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/StringTextProvider.java
@@ -23,6 +23,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -41,7 +42,7 @@ public class StringTextProvider extends AbstractConfigurableProvider
 
     public String readFrom(Class<String> type, Type genType, Annotation[] anns, MediaType mt, 
                       MultivaluedMap<String, String> headers, InputStream is) throws IOException {
-        return IOUtils.toString(is, HttpUtils.getEncoding(mt, "UTF-8"));
+        return IOUtils.toString(is, HttpUtils.getEncoding(mt, StandardCharsets.UTF_8.name()));
     }
 
     public long getSize(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
@@ -55,7 +56,7 @@ public class StringTextProvider extends AbstractConfigurableProvider
     public void writeTo(String obj, Class<?> type, Type genType, Annotation[] anns, 
                         MediaType mt, MultivaluedMap<String, Object> headers,
                         OutputStream os) throws IOException {
-        String encoding = HttpUtils.getSetEncoding(mt, headers, "UTF-8");
+        String encoding = HttpUtils.getSetEncoding(mt, headers, StandardCharsets.UTF_8.name());
         //REVISIT try to avoid instantiating the whole byte array
         byte[] bytes = obj.getBytes(encoding);
         if (bytes.length > bufferSize) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
index bd33ad2..dd92978 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
@@ -26,6 +26,7 @@ import java.io.Reader;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -515,7 +516,7 @@ public class XSLTJaxbProvider<T> extends JAXBElementProvider<T> {
             }
             
             Reader r = new BufferedReader(
-                           new InputStreamReader(urlStream.openStream(), "UTF-8"));
+                           new InputStreamReader(urlStream.openStream(), StandardCharsets.UTF_8));
             Source source = new StreamSource(r);
             source.setSystemId(urlStream.toExternalForm());
             if (factory == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
index e91e60a..666fa28 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Iterator;
@@ -63,10 +64,9 @@ public final class FormUtils {
     }
     
     public static String formToString(Form form) {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        try {
-            FormUtils.writeMapToOutputStream(form.asMap(), bos, "UTF-8", false);
-            return bos.toString("UTF-8");
+        try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
+            FormUtils.writeMapToOutputStream(form.asMap(), bos, StandardCharsets.UTF_8.name(), false);
+            return bos.toString(StandardCharsets.UTF_8.name());
         } catch (Exception ex) {
             // will not happen
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
index 61664b4..e945943 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
@@ -22,6 +22,7 @@ package org.apache.cxf.jaxrs.utils;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -132,7 +133,7 @@ public final class HttpUtils {
     
     public static String urlEncode(String value) {
         
-        return urlEncode(value, "UTF-8");
+        return urlEncode(value, StandardCharsets.UTF_8.name());
     }
     
     public static String urlEncode(String value, String enc) {
@@ -558,7 +559,7 @@ public final class HttpUtils {
             headers.putSingle(HttpHeaders.CONTENT_TYPE, 
                 JAXRSUtils.mediaTypeToString(mt, CHARSET_PARAMETER) 
                 + ';' + CHARSET_PARAMETER + "=" 
-                + (defaultEncoding == null ? "UTF-8" : defaultEncoding));
+                + (defaultEncoding == null ? StandardCharsets.UTF_8 : defaultEncoding));
         }
         return defaultEncoding;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index ab2a55c..26120ec 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -27,6 +27,7 @@ import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -945,7 +946,7 @@ public final class JAXRSUtils {
             m.put(FormUtils.FORM_PARAM_MAP, params);
         
             if (mt == null || mt.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) {
-                String enc = HttpUtils.getEncoding(mt, "UTF-8");
+                String enc = HttpUtils.getEncoding(mt, StandardCharsets.UTF_8.name());
                 String body = FormUtils.readBody(m.getContent(InputStream.class), enc);
                 HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
                 FormUtils.populateMapFromString(params, m, body, enc, decode, request);

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
index 4bbbea1..dc370ea 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
@@ -28,6 +28,7 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -542,7 +543,7 @@ public final class ResourceUtils {
     }
     
     public static List<UserResource> getUserResources(InputStream is) throws Exception {
-        Document doc = StaxUtils.read(new InputStreamReader(is, "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(is, StandardCharsets.UTF_8));
         return getResourcesFromElement(doc.getDocumentElement());
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
index f085535..5a97297 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/schemas/SchemaHandler.java
@@ -25,6 +25,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
@@ -101,7 +102,7 @@ public class SchemaHandler {
                 }
                 for (URL schemaURL : schemaURLs) {
                     Reader r = new BufferedReader(
-                                   new InputStreamReader(schemaURL.openStream(), "UTF-8"));
+                                   new InputStreamReader(schemaURL.openStream(), StandardCharsets.UTF_8));
                     StreamSource source = new StreamSource(r);
                     source.setSystemId(schemaURL.toString());
                     sources.add(source);

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java
index c38dbc7..0690e9d 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.jaxrs.impl;
 
+import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -66,9 +67,9 @@ public class RequestImplTest extends Assert {
         metadata.putSingle(HttpHeaders.CONTENT_LANGUAGE, "en");
         metadata.putSingle(HttpHeaders.CONTENT_ENCODING, "utf-8");
         
-        assertSameVariant(MediaType.APPLICATION_XML_TYPE, new Locale("en"), "UTF-8");
-        assertSameVariant(null, new Locale("en"), "UTF-8");
-        assertSameVariant(MediaType.APPLICATION_XML_TYPE, null, "UTF-8");
+        assertSameVariant(MediaType.APPLICATION_XML_TYPE, new Locale("en"), StandardCharsets.UTF_8.name());
+        assertSameVariant(null, new Locale("en"), StandardCharsets.UTF_8.name());
+        assertSameVariant(MediaType.APPLICATION_XML_TYPE, null, StandardCharsets.UTF_8.name());
         assertSameVariant(MediaType.APPLICATION_XML_TYPE, new Locale("en"), null);
         
     }
@@ -77,9 +78,9 @@ public class RequestImplTest extends Assert {
     public void testSingleMatchingVariantWithContentTypeOnly() {
         metadata.putSingle(HttpHeaders.CONTENT_TYPE, "application/xml");
         
-        assertSameVariant(MediaType.APPLICATION_XML_TYPE, new Locale("en"), "UTF-8");
-        assertSameVariant(null, new Locale("en"), "UTF-8");
-        assertSameVariant(MediaType.APPLICATION_XML_TYPE, null, "UTF-8");
+        assertSameVariant(MediaType.APPLICATION_XML_TYPE, new Locale("en"), StandardCharsets.UTF_8.name());
+        assertSameVariant(null, new Locale("en"), StandardCharsets.UTF_8.name());
+        assertSameVariant(MediaType.APPLICATION_XML_TYPE, null, StandardCharsets.UTF_8.name());
         assertSameVariant(MediaType.APPLICATION_XML_TYPE, new Locale("en"), null);
         
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
index 57bba2c..3409090 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
@@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 import javax.ws.rs.Consumes;
@@ -279,7 +280,7 @@ public class FormEncodingProviderTest extends Assert {
             (MultivaluedMap<String, String>)ferp.readFrom(MultivaluedMap.class, null,
                 new Annotation[]{}, 
                 MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED + ";charset=UTF-8"), null, 
-                new ByteArrayInputStream(s.getBytes("UTF-8")));
+                new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)));
         String value = mvMap.getFirst("name");
         assertEquals(s, "name=" + value);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
index df4e9f3..b3b1350 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
@@ -28,6 +28,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -130,7 +131,7 @@ public class JAXBElementProviderTest extends Assert {
         Book book = p.readFrom(Book.class, null,
                 new Annotation[]{}, 
                 MediaType.valueOf(MediaType.APPLICATION_XML + ";charset=UTF-8"), null, 
-                new ByteArrayInputStream(bookStringUTF16.getBytes("UTF-8")));
+                new ByteArrayInputStream(bookStringUTF16.getBytes(StandardCharsets.UTF_8)));
         assertEquals(book.getName(), nameStringUTF16);
     }
     
@@ -705,7 +706,7 @@ public class JAXBElementProviderTest extends Assert {
         JAXBElementProvider<JAXBElement> provider = new JAXBElementProvider<JAXBElement>();
         JAXBElement<Book> jaxbElement = provider.readFrom(JAXBElement.class, Book.class,
              new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, String>(),
-             new ByteArrayInputStream(xml.getBytes("UTF-8")));
+             new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
         Book book = jaxbElement.getValue();
         assertEquals(123L, book.getId());
         assertEquals("CXF in Action", book.getName());
@@ -719,7 +720,7 @@ public class JAXBElementProviderTest extends Assert {
         JAXBElementProvider<ParamJAXBElement> provider = new JAXBElementProvider<ParamJAXBElement>();
         ParamJAXBElement jaxbElement = provider.readFrom(ParamJAXBElement.class, ParamJAXBElement.class,
              new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, String>(),
-             new ByteArrayInputStream(xml.getBytes("UTF-8")));
+             new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
         ParamType param = jaxbElement.getValue();
         assertEquals("a", param.getComment());
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
index 95fb77f..0f500c1 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
@@ -22,6 +22,7 @@ package org.apache.cxf.jaxrs.provider;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.lang.annotation.Annotation;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 
 import javax.ws.rs.core.MediaType;
@@ -206,7 +207,7 @@ public class PrimitiveTextProviderTest extends Assert {
         String value = (String)p.readFrom(String.class, null,
                 new Annotation[]{}, 
                 MediaType.valueOf(MediaType.APPLICATION_XML + ";charset=UTF-8"), null, 
-                new ByteArrayInputStream(s.getBytes("UTF-8")));
+                new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)));
         assertEquals(value, value);
     }    
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/173ec897/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/FormUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/FormUtilsTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/FormUtilsTest.java
index ac90b1e..ad78c24 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/FormUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/FormUtilsTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.jaxrs.utils;
 
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -54,7 +55,8 @@ public class FormUtilsTest extends Assert {
         EasyMock.replay(mockMessage, mockRequest);
 
         MultivaluedMap<String, String> params = new MetadataMap<String, String>();
-        FormUtils.populateMapFromString(params, mockMessage, null, "UTF-8", false, mockRequest);
+        FormUtils.populateMapFromString(params, mockMessage, null, StandardCharsets.UTF_8.name(), 
+                                        false, mockRequest);
         
         assertEquals(2, params.size());
         assertEquals(HTTP_PARAM_VALUE1, params.get(HTTP_PARAM1).iterator().next());
@@ -66,7 +68,8 @@ public class FormUtilsTest extends Assert {
         EasyMock.replay(mockMessage, mockRequest);
 
         MultivaluedMap<String, String> params = new MetadataMap<String, String>();
-        FormUtils.populateMapFromString(params, mockMessage, null, "UTF-8", false, mockRequest);
+        FormUtils.populateMapFromString(params, mockMessage, null, StandardCharsets.UTF_8.name(), 
+                                        false, mockRequest);
         
         assertEquals(0, params.size());
     }
@@ -78,7 +81,8 @@ public class FormUtilsTest extends Assert {
 
         MultivaluedMap<String, String> params = new MetadataMap<String, String>();
         String postBody = FORM_PARAM1 + "=" + FORM_PARAM_VALUE1 + "&" + FORM_PARAM2 + "=" + FORM_PARAM_VALUE2;
-        FormUtils.populateMapFromString(params, mockMessage, postBody, "UTF-8", false, mockRequest);
+        FormUtils.populateMapFromString(params, mockMessage, postBody, StandardCharsets.UTF_8.name(), 
+                                        false, mockRequest);
         
         assertEquals(2, params.size());
         assertEquals(FORM_PARAM_VALUE1, params.get(FORM_PARAM1).iterator().next());


Mime
View raw message