You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by kr...@apache.org on 2018/10/24 14:42:10 UTC

[4/4] knox git commit: KNOX-1540 - Use StandardCharsets where possible

KNOX-1540 - Use StandardCharsets where possible

Signed-off-by: Kevin Risden <kr...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/4961cd13
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/4961cd13
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/4961cd13

Branch: refs/heads/master
Commit: 4961cd139348292635e0de2380005d3d59d7f930
Parents: 121da54
Author: Kevin Risden <kr...@apache.org>
Authored: Wed Oct 24 09:44:19 2018 -0400
Committer: Kevin Risden <kr...@apache.org>
Committed: Wed Oct 24 10:09:40 2018 -0400

----------------------------------------------------------------------
 .../AmbariDynamicServiceURLCreatorTest.java     |   6 +-
 .../ambari/AmbariServiceDiscoveryTest.java      |   3 +-
 .../provider/impl/AtlasZookeeperURLManager.java |   4 +-
 .../provider/impl/HS2ZookeeperURLManager.java   |   4 +-
 .../provider/impl/KafkaZookeeperURLManager.java |   4 +-
 .../impl/AtlasZookeeperURLManagerTest.java      |   6 +-
 ...yAssertionHttpServletRequestWrapperTest.java |  30 ++--
 .../function/UsernameFunctionProcessorTest.java |   4 +-
 .../impl/ServiceRegistryFunctionsTest.java      |  18 +--
 .../encrypturi/impl/EncryptUriProcessor.java    |   7 +-
 .../securequery/SecureQueryDecodeProcessor.java |   3 +-
 .../SecureQueryDecryptProcessor.java            |   3 +-
 .../securequery/SecureQueryEncodeProcessor.java |   4 +-
 .../api/UrlRewriteServletContextListener.java   |   3 +-
 .../filter/rewrite/impl/UrlRewriteRequest.java  |   2 +-
 .../filter/rewrite/impl/form/FormReader.java    |   7 +-
 .../filter/rewrite/impl/form/FormWriter.java    |   8 +-
 .../rewrite/api/UrlRewriteProcessorTest.java    |  17 +--
 .../UrlRewriteRulesDescriptorFactoryTest.java   |  22 +--
 .../api/UrlRewriteServletFilterTest.java        |  51 ++++---
 .../impl/FrontendFunctionProcessorTest.java     |  14 +-
 .../rewrite/impl/json/JsonFilterReaderTest.java |  18 +--
 .../rewrite/impl/xml/XmlFilterReaderTest.java   |  14 +-
 .../jwt/filter/SSOCookieFederationFilter.java   |   3 +-
 .../gateway/dispatch/UrlConnectionDispatch.java |   3 +-
 .../security/impl/DefaultCryptoService.java     |   9 +-
 .../security/impl/DefaultKeystoreService.java   |  10 +-
 .../org/apache/knox/gateway/TempletonDemo.java  |   4 +-
 .../knox/gateway/jetty/SslSocketTest.java       |   2 +-
 ...emoteConfigurationRegistryClientService.java |   7 +-
 .../apache/knox/gateway/util/KnoxCLITest.java   | 140 +++++++++----------
 .../service/admin/TopologiesResource.java       |   7 +-
 .../knox/gateway/hbase/HBaseDispatch.java       |   8 +-
 .../gateway/service/knoxsso/WebSSOResource.java |   5 +-
 .../service/knoxsso/WebSSOResourceTest.java     |   5 +-
 .../config/remote/zk/CuratorClientService.java  |   9 +-
 .../shell/AbstractCredentialCollector.java      |   9 +-
 .../org/apache/knox/gateway/shell/KnoxSh.java   |   5 +-
 .../gateway/shell/hbase/table/CreateTable.java  |   3 +-
 .../shell/hbase/table/TruncateTable.java        |   3 +-
 .../gateway/shell/hbase/table/UpdateTable.java  |   3 +-
 .../shell/hbase/table/row/InsertableColumn.java |  10 +-
 .../gateway/shell/hbase/table/row/StoreRow.java |   5 +-
 .../hbase/table/scanner/CreateScanner.java      |   9 +-
 .../knox/gateway/shell/workflow/Submit.java     |   3 +-
 .../gateway/dispatch/GatewayDispatchFilter.java |   3 +-
 .../PassAllHeadersNoEncodingDispatch.java       |   6 +-
 .../gateway/dispatch/URLDecodingDispatch.java   |   8 +-
 .../security/impl/BaseKeystoreService.java      |   8 +-
 .../security/impl/ConfigurableEncryptor.java    |   6 +-
 .../security/impl/X509CertificateUtil.java      |  17 +--
 .../dispatch/CappedBufferHttpEntityTest.java    | 134 +++++++++---------
 .../dispatch/GatewayDispatchFilterTest.java     |   5 +-
 .../PartiallyRepeatableHttpEntityTest.java      | 137 +++++++++---------
 .../apache/knox/gateway/GatewayTestDriver.java  |   6 +-
 .../main/java/org/apache/knox/test/Console.java |   5 +-
 .../java/org/apache/knox/test/TestUtils.java    |   7 +-
 .../knox/test/mock/MockRequestMatcher.java      |  11 +-
 .../gateway/GatewayAdminTopologyFuncTest.java   |  30 ++--
 .../apache/knox/gateway/GatewayAppFuncTest.java |   3 +-
 .../knox/gateway/GatewayBasicFuncTest.java      | 102 +++++++-------
 .../apache/knox/gateway/GatewayUIFuncTest.java  |  21 ++-
 .../gateway/KnoxCliLdapFuncTestNegative.java    |  27 ++--
 .../gateway/KnoxCliLdapFuncTestPositive.java    |  23 +--
 .../apache/knox/gateway/KnoxCliSysBindTest.java |  19 +--
 .../gateway/OozieServiceDefinitionTest.java     |   7 +-
 .../org/apache/knox/gateway/util/HttpUtils.java |  11 +-
 .../org/apache/knox/gateway/util/MimeTypes.java |  11 +-
 .../java/org/apache/knox/gateway/util/Urls.java |   5 +-
 .../apache/knox/gateway/launcher/Launcher.java  |   3 +-
 .../knox/gateway/util/urltemplate/Expander.java |   3 +-
 .../gateway/util/urltemplate/RewriterTest.java  |   9 +-
 72 files changed, 572 insertions(+), 569 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
index 8d67944..51f4af2 100644
--- a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
+++ b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
@@ -24,6 +24,7 @@ import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -38,7 +39,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-
 public class AmbariDynamicServiceURLCreatorTest {
 
     @Test
@@ -275,7 +275,7 @@ public class AmbariDynamicServiceURLCreatorTest {
         File tmpFile = File.createTempFile("knox-discovery-external-url-mapping", ".xml");
         System.setProperty(AmbariDynamicServiceURLCreator.MAPPING_CONFIG_OVERRIDE_PROPERTY, tmpFile.getAbsolutePath());
         try {
-            FileUtils.writeStringToFile(tmpFile, OOZIE_OVERRIDE_MAPPING_FILE_CONTENTS, java.nio.charset.Charset.forName("utf-8"));
+            FileUtils.writeStringToFile(tmpFile, OOZIE_OVERRIDE_MAPPING_FILE_CONTENTS, StandardCharsets.UTF_8);
             testOozieURL(null, "OOZIE", "http://host3:2222/OVERRIDE");
         } finally {
             System.clearProperty(AmbariDynamicServiceURLCreator.MAPPING_CONFIG_OVERRIDE_PROPERTY);
@@ -1218,7 +1218,7 @@ public class AmbariDynamicServiceURLCreatorTest {
         File tmpFile = File.createTempFile("knox-discovery-url-mapping-extension", ".xml");
         System.setProperty(AmbariDynamicServiceURLCreator.MAPPING_CONFIG_OVERRIDE_PROPERTY, tmpFile.getAbsolutePath());
         try {
-            FileUtils.writeStringToFile(tmpFile, CUSTOM_AUGMENT_MAPPING_FILE_CONTENTS, java.nio.charset.Charset.forName("utf-8"));
+            FileUtils.writeStringToFile(tmpFile, CUSTOM_AUGMENT_MAPPING_FILE_CONTENTS, StandardCharsets.UTF_8);
 
             final String[] HOSTNAMES = {"host2", "host4"};
 

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java
index d63435e..4e6a261 100644
--- a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java
+++ b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryTest.java
@@ -29,6 +29,7 @@ import org.junit.Test;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.lang.reflect.Field;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -265,7 +266,7 @@ public class AmbariServiceDiscoveryTest {
         File urlMappingOverrides = File.createTempFile(getClass().getName()+"_url-overrides", ".xml");
         FileUtils.writeStringToFile(urlMappingOverrides,
                                     URL_MAPPING_OVERRIDES,
-                                    java.nio.charset.Charset.forName("utf-8"));
+                                    StandardCharsets.UTF_8);
         System.setProperty(AmbariDynamicServiceURLCreator.MAPPING_CONFIG_OVERRIDE_PROPERTY,
                            urlMappingOverrides.getAbsolutePath());
 

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
index 0d5627e..af0aa37 100644
--- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
+++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
@@ -25,7 +25,7 @@ import org.apache.knox.gateway.ha.provider.HaServiceConfig;
 import org.apache.knox.gateway.ha.provider.impl.i18n.HaMessages;
 import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
@@ -78,7 +78,7 @@ public class AtlasZookeeperURLManager extends DefaultURLManager {
 
             byte[] bytes = zooKeeperClient.getData().forPath(zooKeeperNamespace + APACHE_ATLAS_ACTIVE_SERVER_INFO);
 
-            String activeURL = new String(bytes, Charset.forName("UTF-8"));
+            String activeURL = new String(bytes, StandardCharsets.UTF_8);
 
             serverHosts.add(activeURL);
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
index 4f495b6..e7855b3 100644
--- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
+++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
@@ -24,7 +24,7 @@ import org.apache.knox.gateway.ha.provider.HaServiceConfig;
 import org.apache.knox.gateway.ha.provider.impl.i18n.HaMessages;
 import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
@@ -80,7 +80,7 @@ public class HS2ZookeeperURLManager extends DefaultURLManager {
         String serverInfo =
             new String(
                 zooKeeperClient.getData().forPath("/" + zooKeeperNamespace + "/" + serverNode),
-                Charset.forName("UTF-8"));
+                StandardCharsets.UTF_8);
         String serverURL = constructURL(serverInfo);
         serverHosts.add(serverURL);
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
index 534291b..f14c385 100644
--- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
+++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
@@ -25,7 +25,7 @@ import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.retry.ExponentialBackoffRetry;
 
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -105,7 +105,7 @@ public class KafkaZookeeperURLManager extends BaseZookeeperURLManager {
       List<String> brokers = zooKeeperClient.getChildren().forPath(BASE_PATH);
 
       for (String broker : brokers) {
-        String serverInfo = new String(zooKeeperClient.getData().forPath(BASE_PATH + "/" + broker), Charset.forName("UTF-8"));
+        String serverInfo = new String(zooKeeperClient.getData().forPath(BASE_PATH + "/" + broker), StandardCharsets.UTF_8);
 
         String serverURL = constructURL(serverInfo);
         serverHosts.add(serverURL);

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManagerTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManagerTest.java b/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManagerTest.java
index 4c2c8a8..1ee54e9 100644
--- a/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManagerTest.java
+++ b/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManagerTest.java
@@ -30,7 +30,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 import java.io.IOException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
@@ -61,7 +61,7 @@ public class AtlasZookeeperURLManagerTest {
         zooKeeperClient.create().forPath("/apache_atlas");
         zooKeeperClient.create().forPath("/apache_atlas/active_server_info");
         zooKeeperClient.setData().forPath("/apache_atlas/active_server_info",
-                                          atlasNode1.getBytes(Charset.forName("UTF-8")));
+                                          atlasNode1.getBytes(StandardCharsets.UTF_8));
         zooKeeperClient.close();
         setAtlasActiveHostURLInZookeeper(atlasNode1);
 
@@ -155,7 +155,7 @@ public class AtlasZookeeperURLManagerTest {
             zooKeeperClient.blockUntilConnected(10, TimeUnit.SECONDS);
 
             zooKeeperClient.setData().forPath("/apache_atlas/active_server_info",
-                activeURL.getBytes(Charset.forName("UTF-8")));
+                activeURL.getBytes(StandardCharsets.UTF_8));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/IdentityAssertionHttpServletRequestWrapperTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/IdentityAssertionHttpServletRequestWrapperTest.java b/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/IdentityAssertionHttpServletRequestWrapperTest.java
index 4f7d0cb..5d63d33 100644
--- a/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/IdentityAssertionHttpServletRequestWrapperTest.java
+++ b/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/IdentityAssertionHttpServletRequestWrapperTest.java
@@ -30,6 +30,7 @@ import org.junit.experimental.categories.Category;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -53,8 +54,8 @@ public class IdentityAssertionHttpServletRequestWrapperTest {
     String inputBody = "jar=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaWebHCat%2Fhadoop-examples.jar&class=org.apache.org.apache.hadoop.examples.WordCount&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Finput&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Foutput";
 
     MockHttpServletRequest request = new MockHttpServletRequest();
-    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( "UTF-8" ) ) ) );
-    request.setCharacterEncoding( "UTF-8" );
+    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( StandardCharsets.UTF_8 ) ) ) );
+    request.setCharacterEncoding( StandardCharsets.UTF_8.name() );
     request.setContentType( "application/x-www-form-urlencoded" );
     request.setMethod("POST");
 
@@ -71,7 +72,7 @@ public class IdentityAssertionHttpServletRequestWrapperTest {
     String inputBody = "jar=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaWebHCat%2Fhadoop-examples.jar&class=org.apache.org.apache.hadoop.examples.WordCount&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Finput&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Foutput";
 
     MockHttpServletRequest request = new MockHttpServletRequest();
-    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( "UTF-8" ) ) ) );
+    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( StandardCharsets.UTF_8 ) ) ) );
     request.setContentType( "application/x-www-form-urlencoded" );
     request.setMethod("POST");
 
@@ -88,9 +89,9 @@ public class IdentityAssertionHttpServletRequestWrapperTest {
     String inputBody = "jar=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaWebHCat%2Fhadoop-examples.jar&class=org.apache.org.apache.hadoop.examples.WordCount&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Finput&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Foutput";
 
     MockHttpServletRequest request = new MockHttpServletRequest();
-    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( "UTF-8" ) ) ) );
+    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( StandardCharsets.UTF_8 ) ) ) );
     request.setContentType( "application/x-www-form-urlencoded" );
-    request.setCharacterEncoding( "ISO-8859-1" );
+    request.setCharacterEncoding( StandardCharsets.ISO_8859_1.name() );
     request.setMethod("POST");
 
     IdentityAsserterHttpServletRequestWrapper wrapper
@@ -106,8 +107,8 @@ public class IdentityAssertionHttpServletRequestWrapperTest {
     String inputBody = "user.name=input-user&jar=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaWebHCat%2Fhadoop-examples.jar&class=org.apache.org.apache.hadoop.examples.WordCount&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Finput&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Foutput";
 
     MockHttpServletRequest request = new MockHttpServletRequest();
-    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( "UTF-8" ) ) ) );
-    request.setCharacterEncoding( "UTF-8" );
+    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( StandardCharsets.UTF_8 ) ) ) );
+    request.setCharacterEncoding( StandardCharsets.UTF_8.name() );
     request.setContentType( "application/x-www-form-urlencoded" );
     request.setMethod("POST");
     
@@ -125,8 +126,8 @@ public class IdentityAssertionHttpServletRequestWrapperTest {
     String inputBody = "user.name=input-user&jar=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaWebHCat%2Fhadoop-examples.jar&class=org.apache.org.apache.hadoop.examples.WordCount&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Finput&arg=%2Ftmp%2FGatewayWebHdfsFuncTest%2FtestJavaMapReduceViaTempleton%2Foutput";
 
     MockHttpServletRequest request = new MockHttpServletRequest();
-    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( "UTF-8" ) ) ) );
-    request.setCharacterEncoding( "UTF-8" );
+    request.setInputStream( new MockServletInputStream( new ByteArrayInputStream( inputBody.getBytes( StandardCharsets.UTF_8 ) ) ) );
+    request.setCharacterEncoding( StandardCharsets.UTF_8.name() );
     request.setContentType( "text/plain" );
 
     IdentityAsserterHttpServletRequestWrapper wrapper
@@ -252,27 +253,26 @@ public class IdentityAssertionHttpServletRequestWrapperTest {
 
     m = new HashMap<>();
     m.put( "null-values", null );
-    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
+    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, StandardCharsets.UTF_8.name() );
     assertThat( s, is( "null-values" ) );
 
     m = new HashMap<>();
     m.put( "no-values", new ArrayList<String>(0) );
-    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
+    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, StandardCharsets.UTF_8.name() );
     assertThat( s, is( "no-values" ) );
 
     m = new HashMap<>();
     List<String> lst = new ArrayList<>();
     lst.add("value1");
     m.put( "one-value", lst);
-    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
+    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, StandardCharsets.UTF_8.name() );
     assertThat( s, is( "one-value=value1" ) );
 
     m = new HashMap<>();
-    lst = new ArrayList<>();
     String[] a = {"value1", "value2"};
-    lst.addAll(Arrays.asList(a));
+    lst = new ArrayList<>(Arrays.asList(a));
     m.put( "two-values", lst);
-    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, "UTF-8" );
+    s = IdentityAsserterHttpServletRequestWrapper.urlEncode( m, StandardCharsets.UTF_8.name() );
     assertThat( s, is( "two-values=value1&two-values=value2" ) );
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/function/UsernameFunctionProcessorTest.java b/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
index 68583be..75a00e5 100644
--- a/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
+++ b/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
@@ -51,7 +51,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.Arrays;
@@ -182,7 +182,7 @@ public class UsernameFunctionProcessorTest {
         .queryParam( "test-query-input-name", "test-query-input-value" )
         .queryParam( "test-query-output-name", "test-query-output-value" )
         .contentType( "text/xml" )
-        .content( expect, Charset.forName( "UTF-8" ) );
+        .content( expect, StandardCharsets.UTF_8 );
     interaction.respond().status( 200 );
     interactions.add( interaction );
     request.setMethod( "PUT" );

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/knox/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/knox/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java b/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/knox/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
index ca50414..f8e7560 100644
--- a/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/knox/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
+++ b/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/knox/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
@@ -50,7 +50,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.EnumSet;
@@ -124,16 +124,16 @@ public class ServiceRegistryFunctionsTest {
     initParams.put( "request.body", "oozie-conf" );
     setUp( "test-user", initParams );
 
-    String input = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-input-body.xml", "UTF-8" );
-    String expect = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-expect-body.xml", "UTF-8" );
+    String input = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-input-body.xml", StandardCharsets.UTF_8 );
+    String expect = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-expect-body.xml", StandardCharsets.UTF_8 );
 
     // Setup the server side request/response interaction.
     interaction.expect()
         .method( "PUT" )
         .requestUrl( "http://test-host:42/test-path" )
         .contentType( "text/xml" )
-        .characterEncoding( "UTF-8" )
-        .content( expect, Charset.forName( "UTF-8" ) );
+        .characterEncoding( StandardCharsets.UTF_8.name() )
+        .content( expect, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -156,16 +156,16 @@ public class ServiceRegistryFunctionsTest {
     initParams.put( "request.body", "oozie-conf" );
     setUp( "test-user", initParams );
 
-    String input = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-input-body.json", "UTF-8" );
-    String expect = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-expect-body.json", "UTF-8" );
+    String input = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-input-body.json", StandardCharsets.UTF_8 );
+    String expect = TestUtils.getResourceString( ServiceRegistryFunctionsTest.class, "test-expect-body.json", StandardCharsets.UTF_8 );
 
     // Setup the server side request/response interaction.
     interaction.expect()
         .method( "PUT" )
         .requestUrl( "http://test-host:42/test-path" )
         .contentType( "application/json" )
-        .characterEncoding( "UTF-8" )
-        .content( expect, Charset.forName( "UTF-8" ) );
+        .characterEncoding( StandardCharsets.UTF_8.name() )
+        .content( expect, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite-step-encrypt-uri/src/main/java/org/apache/knox/gateway/encrypturi/impl/EncryptUriProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-encrypt-uri/src/main/java/org/apache/knox/gateway/encrypturi/impl/EncryptUriProcessor.java b/gateway-provider-rewrite-step-encrypt-uri/src/main/java/org/apache/knox/gateway/encrypturi/impl/EncryptUriProcessor.java
index 67f212b..959c27b 100644
--- a/gateway-provider-rewrite-step-encrypt-uri/src/main/java/org/apache/knox/gateway/encrypturi/impl/EncryptUriProcessor.java
+++ b/gateway-provider-rewrite-step-encrypt-uri/src/main/java/org/apache/knox/gateway/encrypturi/impl/EncryptUriProcessor.java
@@ -18,6 +18,7 @@
 package org.apache.knox.gateway.encrypturi.impl;
 
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 
 import org.apache.commons.codec.binary.Base64;
@@ -51,7 +52,7 @@ public class EncryptUriProcessor
   public void initialize( UrlRewriteEnvironment environment, EncryptUriDescriptor descriptor ) throws Exception {
     clusterName = environment.getAttribute( GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE );
     GatewayServices services = environment.getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
-    cryptoService = (CryptoService) services.getService(GatewayServices.CRYPTO_SERVICE);
+    cryptoService = services.getService(GatewayServices.CRYPTO_SERVICE);
     template = descriptor.getTemplate();
     param = descriptor.getParam();
   }
@@ -78,7 +79,9 @@ public class EncryptUriProcessor
   }
 
   private String encode( String string ) throws UnsupportedEncodingException {
-    EncryptionResult result = cryptoService.encryptForCluster(clusterName, EncryptUriDescriptor.PASSWORD_ALIAS, string.getBytes("UTF-8"));
+    EncryptionResult result = cryptoService.encryptForCluster(clusterName,
+        EncryptUriDescriptor.PASSWORD_ALIAS,
+        string.getBytes(StandardCharsets.UTF_8));
     string = Base64.encodeBase64URLSafeString(result.toByteAray());
     return string;
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecodeProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecodeProcessor.java b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecodeProcessor.java
index e3c920b..b2d6dec 100644
--- a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecodeProcessor.java
+++ b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecodeProcessor.java
@@ -27,6 +27,7 @@ import org.apache.knox.gateway.util.urltemplate.Query;
 import org.apache.knox.gateway.util.urltemplate.Template;
 
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -81,7 +82,7 @@ public class SecureQueryDecodeProcessor implements
   }
 
   private static String decode( String string ) throws UnsupportedEncodingException {
-    return new String( Base64.decodeBase64( string ), "UTF-8" );
+    return new String( Base64.decodeBase64( string ), StandardCharsets.UTF_8 );
   }
 
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
index 8d12fbe..2b421e4 100644
--- a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
+++ b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
@@ -31,6 +31,7 @@ import org.apache.knox.gateway.util.urltemplate.Query;
 import org.apache.knox.gateway.util.urltemplate.Template;
 
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -117,7 +118,7 @@ public class SecureQueryDecryptProcessor implements
       log.unableToDecryptValue(e);
     }
     if (clear != null) {
-      return new String(clear, "UTF-8");
+      return new String(clear, StandardCharsets.UTF_8);
     }
     return null;
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryEncodeProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryEncodeProcessor.java b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryEncodeProcessor.java
index 5f47a2a..81a00ef 100644
--- a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryEncodeProcessor.java
+++ b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryEncodeProcessor.java
@@ -25,6 +25,8 @@ import org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStepStatus;
 import org.apache.knox.gateway.util.urltemplate.Parser;
 import org.apache.knox.gateway.util.urltemplate.Template;
 
+import java.nio.charset.StandardCharsets;
+
 public class SecureQueryEncodeProcessor
     implements UrlRewriteStepProcessor<SecureQueryEncodeDescriptor> {
 
@@ -54,7 +56,7 @@ public class SecureQueryEncodeProcessor
       }
     }
     if( query != null ) {
-      query = Base64.encodeBase64String( query.getBytes( "UTF-8" ) );
+      query = Base64.encodeBase64String( query.getBytes( StandardCharsets.UTF_8 ) );
       query = removeTrailingEquals( query );
       url = Parser.parseLiteral( path + "?" + ENCODED_PARAMETER_NAME +"=" + query );
       context.setCurrentUrl( url );

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java
index 201d4b2..d7eb05f 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListener.java
@@ -31,6 +31,7 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 public class UrlRewriteServletContextListener implements ServletContextListener {
 
@@ -93,7 +94,7 @@ public class UrlRewriteServletContextListener implements ServletContextListener
 
   private static UrlRewriteRulesDescriptor loadDescriptor( URL url ) throws IOException {
     InputStream stream = url.openStream();
-    Reader reader = new InputStreamReader( stream, "UTF-8" );
+    Reader reader = new InputStreamReader( stream, StandardCharsets.UTF_8 );
     UrlRewriteRulesDescriptor descriptor = UrlRewriteRulesDescriptorFactory.load( "xml", reader );
     try {
       reader.close();

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
index b274bd2..489de33 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
@@ -160,7 +160,7 @@ public class UrlRewriteRequest extends GatewayRequestWrapper implements Resolver
     String[] split = splitTargetUrl( getTargetUrl() );
     if( split.length > 1 ) {
       try {
-        return URLDecoder.decode(split[1], "UTF-8");
+        return URLDecoder.decode(split[1], StandardCharsets.UTF_8.name());
       } catch ( UnsupportedEncodingException e ) {
         LOG.failedToDecodeQueryString(split[1], e);
         return split[1];

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormReader.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormReader.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormReader.java
index 4fafdf8..a22df0a 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormReader.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormReader.java
@@ -21,11 +21,10 @@ import java.io.IOException;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 
 public class FormReader {
 
-  private static final String DEFFAULT_FORM_ENCODING = "UTF-8";
-
   private static final int DEFAULT_BUFFER_SIZE = 1024;
 
   private Reader reader;
@@ -80,8 +79,8 @@ public class FormReader {
       name = buffer.toString();
       value = "";
     }
-    name = URLDecoder.decode( name, DEFFAULT_FORM_ENCODING );
-    value = URLDecoder.decode( value, DEFFAULT_FORM_ENCODING );
+    name = URLDecoder.decode( name, StandardCharsets.UTF_8.name() );
+    value = URLDecoder.decode( value, StandardCharsets.UTF_8.name() );
     FormPair pair = new FormPair( name, value );
     current = pair;
     buffer.setLength( 0 );

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormWriter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormWriter.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormWriter.java
index d8813f8..6865b84 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormWriter.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/form/FormWriter.java
@@ -20,11 +20,9 @@ package org.apache.knox.gateway.filter.rewrite.impl.form;
 import java.io.IOException;
 import java.io.Writer;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 
 public class FormWriter {
-
-  private static final String DEFFAULT_FORM_ENCODING = "UTF-8";
-
   private Writer writer;
   boolean first;
 
@@ -39,9 +37,9 @@ public class FormWriter {
     } else {
       writer.write( "&" );
     }
-    writer.write( URLEncoder.encode( pair.getName(), DEFFAULT_FORM_ENCODING ) );
+    writer.write( URLEncoder.encode( pair.getName(), StandardCharsets.UTF_8.name() ) );
     writer.write( "=" );
-    writer.write( URLEncoder.encode( pair.getValue(), DEFFAULT_FORM_ENCODING ) );
+    writer.write( URLEncoder.encode( pair.getValue(), StandardCharsets.UTF_8.name() ) );
   }
 
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
index 1941318..7ffbfeb 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java
@@ -31,6 +31,7 @@ import java.io.Reader;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -62,8 +63,8 @@ public class UrlRewriteProcessorTest {
     return stream;
   }
 
-  private static Reader getTestResourceReader( String name, String charset ) throws IOException {
-    return new InputStreamReader( getTestResourceStream( name ), charset );
+  private static Reader getTestResourceReader( String name ) throws IOException {
+    return new InputStreamReader( getTestResourceStream( name ), StandardCharsets.UTF_8 );
   }
 
   @Test
@@ -75,7 +76,7 @@ public class UrlRewriteProcessorTest {
 
     UrlRewriteProcessor processor = new UrlRewriteProcessor();
     UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
+        "xml", getTestResourceReader( "rewrite.xml" ) );
     processor.initialize( environment, config );
 
     Template inputUrl = Parser.parseLiteral( "test-scheme://test-host:1/test-input-path" );
@@ -98,7 +99,7 @@ public class UrlRewriteProcessorTest {
 
     UrlRewriteProcessor processor = new UrlRewriteProcessor();
     UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite-with-same-rules.xml", "UTF-8" ) );
+        "xml", getTestResourceReader( "rewrite-with-same-rules.xml" ) );
     processor.initialize( environment, config );
 
     Template inputUrl = Parser.parseLiteral( "scheme://input-mock-host:42/test-input-path" );
@@ -139,7 +140,7 @@ public class UrlRewriteProcessorTest {
 
     UrlRewriteProcessor processor = new UrlRewriteProcessor();
     UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite-with-same-rules-different-scope.xml", "UTF-8" ) );
+        "xml", getTestResourceReader( "rewrite-with-same-rules-different-scope.xml" ) );
     processor.initialize( environment, config );
 
     Template inputUrl = Parser.parseLiteral( "scheme://input-mock-host:42/test-input-path" );
@@ -216,7 +217,7 @@ public class UrlRewriteProcessorTest {
 
     UrlRewriteProcessor processor = new UrlRewriteProcessor();
     UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite-with-same-rules.xml", "UTF-8" ) );
+        "xml", getTestResourceReader( "rewrite-with-same-rules.xml" ) );
     processor.initialize( environment, config );
 
     Template inputUrl = Parser.parseLiteral( "input-mock-scheme-1://input-mock-host-1:42/test-input-path" );
@@ -248,7 +249,7 @@ public class UrlRewriteProcessorTest {
 
     UrlRewriteProcessor processor = new UrlRewriteProcessor();
     UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
+        "xml", getTestResourceReader( "rewrite.xml" ) );
     processor.initialize( environment, config );
 
     Template inputUrl;
@@ -278,7 +279,7 @@ public class UrlRewriteProcessorTest {
 
     UrlRewriteProcessor processor = new UrlRewriteProcessor();
     UrlRewriteRulesDescriptor config = UrlRewriteRulesDescriptorFactory.load(
-        "xml", getTestResourceReader( "rewrite.xml", "UTF-8" ) );
+        "xml", getTestResourceReader( "rewrite.xml" ) );
     processor.initialize( environment, config );
 
     Template inputUrl;

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
index 222304d..7692df5 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
@@ -31,6 +31,7 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 import static org.hamcrest.CoreMatchers.containsString;
@@ -75,18 +76,17 @@ public class UrlRewriteRulesDescriptorFactoryTest {
 
   private static InputStream getTestResourceStream( String name ) throws IOException {
     URL url = getTestResourceUrl( name );
-    InputStream stream = url.openStream();
-    return stream;
+    return url.openStream();
   }
 
-  private static Reader getTestResourceReader( String name, String charset ) throws IOException {
-    return new InputStreamReader( getTestResourceStream( name ), charset );
+  private static Reader getTestResourceReader( String name) throws IOException {
+    return new InputStreamReader( getTestResourceStream( name ), StandardCharsets.UTF_8 );
   }
 
   @Test
   public void testLoadMissingFile() throws IOException {
     try {
-      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "missing.xml", "UTF-8" ) );
+      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "missing.xml" ) );
       fail( "Should have thrown a FileNotFoundException." );
     } catch ( FileNotFoundException e ) {
       assertThat( e.getMessage(), containsString( "missing.xml" ) );
@@ -99,7 +99,7 @@ public class UrlRewriteRulesDescriptorFactoryTest {
     Level level = logger.getLevel();
     try {
       logger.setLevel( org.apache.log4j.Level.OFF );
-      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "empty.xml", "UTF-8" ) );
+      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "empty.xml" ) );
       fail( "Should have thrown an IOException." );
     } catch ( IOException e ) {
       // Expected.
@@ -116,7 +116,7 @@ public class UrlRewriteRulesDescriptorFactoryTest {
     Level level = logger.getLevel();
     try {
       logger.setLevel( org.apache.log4j.Level.OFF );
-      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "invalid.xml", "UTF-8" ) );
+      UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "invalid.xml" ) );
       fail( "Should have thrown an IOException." );
     } catch ( IOException e ) {
       // Expected.
@@ -130,21 +130,21 @@ public class UrlRewriteRulesDescriptorFactoryTest {
   @Test
   public void testLoadNoopFile() throws IOException {
     UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "noop.xml", "UTF-8" ) );
+        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "noop.xml" ) );
     assertThat( "Rules should be an empty list.", config.getRules().isEmpty(), Matchers.is( true ) );
   }
 
   @Test
   public void testLoadSimpleFile() throws IOException {
     UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "simple.xml", "UTF-8" ) );
+        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "simple.xml" ) );
     assertThat( "Failed to load simple config file.", config, notNullValue() );
   }
 
   @Test
   public void testLoadSimpleFilterFile() throws IOException {
     UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "filter-simple.xml", "UTF-8" ) );
+        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "filter-simple.xml" ) );
     List<UrlRewriteFilterDescriptor> filters = config.getFilters();
     assertThat( filters.size(), is( 1 ) );
     UrlRewriteFilterDescriptor filter = config.getFilter( "test-filter-1" );
@@ -155,7 +155,7 @@ public class UrlRewriteRulesDescriptorFactoryTest {
   @Test
   public void testLoadStoreCompleteFilterFile() throws IOException {
     UrlRewriteRulesDescriptor config =
-        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "filter-complete.xml", "UTF-8" ) );
+        UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "filter-complete.xml" ) );
 
     List<UrlRewriteFilterDescriptor> filters = config.getFilters();
     assertThat( filters.size(), is( 1 ) );

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
index b5251d8..ddf14b6 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
@@ -46,7 +46,6 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.EnumSet;
 import java.util.Enumeration;
@@ -249,7 +248,7 @@ public class UrlRewriteServletFilterTest {
     interaction.expect()
         .method( "PUT" )
         .requestUrl( "http://mock-host:1/test-output-path-1" )
-        .content( outputJson, Charset.forName( "UTF-8" ) );
+        .content( outputJson, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -281,7 +280,7 @@ public class UrlRewriteServletFilterTest {
     interaction.expect()
         .method( "PUT" )
         .requestUrl( "http://mock-host:1/test-output-path-1" )
-        .content( output, Charset.forName( "UTF-8" ) );
+        .content( output, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -314,7 +313,7 @@ public class UrlRewriteServletFilterTest {
     interaction.respond()
         .status( 200 )
         .contentType( "application/json" )
-        .content( input, Charset.forName( "UTF-8" ) );
+        .content( input, StandardCharsets.UTF_8 );
     interactions.add( interaction );
     request.setMethod( "PUT" );
     request.setURI( "/test-input-path" );
@@ -340,7 +339,7 @@ public class UrlRewriteServletFilterTest {
     interaction.expect()
         .method( "PUT" )
         .requestUrl( "http://mock-host:1/test-output-path-1" )
-        .content( output, Charset.forName( "UTF-8" ) );
+        .content( output, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -369,7 +368,7 @@ public class UrlRewriteServletFilterTest {
     interaction.expect()
         .method( "PUT" )
         .requestUrl( "http://mock-host:1/test-output-path-1" )
-        .content( expect, Charset.forName( "UTF-8" ) );
+        .content( expect, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -401,8 +400,8 @@ public class UrlRewriteServletFilterTest {
         .method( "PUT" )
         .requestUrl( "http://mock-host:42/test-output-path-2" )
         .contentType( "text/xml" )
-        .characterEncoding( "UTF-8" )
-        .content( expect, Charset.forName( "UTF-8" ) );
+        .characterEncoding( StandardCharsets.UTF_8.name() )
+        .content( expect, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -434,8 +433,8 @@ public class UrlRewriteServletFilterTest {
         .method( "PUT" )
         .requestUrl( "http://mock-host:42/test-output-path-1" )
         .contentType( "text/xml" )
-        .characterEncoding( "UTF-8" )
-        .content( expect, Charset.forName( "UTF-8" ) )
+        .characterEncoding( StandardCharsets.UTF_8.name() )
+        .content( expect, StandardCharsets.UTF_8 )
         .header( "Location", "http://mock-host:42/test-output-path-2" );
     interaction.respond()
         .status( 200 );
@@ -477,7 +476,7 @@ public class UrlRewriteServletFilterTest {
         .method( "PUT" )
         .requestUrl( "http://mock-host:42/test-output-path-1" )
         .contentType( "application/json" )
-        .content( expectJson, Charset.forName( "UTF-8" ) );
+        .content( expectJson, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -509,8 +508,8 @@ public class UrlRewriteServletFilterTest {
         .method( "PUT" )
         .requestUrl( "http://mock-host:42/test-output-path-1" )
         .contentType( "text/xml" )
-        .characterEncoding( "UTF-8" )
-        .content( expect, Charset.forName( "UTF-8" ) );
+        .characterEncoding( StandardCharsets.UTF_8.name() )
+        .content( expect, StandardCharsets.UTF_8 );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -545,8 +544,8 @@ public class UrlRewriteServletFilterTest {
           .method( "PUT" )
           .requestUrl( "http://mock-host:42/test-output-path-1" )
           .contentType( "text/xml" )
-          .characterEncoding( "UTF-8" )
-          .content( expect, Charset.forName( "UTF-8" ) );
+          .characterEncoding( StandardCharsets.UTF_8.name() )
+          .content( expect, StandardCharsets.UTF_8 );
       interaction.respond()
           .status( 200 );
       interactions.add( interaction );
@@ -580,8 +579,8 @@ public class UrlRewriteServletFilterTest {
     interaction.expect()
         .method( "PUT" )
         .requestUrl( "http://mock-host:1/test-output-path-1" )
-        .content( expect, Charset.forName( "UTF-8" ) )
-        .characterEncoding( "UTF-8" );
+        .content( expect, StandardCharsets.UTF_8 )
+        .characterEncoding( StandardCharsets.UTF_8.name() );
     interaction.respond()
         .status( 200 );
     interactions.add( interaction );
@@ -612,7 +611,7 @@ public class UrlRewriteServletFilterTest {
         .method( "GET" )
         .requestUrl( "http://mock-host:42/test-output-path-1" );
     interaction.respond()
-        .content( output, Charset.forName( "UTF-8" ) )
+        .content( output, StandardCharsets.UTF_8 )
         .contentType( "text/xml" )
         .header( "Location", "http://mock-host:42/test-input-path-4" )
         .status( 307 );
@@ -657,7 +656,7 @@ public class UrlRewriteServletFilterTest {
         .requestUrl( "http://mock-host:42/test-output-path-1" );
     interaction.respond()
         .contentType( "application/json" )
-        .content( responseJson, Charset.forName( "UTF-8" ) )
+        .content( responseJson, StandardCharsets.UTF_8 )
         .status( 200 );
     interactions.add( interaction );
     request.setMethod( "GET" );
@@ -709,7 +708,7 @@ public class UrlRewriteServletFilterTest {
         .requestUrl( "http://mock-host:42/test-output-path-1" );
     interaction.respond()
         .contentType( "application/html" )
-        .content( responseHtml, Charset.forName( "UTF-8" ) )
+        .content( responseHtml, StandardCharsets.UTF_8 )
         .status( 200 );
     interactions.add( interaction );
     request.setMethod( "GET" );
@@ -738,7 +737,7 @@ public class UrlRewriteServletFilterTest {
         .method( "GET" )
         .requestUrl( "http://mock-host:42/test-output-path-1" );
     interaction.respond()
-        .content( output, Charset.forName( "UTF-8" ) )
+        .content( output, StandardCharsets.UTF_8 )
         .contentType( "text/xml" )
         .status( 200 );
     interactions.add( interaction );
@@ -789,7 +788,7 @@ public class UrlRewriteServletFilterTest {
                .requestUrl( "http://mock-host:42/test-output-path-1" );
     interaction.respond()
                .contentType( "application/html" )
-               .content( responseHtml, Charset.forName( "UTF-8" ) )
+               .content( responseHtml, StandardCharsets.UTF_8 )
                .status( 200 );
     interactions.add( interaction );
     request.setMethod( "GET" );
@@ -826,7 +825,7 @@ public class UrlRewriteServletFilterTest {
         .requestUrl( "http://mock-host:42/test-output-path-1" );
     interaction.respond()
         .contentType( "application/html" )
-        .content( responseHtml, Charset.forName( "UTF-8" ) )
+        .content( responseHtml, StandardCharsets.UTF_8 )
         .status( 200 );
     interactions.add( interaction );
     request.setMethod( "GET" );
@@ -867,7 +866,7 @@ public class UrlRewriteServletFilterTest {
     interaction.respond()
         .contentType( "application/html" )
         .header("Location", locationHeader )
-        .content( responseHtml, Charset.forName( "UTF-8" ) )
+        .content( responseHtml, StandardCharsets.UTF_8 )
         .status( 200 );
     interactions.add( interaction );
     request.setMethod( "GET" );
@@ -907,7 +906,7 @@ public class UrlRewriteServletFilterTest {
     interaction.respond()
         .contentType( "application/html" )
         .header("CustomHeader", customHeader )
-        .content( responseHtml, Charset.forName( "UTF-8" ) )
+        .content( responseHtml, StandardCharsets.UTF_8 )
         .status( 200 );
     interactions.add( interaction );
     request.setMethod( "GET" );
@@ -952,7 +951,7 @@ public class UrlRewriteServletFilterTest {
     interaction.expect().method("GET")
         .requestUrl("http://mock-host:42/test-output-path-1");
     interaction.respond().contentType("application/html")
-        .content(responseHtml, Charset.forName("UTF-8")).status(200);
+        .content(responseHtml, StandardCharsets.UTF_8).status(200);
     interactions.add(interaction);
     request.setMethod("GET");
     request.setURI("/test-input-path");

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
index dea69c0..de87d75 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
@@ -56,7 +56,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.EnumSet;
@@ -176,7 +176,7 @@ public class FrontendFunctionProcessorTest {
     initParams.put( "response.body", "test-filter" );
     setUp( "test-user", initParams, null );
 
-    String input = TestUtils.getResourceString( FrontendFunctionProcessorTest.class, "test-input-body.json", "UTF-8" );
+    String input = TestUtils.getResourceString( FrontendFunctionProcessorTest.class, "test-input-body.json", StandardCharsets.UTF_8 );
 
     interaction.expect()
         .method( "GET" )
@@ -184,8 +184,8 @@ public class FrontendFunctionProcessorTest {
     interaction.respond()
         .status( 200 )
         .contentType( "application/json" )
-        .characterEncoding( "UTF-8" )
-        .content( input, Charset.forName( "UTF-8" ) );
+        .characterEncoding(StandardCharsets.UTF_8.name())
+        .content( input, StandardCharsets.UTF_8 );
     interactions.add( interaction );
     request.setMethod( "GET" );
     request.setURI( "/test-path" );
@@ -222,7 +222,7 @@ public class FrontendFunctionProcessorTest {
 
     setUp( "test-user", initParams, attributes );
 
-    String input = TestUtils.getResourceString( FrontendFunctionProcessorTest.class, "test-input-body.json", "UTF-8" );
+    String input = TestUtils.getResourceString( FrontendFunctionProcessorTest.class, "test-input-body.json", StandardCharsets.UTF_8 );
 
     interaction.expect()
         .method( "GET" )
@@ -230,8 +230,8 @@ public class FrontendFunctionProcessorTest {
     interaction.respond()
         .status( 200 )
         .contentType( "application/json" )
-        .characterEncoding( "UTF-8" )
-        .content( input, Charset.forName( "UTF-8" ) );
+        .characterEncoding( StandardCharsets.UTF_8.name() )
+        .content( input, StandardCharsets.UTF_8 );
     interactions.add( interaction );
     request.setMethod( "GET" );
     request.setURI( "/test-path" );

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
index fd84853..b92363a 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReaderTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -111,7 +111,7 @@ public class JsonFilterReaderTest {
   @Test
   public void testUnscopedStreaming() throws IOException {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "simple-values.json" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -131,7 +131,7 @@ public class JsonFilterReaderTest {
   @Test
   public void testNamesWithDots() throws IOException {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "dotted-field-name.json" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -158,7 +158,7 @@ public class JsonFilterReaderTest {
 //  @Test
 //  public void testJsonPathObject() throws IOException {
 //    InputStream stream = TestUtils.getResourceStream( this.getClass(), "complex.json" );
-//    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+//    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 //
 //    Object o;
 //
@@ -186,7 +186,7 @@ public class JsonFilterReaderTest {
 //  @Test
 //  public void testJsonPathArray() throws IOException {
 //    InputStream stream = TestUtils.getResourceStream( this.getClass(), "array.json" );
-//    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+//    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 //
 //    Object o;
 //
@@ -210,7 +210,7 @@ public class JsonFilterReaderTest {
   @Test
   public void testBuffered() throws IOException {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "simple-values.json" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -232,7 +232,7 @@ public class JsonFilterReaderTest {
   @Test
   public void testBufferedDetectApply() throws IOException {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties.json" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -261,7 +261,7 @@ public class JsonFilterReaderTest {
   @Test
   public void testBufferedApply() throws IOException {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties.json" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -289,7 +289,7 @@ public class JsonFilterReaderTest {
   @Test
   public void testBufferedMultiApply() throws IOException {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties.json" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest.java
index 7620b91..e489f7a 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReaderTest.java
@@ -51,7 +51,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringReader;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -712,7 +712,7 @@ public class XmlFilterReaderTest {
   @Test
   public void testStreamedApplyForElements() throws Exception {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties-elements.xml" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -739,7 +739,7 @@ public class XmlFilterReaderTest {
   @Test
   public void testStreamedApplyForElementsConfigShortcut() throws Exception {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties-elements.xml" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -766,7 +766,7 @@ public class XmlFilterReaderTest {
   @Test
   public void testStreamedApplyForAttributes() throws Exception {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties-attributes.xml" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -793,7 +793,7 @@ public class XmlFilterReaderTest {
   @Test
   public void testBufferedApplyForAttributes() throws Exception {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties-attributes.xml" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -821,7 +821,7 @@ public class XmlFilterReaderTest {
   @Test
   public void testBufferedDetectApplyForElements() throws Exception {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties-elements.xml" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 
@@ -850,7 +850,7 @@ public class XmlFilterReaderTest {
   @Test
   public void testBufferedDetectApplyForAttributes() throws Exception {
     InputStream stream = TestUtils.getResourceStream( this.getClass(), "properties-attributes.xml" );
-    String input = IOUtils.toString( stream, Charset.forName( "UTF-8" ) );
+    String input = IOUtils.toString( stream, StandardCharsets.UTF_8 );
 
     //System.out.println( "INPUT=" + input );
 

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
index 27f4033..68104a1 100644
--- a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
+++ b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
@@ -35,6 +35,7 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
 
 public class SSOCookieFederationFilter extends AbstractJWTFilter {
@@ -134,7 +135,7 @@ private String gatewayPath;
     /* We don't need redirect if this is a XHR request */
     if (request.getHeader(XHR_HEADER) != null && request.getHeader(XHR_HEADER)
         .equalsIgnoreCase(XHR_VALUE)) {
-      final byte[] data = error.getBytes("UTF-8");
+      final byte[] data = error.getBytes(StandardCharsets.UTF_8);
       response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
       response.setContentType(MimeTypes.Type.TEXT_PLAIN.toString());
       response.setContentLength(data.length);

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java b/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
index 07f6d34..6e8ea83 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
@@ -50,6 +50,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.Enumeration;
 import java.util.Locale;
 
@@ -123,7 +124,7 @@ public class UrlConnectionDispatch extends AbstractGatewayFilter {
       String paramValue = request.getParameter( paramName );
       paramStr.append( paramName );
       paramStr.append( "=" );
-      paramStr.append( URLEncoder.encode( paramValue, "UTF-8" ) );
+      paramStr.append( URLEncoder.encode( paramValue, StandardCharsets.UTF_8.name() ) );
       if( paramNames.hasMoreElements() ) {
         paramStr.append( "&" );
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java
index 3cb09e7..2898624 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java
@@ -18,6 +18,7 @@
 package org.apache.knox.gateway.services.security.impl;
 
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.security.InvalidKeyException;
 import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
@@ -144,7 +145,7 @@ public class DefaultCryptoService implements CryptoService {
     try {
       Signature sig=Signature.getInstance(algorithm);
       sig.initVerify(ks.getKeystoreForGateway().getCertificate(alias).getPublicKey());
-      sig.update(signed.getBytes("UTF-8"));
+      sig.update(signed.getBytes(StandardCharsets.UTF_8));
       verified = sig.verify(signature);
     } catch (SignatureException e) {
       LOG.failedToVerifySignature( e );
@@ -154,8 +155,6 @@ public class DefaultCryptoService implements CryptoService {
       LOG.failedToVerifySignature( e );
     } catch (KeyStoreException e) {
       LOG.failedToVerifySignature( e );
-    } catch (UnsupportedEncodingException e) {
-      LOG.failedToVerifySignature( e );
     } catch (KeystoreServiceException e) {
       LOG.failedToVerifySignature( e );
     }
@@ -171,7 +170,7 @@ public class DefaultCryptoService implements CryptoService {
       PrivateKey privateKey = (PrivateKey) ks.getKeyForGateway(alias, passphrase);
       Signature signature = Signature.getInstance(algorithm);
       signature.initSign(privateKey);
-      signature.update(payloadToSign.getBytes("UTF-8"));
+      signature.update(payloadToSign.getBytes(StandardCharsets.UTF_8));
       return signature.sign();
     } catch (NoSuchAlgorithmException e) {
       LOG.failedToSignData( e );
@@ -179,8 +178,6 @@ public class DefaultCryptoService implements CryptoService {
       LOG.failedToSignData( e );
     } catch (SignatureException e) {
       LOG.failedToSignData( e );
-    } catch (UnsupportedEncodingException e) {
-      LOG.failedToSignData( e );
     } catch (KeystoreServiceException e) {
       LOG.failedToSignData( e );
     } catch (AliasServiceException e) {

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultKeystoreService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultKeystoreService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultKeystoreService.java
index 2e98fe3..977e6fb 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultKeystoreService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultKeystoreService.java
@@ -29,8 +29,8 @@ import org.apache.knox.gateway.services.security.KeystoreServiceException;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
 import java.net.InetAddress;
+import java.nio.charset.StandardCharsets;
 import java.security.GeneralSecurityException;
 import java.security.Key;
 import java.security.KeyPair;
@@ -388,7 +388,7 @@ public class DefaultKeystoreService extends BaseKeystoreService implements
             Key credentialKey = ks.getKey( alias, masterSecret );
             if (credentialKey != null) {
               byte[] credentialBytes = credentialKey.getEncoded();
-              String credentialString = new String( credentialBytes, "UTF-8" );
+              String credentialString = new String( credentialBytes, StandardCharsets.UTF_8 );
               credential = credentialString.toCharArray();
               addToCache(clusterName, alias, credentialString);
             }
@@ -398,10 +398,8 @@ public class DefaultKeystoreService extends BaseKeystoreService implements
             LOG.failedToGetCredentialForCluster( clusterName, e );
           } catch (NoSuchAlgorithmException e) {
             LOG.failedToGetCredentialForCluster( clusterName, e );
-          } catch (UnsupportedEncodingException e) {
-            LOG.failedToGetCredentialForCluster( clusterName, e );
-           }
-  
+          }
+
         }
       }
       return credential;

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-server/src/test/java/org/apache/knox/gateway/TempletonDemo.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/TempletonDemo.java b/gateway-server/src/test/java/org/apache/knox/gateway/TempletonDemo.java
index d39a4c1..24ec0ae 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/TempletonDemo.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/TempletonDemo.java
@@ -33,7 +33,7 @@ import org.junit.experimental.categories.Category;
 
 import java.io.IOException;
 import java.net.URL;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -59,7 +59,7 @@ public class TempletonDemo {
     parameters.add( new BasicNameValuePair( "class", "org.apache.org.apache.hadoop.examples.WordCount" ) );
     parameters.add( new BasicNameValuePair( "arg", "wordcount/input" ) );
     parameters.add( new BasicNameValuePair( "arg", "wordcount/output" ) );
-    UrlEncodedFormEntity entity = new UrlEncodedFormEntity( parameters, Charset.forName( "UTF-8" ) );
+    UrlEncodedFormEntity entity = new UrlEncodedFormEntity( parameters, StandardCharsets.UTF_8 );
     HttpPost request = new HttpPost( url );
     request.setEntity( entity );
 

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-server/src/test/java/org/apache/knox/gateway/jetty/SslSocketTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/jetty/SslSocketTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/jetty/SslSocketTest.java
index 7725219..d21e8fd 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/jetty/SslSocketTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/jetty/SslSocketTest.java
@@ -108,7 +108,7 @@ public class SslSocketTest {
 
     HttpParams params = new BasicHttpParams();
     HttpProtocolParams.setVersion( params, HttpVersion.HTTP_1_1 );
-    HttpProtocolParams.setContentCharset( params, "utf-8" );
+    HttpProtocolParams.setContentCharset( params, StandardCharsets.UTF_8.name() );
     params.setBooleanParameter( "http.protocol.expect-continue", false );
 
     SSLSocketFactory sslsocketfactory = SSLSocketFactory.getSocketFactory();

http://git-wip-us.apache.org/repos/asf/knox/blob/4961cd13/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java b/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
index 96e390b..1fe3a8b 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
@@ -26,6 +26,7 @@ import org.apache.knox.gateway.services.security.AliasService;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -173,7 +174,7 @@ public class LocalFileSystemRemoteConfigurationRegistryClientService implements
 
             @Override
             public String getEntryData(String path) {
-                return getEntryData(path, "UTF-8");
+                return getEntryData(path, StandardCharsets.UTF_8.name());
             }
 
             @Override
@@ -197,7 +198,7 @@ public class LocalFileSystemRemoteConfigurationRegistryClientService implements
 
             @Override
             public void createEntry(String path, String data) {
-                createEntry(path, data, "UTF-8");
+                createEntry(path, data, StandardCharsets.UTF_8.name());
             }
 
             @Override
@@ -216,7 +217,7 @@ public class LocalFileSystemRemoteConfigurationRegistryClientService implements
 
             @Override
             public int setEntryData(String path, String data) {
-                setEntryData(path, data, "UTF-8");
+                setEntryData(path, data, StandardCharsets.UTF_8.name());
                 return 0;
             }