cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/3] cxf git commit: Switch to use StandardCharset.UTF_8 instead of string literal
Date Tue, 10 Nov 2015 17:20:18 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 772ca96b6 -> f8df21ed3


http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
index f5e6e9c..0c61622 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -277,7 +278,7 @@ final class JMSMessageUtils {
             }
         }
 
-        String normalizedEncoding = HttpHeaderHelper.mapCharset(enc, "UTF-8");
+        String normalizedEncoding = HttpHeaderHelper.mapCharset(enc, StandardCharsets.UTF_8.name());
         if (normalizedEncoding == null) {
             String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, new Object[] {
                 enc

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
index abcbec3..1b48e4d 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
@@ -20,6 +20,7 @@ package org.apache.cxf.transport.jms.uri;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.logging.Level;
@@ -94,7 +95,7 @@ final class JMSURIParser {
     
     private static String urldecode(String s) {
         try {
-            return URLDecoder.decode(s, "UTF-8");
+            return URLDecoder.decode(s, StandardCharsets.UTF_8.name());
         } catch (UnsupportedEncodingException e) {
             throw new IllegalArgumentException("Encoding UTF-8 not supported");
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSMessageUtilTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSMessageUtilTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSMessageUtilTest.java
index ec3e128..ab54e22 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSMessageUtilTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSMessageUtilTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.transport.jms;
 
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -29,8 +30,10 @@ public class JMSMessageUtilTest extends Assert {
     
     @Test
     public void testGetEncoding() throws IOException {                
-        assertEquals("Get the wrong encoding", JMSMessageUtils.getEncoding("text/xml; charset=utf-8"), "UTF-8");
-        assertEquals("Get the wrong encoding", JMSMessageUtils.getEncoding("text/xml"), "UTF-8");
+        assertEquals("Get the wrong encoding", JMSMessageUtils.getEncoding("text/xml; charset=utf-8"), 
+                     StandardCharsets.UTF_8.name());
+        assertEquals("Get the wrong encoding", JMSMessageUtils.getEncoding("text/xml"), 
+                     StandardCharsets.UTF_8.name());
         assertEquals("Get the wrong encoding", JMSMessageUtils.getEncoding("text/xml; charset=GBK"), "GBK");
         try {
             JMSMessageUtils.getEncoding("text/xml; charset=asci");

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/CapturingXMLWriter.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/CapturingXMLWriter.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/CapturingXMLWriter.java
index 6d49252..1fe31fb 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/CapturingXMLWriter.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/CapturingXMLWriter.java
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.ws.rm;
 
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -39,7 +40,7 @@ public class CapturingXMLWriter implements XMLStreamWriter {
 
     public CapturingXMLWriter(XMLStreamWriter del) {
         delegate = del;
-        capture = StaxUtils.createXMLStreamWriter(bos, "UTF-8");
+        capture = StaxUtils.createXMLStreamWriter(bos, StandardCharsets.UTF_8.name());
         
         Map<String, String> map = new HashMap<String, String>();
         map.put("{http://schemas.xmlsoap.org/ws/2005/02/rm}Sequence", "");

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
index d4698c8..223430e 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.ws.rm.soap;
 
 import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
@@ -761,7 +762,7 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
             // read SOAP headers from saved input stream
             RewindableInputStream is = (RewindableInputStream)message.get(RMMessageConstants.SAVED_CONTENT);
             is.rewind();
-            XMLStreamReader reader = StaxUtils.createXMLStreamReader(is, "UTF-8");
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader(is, StandardCharsets.UTF_8.name());
             message.getHeaders().clear();
             if (reader.getEventType() != XMLStreamConstants.START_ELEMENT
                 && reader.nextTag() != XMLStreamConstants.START_ELEMENT) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
index 3ba1f66..1026624 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JStaxOutInterceptor.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.ws.security.wss4j;
 
 import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.security.Provider;
 import java.util.LinkedList;
 import java.util.List;
@@ -298,7 +299,7 @@ public class WSS4JStaxOutInterceptor extends AbstractWSS4JStaxInterceptor {
         }
 
         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/f8df21ed/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
index f5bae66..9b77c26 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
@@ -21,6 +21,7 @@ package org.apache.cxf.wsdl;
 
 import java.io.PrintWriter;
 import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -288,7 +289,7 @@ public class JAXBExtensionHelper implements ExtensionSerializer, ExtensionDeseri
         // TODO Auto-generated method stub
         try {
             Marshaller u = createMarshaller();
-            u.setProperty("jaxb.encoding", "UTF-8");
+            u.setProperty("jaxb.encoding", StandardCharsets.UTF_8.name());
             u.setProperty("jaxb.fragment", Boolean.TRUE);
             u.setProperty("jaxb.formatted.output", Boolean.TRUE);
             

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/rt/wsdl/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java b/rt/wsdl/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
index 9e102fb..6e2b3e4 100644
--- a/rt/wsdl/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
+++ b/rt/wsdl/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.wsdl11;
 
 import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -359,7 +360,7 @@ public class ServiceWSDLBuilderTest extends Assert {
         writer.close();
 
         // this is a test to make sure any embedded namespaces are properly included
-        String savedSchema = new String(outputStream.toByteArray(), "UTF-8");
+        String savedSchema = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);
         assertTrue(savedSchema.contains("http://www.w3.org/2005/05/xmlmime"));
         
         SchemaImport types2SchemaImport = getImport(typesSchema.getImports(),

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
----------------------------------------------------------------------
diff --git a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
index e7f7bba..f44217d 100644
--- a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
+++ b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
@@ -26,6 +26,7 @@ import java.net.InterfaceAddress;
 import java.net.MulticastSocket;
 import java.net.NetworkInterface;
 import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
@@ -116,7 +117,7 @@ public final class WSDiscoveryClientTest {
                     DatagramPacket p = new DatagramPacket(bytes, bytes.length, address, Integer.parseInt(PORT));
                     s.receive(p);
                     SocketAddress sa = p.getSocketAddress();
-                    String incoming = new String(p.getData(), 0, p.getLength(), "UTF-8");
+                    String incoming = new String(p.getData(), 0, p.getLength(), StandardCharsets.UTF_8);
                     int idx = incoming.indexOf("MessageID");
                     idx = incoming.indexOf('>', idx);
                     incoming = incoming.substring(idx + 1);
@@ -127,7 +128,7 @@ public final class WSDiscoveryClientTest {
                         String msg = IOUtils.readStringFromStream(ins);
                         msg = msg.replace("urn:uuid:883d0d53-92aa-4066-9b6f-9eadb1832366",
                                           incoming);
-                        byte out[] = msg.getBytes("UTF-8");
+                        byte out[] = msg.getBytes(StandardCharsets.UTF_8);
                         DatagramPacket outp = new DatagramPacket(out, 0, out.length, sa);
                         s.send(outp);
                     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
index 33ea415..429cf0e 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
@@ -26,6 +26,7 @@ import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -548,7 +549,7 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase {
         // not disallowed in the path components 
         String endpointAddressUrlEncoded =
             "http://localhost:" + PORT + "/bookstore/books/colon/" 
-            + URLEncoder.encode("1:2:3", "UTF-8");
+            + URLEncoder.encode("1:2:3", StandardCharsets.UTF_8.name());
         
         Response r = WebClient.create(endpointAddressUrlEncoded).get();
         assertEquals(404, r.getStatus());

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
index a2d1052..60200f0 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
@@ -24,6 +24,7 @@ import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.List;
 
@@ -59,7 +60,7 @@ public class JAXRSClientServerProxySpringBookTest extends AbstractBusClientServe
     public void testGetWadlResourcesInfo() throws Exception {
         WebClient client = WebClient.create("http://localhost:" + PORT + "/test" + "?_wadl&_type=xml");
         WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(10000000);
-        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), StandardCharsets.UTF_8));
         Element root = doc.getDocumentElement();
         assertEquals(WadlGenerator.WADL_NS, root.getNamespaceURI());
         assertEquals("application", root.getLocalName());

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
index ff99951..f9dab3c 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
@@ -28,6 +28,7 @@ import java.net.HttpURLConnection;
 import java.net.Socket;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -151,7 +152,7 @@ public class JAXRSClientServerResourceCreatedSpringProviderTest extends Abstract
     public void testWadlPublishedEndpointUrl() throws Exception {
         String requestURI = "http://localhost:" + PORT + "/webapp/resources2";
         WebClient client = WebClient.create(requestURI + "?_wadl&_type=xml");
-        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), StandardCharsets.UTF_8));
         Element root = doc.getDocumentElement();
         assertEquals(WadlGenerator.WADL_NS, root.getNamespaceURI());
         assertEquals("application", root.getLocalName());
@@ -179,7 +180,7 @@ public class JAXRSClientServerResourceCreatedSpringProviderTest extends Abstract
     private List<Element> getWadlResourcesInfo(String baseURI, String requestURI, int size) throws Exception {
         WebClient client = WebClient.create(requestURI + "?_wadl&_type=xml");
         WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(10000000);
-        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), StandardCharsets.UTF_8));
         Element root = doc.getDocumentElement();
         assertEquals(WadlGenerator.WADL_NS, root.getNamespaceURI());
         assertEquals("application", root.getLocalName());

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
index 5ad1242..7a1d546 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
@@ -26,6 +26,7 @@ import java.io.InputStreamReader;
 import java.net.Socket;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -140,7 +141,7 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
     public void testGetWadlFromWadlLocation() throws Exception {
         String address = "http://localhost:" + PORT + "/the/generated";    
         WebClient client = WebClient.create(address + "/bookstore" + "?_wadl&_type=xml");
-        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), StandardCharsets.UTF_8));
         List<Element> resources = checkWadlResourcesInfo(doc, address, "/schemas/book.xsd", 2);
         assertEquals("", resources.get(0).getAttribute("type"));
         String type = resources.get(1).getAttribute("type");
@@ -258,7 +259,7 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
                               String refAttrName) throws Exception {
         WebClient client = WebClient.create(address + schemaSegment);
         WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(10000000L);
-        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), StandardCharsets.UTF_8));
         Element root = doc.getDocumentElement();
         assertEquals(Constants.URI_2001_SCHEMA_XSD, root.getNamespaceURI());
         assertEquals("schema", root.getLocalName());
@@ -277,7 +278,7 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
         WebClient client = WebClient.create(requestTypeURI);
         WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(1000000);
         
-        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), StandardCharsets.UTF_8));
         Element root = doc.getDocumentElement();
         assertEquals(WadlGenerator.WADL_NS, root.getNamespaceURI());
         assertEquals("application", root.getLocalName());
@@ -300,7 +301,7 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
     private List<Element> checkWadlResourcesInfo(String baseURI, String requestURI, 
                                         String schemaRef, int size) throws Exception {
         WebClient client = WebClient.create(requestURI + "?_wadl&_type=xml");
-        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), "UTF-8"));
+        Document doc = StaxUtils.read(new InputStreamReader(client.get(InputStream.class), StandardCharsets.UTF_8));
         return checkWadlResourcesInfo(doc, baseURI, schemaRef, size);
     }
     private List<Element> checkWadlResourcesInfo(Document doc, String baseURI, String schemaRef, int size) 

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
index 97fd389..0ea788a 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
@@ -20,6 +20,7 @@ package org.apache.cxf.systest.jaxrs;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -87,7 +88,7 @@ public class JAXRSLoggingAtomPushTest extends Assert {
         String s = IOUtils.readStringFromStream(ins);
         ins.close();
         s = s.replaceAll("9080", PORT);
-        lm.readConfiguration(new ByteArrayInputStream(s.getBytes("UTF-8")));
+        lm.readConfiguration(new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)));
         
         for (Handler h : LOG.getHandlers()) {
             LOG.removeHandler(h);

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SoapFaultHandlerTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SoapFaultHandlerTest.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SoapFaultHandlerTest.java
index d5c4992..e6829ed 100644
--- a/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SoapFaultHandlerTest.java
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/SoapFaultHandlerTest.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.test.AbstractCXFSpringTest;
@@ -59,7 +60,7 @@ public class SoapFaultHandlerTest extends AbstractCXFSpringTest {
         out.close();
         InputStream response = getInputStream(connection);
         // get the response fault message
-        String result = IOUtils.toString(response, "UTF-8");
+        String result = IOUtils.toString(response, StandardCharsets.UTF_8.name());
         // just make sure the custom namespace is working
         assertTrue("The custom namespace is not working.", result.indexOf("cxf:Provider") > 0);
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/SwANoMimeServiceImpl.java
----------------------------------------------------------------------
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/SwANoMimeServiceImpl.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/SwANoMimeServiceImpl.java
index 00bff25..8fa7b87 100644
--- a/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/SwANoMimeServiceImpl.java
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/swa/SwANoMimeServiceImpl.java
@@ -20,6 +20,7 @@ package org.apache.cxf.systest.swa;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 
 import javax.activation.DataHandler;
 import javax.jws.WebService;
@@ -95,12 +96,7 @@ public class SwANoMimeServiceImpl implements SwAServiceInterface {
     }
 
     public void echoData(Holder<String> text, Holder<byte[]> data) {
-        try {
-            data.value = ("test" + new String(data.value, 0, 6)).getBytes("UTF-8"); 
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        
+        data.value = ("test" + new String(data.value, 0, 6)).getBytes(StandardCharsets.UTF_8); 
     }
 
     public void echoDataRef(Holder<DataStruct> data) {
@@ -120,11 +116,7 @@ public class SwANoMimeServiceImpl implements SwAServiceInterface {
     }
 
     public void echoDataWithHeader(Holder<String> text, Holder<byte[]> data, Holder<String> headerText) {
-        try {
-            data.value = ("test" + new String(data.value, 0, 6)).getBytes("UTF-8"); 
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+        data.value = ("test" + new String(data.value, 0, 6)).getBytes(StandardCharsets.UTF_8); 
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java
index 4087fcc..3f0c79f 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/jaxrs/kerberos/JAXRSKerberosBookTest.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.systest.kerberos.jaxrs.kerberos;
 
 import java.io.File;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -105,7 +106,7 @@ public class JAXRSKerberosBookTest extends AbstractLdapTestUnit {
 
             // Read in krb5.conf and substitute in the correct port
             Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/krb5.conf");
-            String content = new String(Files.readAllBytes(path), "UTF-8");
+            String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
             content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
             
             Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/jaxrs.krb5.conf");

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/ldap/LDAPClaimsTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/ldap/LDAPClaimsTest.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/ldap/LDAPClaimsTest.java
index bdd2f80..6d2045e 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/ldap/LDAPClaimsTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/ldap/LDAPClaimsTest.java
@@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.InputStream;
 import java.net.URI;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -113,7 +114,7 @@ public class LDAPClaimsTest extends AbstractLdapTestUnit {
             
             // Read in ldap.xml and substitute in the correct port
             Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/ldap.xml");
-            String content = new String(Files.readAllBytes(path), "UTF-8");
+            String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
             content = content.replaceAll("portno", "" + super.getLdapServer().getPort());
             
             Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/ldapport.xml");

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
index 648dc73..be57236 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/kerberos/KerberosTokenTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.systest.kerberos.wssec.kerberos;
 
 import java.io.File;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -118,7 +119,7 @@ public class KerberosTokenTest extends AbstractLdapTestUnit {
             
             // Read in krb5.conf and substitute in the correct port
             Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/krb5.conf");
-            String content = new String(Files.readAllBytes(path), "UTF-8");
+            String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
             content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
             
             Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/wssec.kerberos.krb5.conf");

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
index a7948bc..619e16a 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/systest/kerberos/wssec/spnego/SpnegoTokenTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.systest.kerberos.wssec.spnego;
 
 import java.io.File;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -111,7 +112,7 @@ public class SpnegoTokenTest extends AbstractLdapTestUnit {
             
             // Read in krb5.conf and substitute in the correct port
             Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/krb5.conf");
-            String content = new String(Files.readAllBytes(path), "UTF-8");
+            String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
             content = content.replaceAll("port", "" + super.getKdcServer().getTransports()[0].getPort());
             
             Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/wssec.spnego.krb5.conf");

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/MemoryOAuthDataProvider.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/MemoryOAuthDataProvider.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/MemoryOAuthDataProvider.java
index a330adf..799c379 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/MemoryOAuthDataProvider.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/MemoryOAuthDataProvider.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.systest.jaxrs.security.oauth;
 
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -156,7 +157,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/f8df21ed/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFFilterTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFFilterTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFFilterTest.java
index f6881d0..4ee4b45 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFFilterTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFFilterTest.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.systest.servlet;
 
 
+import java.nio.charset.StandardCharsets;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -72,7 +73,7 @@ public class CXFFilterTest extends AbstractServletTest {
         WebResponse response = newClient().getResponse(req);
 
         assertEquals("text/xml", response.getContentType());
-        assertEquals("UTF-8", response.getCharacterSet());
+        assertEquals(StandardCharsets.UTF_8.name(), response.getCharacterSet());
 
         Document doc = StaxUtils.read(response.getInputStream());
         assertNotNull(doc);

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
index 49e3e79..a60f791 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
@@ -20,6 +20,7 @@ package org.apache.cxf.systest.servlet;
 
 
 
+import java.nio.charset.StandardCharsets;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -67,7 +68,7 @@ public class CXFServletTest extends AbstractServletTest {
     @Test
     public void testPostInvokeServices() throws Exception {
         
-        invoke("UTF-8");
+        invoke(StandardCharsets.UTF_8.name());
         invoke("iso-8859-1");        
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
index 05f0ae8..a96b449 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.systest.servlet;
 
 
+import java.nio.charset.StandardCharsets;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -91,7 +92,7 @@ public class ExternalServicesServletTest extends AbstractServletTest {
         WebResponse response = newClient().getResponse(req);
 
         assertEquals("text/xml", response.getContentType());
-        assertEquals("UTF-8", response.getCharacterSet());
+        assertEquals(StandardCharsets.UTF_8.name(), response.getCharacterSet());
 
         Document doc = StaxUtils.read(response.getInputStream());
         assertNotNull(doc);

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/transports/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
index 5e94811..4f0c1e8 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
@@ -44,7 +44,7 @@ public class JsFrontEndServletTest extends AbstractServletTest {
         WebResponse response = newClient().getResponse(req);
 
         assertEquals("text/xml", response.getContentType());
-        //assertEquals("UTF-8", response.getCharacterSet());
+        //assertEquals(StandardCharsets.UTF_8, response.getCharacterSet());
 
         Document doc = StaxUtils.read(response.getInputStream());
         assertNotNull(doc);

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java
index 06ff4ac..7a574ec 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/js/Server.java
@@ -21,6 +21,7 @@ package org.apache.cxf.systest.js;
 
 import java.io.File;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.cxf.js.rhino.ProviderFactory;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -33,11 +34,11 @@ public class Server extends AbstractBusTestServerBase {
     protected void run()  {
         try {            
             String f = getClass().getResource("resources/hello_world.js").toURI().getPath();
-            f = URLDecoder.decode(f, "UTF-8");
+            f = URLDecoder.decode(f, StandardCharsets.UTF_8.name());
             pf.createAndPublish(new File(f), "http://localhost:" + JS_PORT 
                                 + "/SoapContext/SoapPort", false);
             f = getClass().getResource("resources/hello_world.jsx").toURI().getPath();
-            f = URLDecoder.decode(f, "UTF-8");
+            f = URLDecoder.decode(f, StandardCharsets.UTF_8.name());
             pf.createAndPublish(new File(f), "http://localhost:" + JSX_PORT, false);
         } catch (Exception ex) {
             ex.printStackTrace();

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
index 78a1864..4285378 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
@@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -169,10 +170,10 @@ public class MtomServerTest extends AbstractBusClientServerTestBase {
         }
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         IOUtils.copy(is, bout);
-        String s = bout.toString("UTF-8");
+        String s = bout.toString(StandardCharsets.UTF_8.name());
         s = s.replaceAll(":9036/", ":" + PORT2 + "/");
 
-        os.write(s.getBytes("UTF-8"));
+        os.write(s.getBytes(StandardCharsets.UTF_8));
         os.flush();
         is.close();
         os.close();

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/common/src/main/java/org/apache/cxf/tools/util/FileWriterUtil.java
----------------------------------------------------------------------
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/util/FileWriterUtil.java b/tools/common/src/main/java/org/apache/cxf/tools/util/FileWriterUtil.java
index 79d18ad..85039f8 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/util/FileWriterUtil.java
+++ b/tools/common/src/main/java/org/apache/cxf/tools/util/FileWriterUtil.java
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.i18n.Message;
@@ -58,12 +59,12 @@ public class FileWriterUtil {
     }
 
     private Writer getWriter(File fn) throws IOException {
-        return getWriter(fn, "UTF-8");
+        return getWriter(fn, StandardCharsets.UTF_8.name());
     }
 
     public Writer getWriter(File fn, String encoding) throws IOException {
         if (encoding == null) {
-            encoding = "UTF-8";
+            encoding = StandardCharsets.UTF_8.name();
         }
         return new OutputStreamWriter(new BufferedOutputStream(osc.createOutputStream(fn)), encoding);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
----------------------------------------------------------------------
diff --git a/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java b/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
index 9bb3642..1760a89 100644
--- a/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
+++ b/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.tools.util;
 
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.cxf.common.util.URIParserUtil;
 import org.junit.Assert;
@@ -98,9 +99,9 @@ public class URIParserUtilTest extends Assert {
     }
     @Test
     public void testCXF3855() throws Exception {
-        String orig = new String(new byte[] {-47, -122}, "UTF-8");
+        String orig = new String(new byte[] {-47, -122}, StandardCharsets.UTF_8);
         orig = "/foo" + orig + ".txt";
         String s = URIParserUtil.escapeChars(orig);
-        assertEquals(orig, URLDecoder.decode(s, "UTF-8"));
+        assertEquals(orig, URLDecoder.decode(s, StandardCharsets.UTF_8.name()));
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
----------------------------------------------------------------------
diff --git a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
index 186f3b5..fe33970 100644
--- a/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
+++ b/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
@@ -26,6 +26,7 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.io.Writer;
 import java.net.URI;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -414,7 +415,7 @@ public class IDLToWSDLProcessor extends IDLProcessor {
             String encoding = env.get(ToolCorbaConstants.CFG_WSDL_ENCODING).toString();            
             return new FileWriterUtil().getWriter(file, encoding); 
         } else {
-            return new FileWriterUtil().getWriter(file, "UTF-8");
+            return new FileWriterUtil().getWriter(file, StandardCharsets.UTF_8.name());
         }       
     }    
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/corba/src/test/java/org/apache/cxf/tools/corba/WSDLToIDLTest.java
----------------------------------------------------------------------
diff --git a/tools/corba/src/test/java/org/apache/cxf/tools/corba/WSDLToIDLTest.java b/tools/corba/src/test/java/org/apache/cxf/tools/corba/WSDLToIDLTest.java
index b338d75..999cd6f 100644
--- a/tools/corba/src/test/java/org/apache/cxf/tools/corba/WSDLToIDLTest.java
+++ b/tools/corba/src/test/java/org/apache/cxf/tools/corba/WSDLToIDLTest.java
@@ -26,6 +26,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -174,7 +175,7 @@ public class WSDLToIDLTest extends ToolTestBase {
         Path path = FileSystems.getDefault().getPath(output.getPath(), "simple-binding.idl");
         assertTrue("simple-binding.idl should be generated", Files.isReadable(path));
         
-        String line = new String(Files.readAllBytes(path), "UTF-8");
+        String line = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
         assertTrue("Invalid Idl File Generated", line.length() > 0);
     }   
     
@@ -189,7 +190,7 @@ public class WSDLToIDLTest extends ToolTestBase {
         Path path = FileSystems.getDefault().getPath(output.getPath(), "simple-binding_gen.idl");
         assertTrue("simple-binding_gen.idl should be generated", Files.isReadable(path));
 
-        String line = new String(Files.readAllBytes(path), "UTF-8");
+        String line = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
         assertTrue("Invalid Idl File Generated", line.length() > 0);
     }
 
@@ -219,7 +220,7 @@ public class WSDLToIDLTest extends ToolTestBase {
             fail("WSDLToIDL generated an invalid simple-binding-corba.wsdl");
         }
 
-        String line = new String(Files.readAllBytes(path2), "UTF-8");
+        String line = new String(Files.readAllBytes(path2), StandardCharsets.UTF_8);
         assertTrue("Invalid Idl File Generated", line.length() > 0);
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java
----------------------------------------------------------------------
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java
index d2e583f..70ef1d3 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGenerator.java
@@ -20,6 +20,7 @@ package org.apache.cxf.tools.java2wsdl.generator.wsdl11;
 
 import java.io.File;
 import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
@@ -95,7 +96,7 @@ public final class DateTypeCustomGenerator extends AbstractGenerator<File> {
 
             try {
                 generator.doWrite(getTemplate(), new FileWriterUtil(xjb.getParent(), getOutputStreamCreator())
-                    .getWriter(xjb, "UTF-8"));
+                    .getWriter(xjb, StandardCharsets.UTF_8.name()));
             } catch (Exception e) {
                 e.printStackTrace();
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
----------------------------------------------------------------------
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
index 257889d..46954ea 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WSDL11Generator.java
@@ -26,6 +26,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -70,7 +71,7 @@ public class WSDL11Generator extends AbstractGenerator<Definition> {
         Definition def = null;
         try {
             Writer os = new FileWriterUtil(file.getParent(),
-                                           getOutputStreamCreator()).getWriter(file, "UTF-8");
+                                           getOutputStreamCreator()).getWriter(file, StandardCharsets.UTF_8.name());
             WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
 
             ServiceWSDLBuilder builder = new ServiceWSDLBuilder(getBus(), getServiceModel());
@@ -105,8 +106,9 @@ public class WSDL11Generator extends AbstractGenerator<Definition> {
                 File impfile = new File(file.getParentFile(), imp.getKey());
                 Element el = imp.getValue().getElement();
                 updateImports(el, imports);
-                os = new FileWriterUtil(impfile.getParent(),
-                                        getToolContext().get(OutputStreamCreator.class)).getWriter(impfile, "UTF-8");
+                FileWriterUtil fileWriterUtil = 
+                    new FileWriterUtil(impfile.getParent(), getToolContext().get(OutputStreamCreator.class));
+                os = fileWriterUtil.getWriter(impfile, StandardCharsets.UTF_8.name());
                 StaxUtils.writeTo(el, os, 2);
                 os.close();
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
----------------------------------------------------------------------
diff --git a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
index 687e533..ec36bc0 100644
--- a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
+++ b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -205,7 +206,7 @@ public class JAXRSContainer extends AbstractCXFToolContainer {
     protected String readWadl(String wadlURI) {
         try {
             URL url = new URL(wadlURI);
-            Reader reader = new InputStreamReader(url.openStream(), "UTF-8");
+            Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8);
             return IOUtils.toString(reader);
         } catch (IOException e) {
             throw new ToolException(e);

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
----------------------------------------------------------------------
diff --git a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
index 285f85f..ff37819 100644
--- a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
+++ b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
@@ -31,6 +31,7 @@ import java.io.StringReader;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -1666,7 +1667,7 @@ public class SourceGenerator {
         try {
             file.createNewFile();
             try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), 
-                                                encoding == null ? "UTF-8" : encoding)) {
+                                                encoding == null ? StandardCharsets.UTF_8.name() : encoding)) {
                 writer.write(content);
                 writer.flush();
             }
@@ -1683,7 +1684,7 @@ public class SourceGenerator {
             if (validateWadl) {
                 SchemaFactory factory = SchemaFactory.newInstance(Constants.URI_2001_SCHEMA_XSD);
                 URL schemaURL = ResourceUtils.getResourceURL("classpath:/schemas/wadl/wadl.xsd", bus);
-                Reader r = new BufferedReader(new InputStreamReader(schemaURL.openStream(), "UTF-8"));
+                Reader r = new BufferedReader(new InputStreamReader(schemaURL.openStream(), StandardCharsets.UTF_8));
                 StreamSource source = new StreamSource(r);
                 source.setSystemId(schemaURL.toString());
                 Schema s = factory.newSchema(new Source[]{source});
@@ -1714,7 +1715,8 @@ public class SourceGenerator {
     
     private void generateClassesFromSchema(JCodeModel codeModel, File src) {
         try {
-            Object writer = JAXBUtils.createFileCodeWriter(src, encoding == null ? "UTF-8" : encoding);
+            Object writer = JAXBUtils.createFileCodeWriter(src, encoding == null 
+                ? StandardCharsets.UTF_8.name() : encoding);
             codeModel.build(writer);
             generatedTypeClasses = JAXBUtils.getGeneratedClassNames(codeModel);
         } catch (Exception e) {
@@ -1814,7 +1816,7 @@ public class SourceGenerator {
             if (is == null) {
                 is = URI.create(href).toURL().openStream();
             }
-            return readXmlDocument(new InputStreamReader(is, "UTF-8"));
+            return readXmlDocument(new InputStreamReader(is, StandardCharsets.UTF_8));
         } catch (Exception ex) {
             throw new RuntimeException("Resource " + href + " can not be read");
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
index dac902f..01f073b 100644
--- a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
+++ b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
@@ -32,6 +32,7 @@ import java.io.OutputStream;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -820,7 +821,7 @@ public class WSDLToJavaContainer extends AbstractCXFToolContainer {
                     Element el = imp.getSchemaDocument().getDocumentElement();
                     updateImports(el, sourceMap);
                     os = new FileWriterUtil(impfile.getParent(), context.get(OutputStreamCreator.class))
-                        .getWriter(impfile, "UTF-8");
+                        .getWriter(impfile, StandardCharsets.UTF_8.name());
                     StaxUtils.writeTo(el, os, 2);
                     os.close();
                 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java b/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java
index 10cb2cf..5a36504 100644
--- a/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java
+++ b/tools/wsdlto/frontend/javascript/src/test/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.tools.wsdlto.javascript;
 
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -60,7 +61,7 @@ public class WSDLToJavaScriptTest extends ProcessorTestBase {
         // now we really want to check some results.
         Path path = FileSystems.getDefault().getPath(output.getPath(), "SOAPService_Test1.js");
         assertTrue(Files.isReadable(path));
-        String javascript = new String(Files.readAllBytes(path), "UTF-8");
+        String javascript = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
         
         assertTrue(javascript.contains("xmlns:murble='http://apache.org/hello_world_soap_http'"));
         assertEquals("Number of '{' does not match number of '}' in generated JavaScript.",
@@ -84,7 +85,7 @@ public class WSDLToJavaScriptTest extends ProcessorTestBase {
         // now we really want to check some results.
         Path path = FileSystems.getDefault().getPath(output.getPath(), "SOAPService.js");
         assertTrue(Files.isReadable(path));
-        String javascript = new String(Files.readAllBytes(path), "UTF-8");
+        String javascript = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
         
         assertTrue(javascript.contains("xmlns:murble='http://apache.org/hello_world_soap_http'"));
         assertEquals("Number of '{' does not match number of '}' in generated JavaScript.",

http://git-wip-us.apache.org/repos/asf/cxf/blob/f8df21ed/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
index c6eea47..ef0fa79 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -227,7 +228,7 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         
         Path path = FileSystems.getDefault().getPath(output.getCanonicalPath(), "build.xml");
         assertTrue(Files.isReadable(path));
-        String content = new String(Files.readAllBytes(path), "UTF-8");
+        String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
         
         assertTrue("wsdl location should be url style in build.xml", content.indexOf("param1=\"file:") > -1);
 


Mime
View raw message