You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/11/03 13:36:24 UTC

svn commit: r1712280 [1/3] - in /webservices/wss4j/branches/2_1_x-fixes: integration/src/test/java/org/apache/wss4j/integration/test/kerberos/ policy/src/test/java/org/apache/wss4j/policy/tests/ ws-security-common/src/main/java/org/apache/wss4j/common/...

Author: coheigea
Date: Tue Nov  3 12:36:23 2015
New Revision: 1712280

URL: http://svn.apache.org/viewvc?rev=1712280&view=rev
Log:
Using StandardCharset.UTF_8 instead of string literal

Modified:
    webservices/wss4j/branches/2_1_x-fixes/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java
    webservices/wss4j/branches/2_1_x-fixes/policy/src/test/java/org/apache/wss4j/policy/tests/AbstractTestBase.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/DerivedKeyUtils.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/AttachmentUtils.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/InboundWSSec.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/utils/WSSUtils.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AttachmentTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/DerivedKeyTokenTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/EncDecryptionTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/HeaderOrderingTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/InteroperabilityTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/MultipleActionTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/OutputChainTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/PasswordEncryptorTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SecurityContextTokenTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureConfirmationTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureEncryptionTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/SignatureTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/TimestampTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/UsernameTokenTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/XOPAttachmentTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenSVTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlConditionsTest.java

Modified: webservices/wss4j/branches/2_1_x-fixes/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java Tue Nov  3 12:36:23 2015
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -190,7 +191,7 @@ public class KerberosTest extends Abstra
             
             // Read in krb5.conf and substitute in the correct port
             Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/kerberos/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/kerberos/krb5.conf");
@@ -753,7 +754,7 @@ public class KerberosTest extends Abstra
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
             OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
-            XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
+            XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>());
             XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml"));
             XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
             xmlStreamWriter.close();
@@ -1020,7 +1021,7 @@ public class KerberosTest extends Abstra
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
             OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
-            XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
+            XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>());
             XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(this.getClass().getClassLoader().getResourceAsStream("testdata/plain-soap-1.1.xml"));
             XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
             xmlStreamWriter.close();

Modified: webservices/wss4j/branches/2_1_x-fixes/policy/src/test/java/org/apache/wss4j/policy/tests/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/policy/src/test/java/org/apache/wss4j/policy/tests/AbstractTestBase.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/policy/src/test/java/org/apache/wss4j/policy/tests/AbstractTestBase.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/policy/src/test/java/org/apache/wss4j/policy/tests/AbstractTestBase.java Tue Nov  3 12:36:23 2015
@@ -22,6 +22,7 @@ import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.InputStreamReader;
 import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 import javax.xml.stream.XMLOutputFactory;
@@ -58,7 +59,7 @@ public abstract class AbstractTestBase e
     }
 
     protected String loadPolicyFile(String classpathResource) throws Exception {
-        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(classpathResource), "UTF-8"));
+        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(classpathResource), StandardCharsets.UTF_8));
         StringWriter writer = new StringWriter();
         char[] buf = new char[1024];
         int n;
@@ -118,6 +119,6 @@ public abstract class AbstractTestBase e
     }
     
     protected Policy loadPolicy(String policy, PolicyBuilder policyBuilder) throws Exception {
-        return policyBuilder.getPolicy(new ByteArrayInputStream(policy.getBytes("UTF-8")));
+        return policyBuilder.getPolicy(new ByteArrayInputStream(policy.getBytes(StandardCharsets.UTF_8)));
     }
 }

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/DerivedKeyUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/DerivedKeyUtils.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/DerivedKeyUtils.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/DerivedKeyUtils.java Tue Nov  3 12:36:23 2015
@@ -18,7 +18,7 @@
  */
 package org.apache.wss4j.common.derivedKey;
 
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.wss4j.common.ext.WSSecurityException;
 
@@ -40,15 +40,11 @@ public final class DerivedKeyUtils {
         throws WSSecurityException {
         DerivationAlgorithm algo = AlgoFactory.getInstance(algorithm);
         byte[] labelBytes;
-        try {
-            if (label == null || label.length() == 0) {
-                String defaultLabel = ConversationConstants.DEFAULT_LABEL + ConversationConstants.DEFAULT_LABEL;
-                labelBytes = defaultLabel.getBytes("UTF-8");
-            } else {
-                labelBytes = label.getBytes("UTF-8");
-            }
-        } catch (UnsupportedEncodingException ex) {
-            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex);
+        if (label == null || label.length() == 0) {
+            String defaultLabel = ConversationConstants.DEFAULT_LABEL + ConversationConstants.DEFAULT_LABEL;
+            labelBytes = defaultLabel.getBytes(StandardCharsets.UTF_8);
+        } else {
+            labelBytes = label.getBytes(StandardCharsets.UTF_8);
         }
 
         byte[] seed = new byte[labelBytes.length + nonce.length];

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/AttachmentUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/AttachmentUtils.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/AttachmentUtils.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/AttachmentUtils.java Tue Nov  3 12:36:23 2015
@@ -30,6 +30,7 @@ import javax.mail.internet.MimeUtility;
 
 import java.io.*;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.security.InvalidAlgorithmParameterException;
 import java.security.InvalidKeyException;
 import java.security.Key;
@@ -160,7 +161,7 @@ public final class AttachmentUtils {
             sortedHeaders.put(MIME_HEADER_CONTENT_TYPE, "text/plain;charset=\"us-ascii\"");
         }
 
-        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(os, "UTF-8");
+        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(os, StandardCharsets.UTF_8);
 
         Iterator<Map.Entry<String, String>> entryIterator = sortedHeaders.entrySet().iterator();
         while (entryIterator.hasNext()) {

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java Tue Nov  3 12:36:23 2015
@@ -19,6 +19,7 @@
 
 package org.apache.wss4j.common.util;
 
+import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
@@ -99,15 +100,7 @@ public final class UsernameTokenUtil {
         byte[] salt, 
         int iteration
     ) throws WSSecurityException {
-        try {
-            return generateDerivedKey(password.getBytes("UTF-8"), salt, iteration);
-        } catch (final java.io.UnsupportedEncodingException e) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(e.getMessage(), e);
-            }
-            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
-                    "empty", new Object[] {"Unable to convert password to UTF-8"});
-        }
+        return generateDerivedKey(password.getBytes(StandardCharsets.UTF_8), salt, iteration);
     }
     
     /**

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java Tue Nov  3 12:36:23 2015
@@ -19,16 +19,21 @@
 
 package org.apache.wss4j.dom.message;
 
-import org.apache.wss4j.dom.WSConstants;
-import org.apache.wss4j.common.ext.WSSecurityException;
-import org.apache.wss4j.common.token.Reference;
-import org.apache.wss4j.common.token.SecurityTokenReference;
-import org.apache.wss4j.common.util.KeyUtils;
+import java.nio.charset.StandardCharsets;
+import java.security.cert.X509Certificate;
+
+import javax.crypto.SecretKey;
+
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoType;
-import org.apache.wss4j.common.derivedKey.ConversationConstants;
 import org.apache.wss4j.common.derivedKey.AlgoFactory;
+import org.apache.wss4j.common.derivedKey.ConversationConstants;
 import org.apache.wss4j.common.derivedKey.DerivationAlgorithm;
+import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.common.token.Reference;
+import org.apache.wss4j.common.token.SecurityTokenReference;
+import org.apache.wss4j.common.util.KeyUtils;
+import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.message.token.DerivedKeyToken;
 import org.apache.wss4j.dom.message.token.KerberosSecurity;
 import org.apache.wss4j.dom.util.WSSecurityUtil;
@@ -36,11 +41,6 @@ import org.apache.xml.security.utils.Bas
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import java.io.UnsupportedEncodingException;
-import java.security.cert.X509Certificate;
-
-import javax.crypto.SecretKey;
-
 /**
  * Base class for DerivedKey encryption and signature
  */
@@ -199,13 +199,8 @@ public abstract class WSSecDerivedKeyBas
         int offset = 0;
         int length = getDerivedKeyLength();
         byte[] label;
-        try {
-            String labelText = clientLabel + serviceLabel;
-            label = labelText.getBytes("UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "empty", 
-                                          new Object[] {"UTF-8 encoding is not supported"});
-        }
+        String labelText = clientLabel + serviceLabel;
+        label = labelText.getBytes(StandardCharsets.UTF_8);
         byte[] nonce = WSSecurityUtil.generateNonce(16);
         
         byte[] seed = new byte[label.length + nonce.length];

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java Tue Nov  3 12:36:23 2015
@@ -19,6 +19,7 @@
 
 package org.apache.wss4j.dom.message.token;
 
+import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.util.HashMap;
 import java.util.Map;
@@ -548,9 +549,9 @@ public class DerivedKeyToken {
             if (label == null || label.length() == 0) {
                 String defaultLabel = ConversationConstants.DEFAULT_LABEL 
                     + ConversationConstants.DEFAULT_LABEL;
-                labelBytes = defaultLabel.getBytes("UTF-8");
+                labelBytes = defaultLabel.getBytes(StandardCharsets.UTF_8);
             } else {
-                labelBytes = label.getBytes("UTF-8");
+                labelBytes = label.getBytes(StandardCharsets.UTF_8);
             }
             
             byte[] nonce = Base64.decode(getNonce());

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java Tue Nov  3 12:36:23 2015
@@ -20,6 +20,7 @@
 package org.apache.wss4j.dom.message.token;
 
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -593,7 +594,7 @@ public class UsernameToken {
         String passwdDigest = null;
         try {
             byte[] b1 = nonce != null ? Base64.decode(nonce) : new byte[0];
-            byte[] b2 = created != null ? created.getBytes("UTF-8") : new byte[0];
+            byte[] b2 = created != null ? created.getBytes(StandardCharsets.UTF_8) : new byte[0];
             byte[] b3 = password;
             byte[] b4 = new byte[b1.length + b2.length + b3.length];
             int offset = 0;
@@ -618,7 +619,7 @@ public class UsernameToken {
     public static String doPasswordDigest(String nonce, String created, String password) {
         String passwdDigest = null;
         try {
-            passwdDigest = doPasswordDigest(nonce, created, password.getBytes("UTF-8"));
+            passwdDigest = doPasswordDigest(nonce, created, password.getBytes(StandardCharsets.UTF_8));
         } catch (Exception e) {
             if (DO_DEBUG) {
                 LOG.debug(e.getMessage(), e);

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java Tue Nov  3 12:36:23 2015
@@ -21,6 +21,7 @@ package org.apache.wss4j.dom.transform;
 
 import java.io.ByteArrayInputStream;
 import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.security.InvalidAlgorithmParameterException;
 import java.security.spec.AlgorithmParameterSpec;
 import java.util.Iterator;
@@ -217,7 +218,7 @@ public class STRTransform extends Transf
             //
             buf = canon.canonicalizeSubtree(dereferencedToken, "#default", true);
             if (LOG.isDebugEnabled()) {
-                LOG.debug("after c14n: " + new String(buf, "UTF-8"));
+                LOG.debug("after c14n: " + new String(buf, StandardCharsets.UTF_8));
             }
 
             if (os != null) {

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java Tue Nov  3 12:36:23 2015
@@ -51,6 +51,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -580,7 +581,7 @@ public final class WSSecurityUtil {
 
         String attachmentId = null;
         try {
-            attachmentId = URLDecoder.decode(xopUri.substring("cid:".length()), "UTF-8");
+            attachmentId = URLDecoder.decode(xopUri.substring("cid:".length()), StandardCharsets.UTF_8.name());
         } catch (UnsupportedEncodingException e) {
             throw new WSSecurityException(
                 WSSecurityException.ErrorCode.INVALID_SECURITY,

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java Tue Nov  3 12:36:23 2015
@@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PushbackInputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -104,7 +105,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -132,7 +133,7 @@ public class AttachmentTest extends org.
         Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty());
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
     }
 
@@ -149,7 +150,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -180,7 +181,7 @@ public class AttachmentTest extends org.
 
                         List<Attachment> attachments = new ArrayList<>();
                         attachment.setSourceStream(new ByteArrayInputStream(
-                                SOAPUtil.SAMPLE_SOAP_MSG.replace("15", "16").getBytes("UTF-8")));
+                                SOAPUtil.SAMPLE_SOAP_MSG.replace("15", "16").getBytes(StandardCharsets.UTF_8)));
                         attachments.add(attachment);
                         attachmentRequestCallback.setAttachments(attachments);
                     }
@@ -205,7 +206,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -233,7 +234,7 @@ public class AttachmentTest extends org.
         Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty());
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
     }
 
@@ -250,7 +251,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -306,14 +307,14 @@ public class AttachmentTest extends org.
         attachment[0].setMimeType("text/xml");
         attachment[0].addHeaders(getHeaders(attachment1Id));
         attachment[0].setId(attachment1Id);
-        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         final String attachment2Id = UUID.randomUUID().toString();
         attachment[1] = new Attachment();
         attachment[1].setMimeType("text/plain");
         attachment[1].addHeaders(getHeaders(attachment2Id));
         attachment[1].setId(attachment2Id);
-        attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Arrays.asList(attachment));
@@ -340,12 +341,12 @@ public class AttachmentTest extends org.
         Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty());
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
         byte[] attachment1Bytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachment1Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachment1Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
 
         responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(1);
         byte[] attachment2Bytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachment2Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachment2Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/plain", responseAttachment.getMimeType());
     }
 
@@ -367,7 +368,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -401,7 +402,7 @@ public class AttachmentTest extends org.
         Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty());
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
 
         Map<String, String> attHeaders = responseAttachment.getHeaders();
@@ -426,7 +427,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -453,7 +454,7 @@ public class AttachmentTest extends org.
         // Different behaviour here for different JDKs...
         try {
             byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-            Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+            Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
             Assert.assertEquals("text/xml", responseAttachment.getMimeType());
     
             Map<String, String> attHeaders = responseAttachment.getHeaders();
@@ -481,7 +482,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -521,7 +522,7 @@ public class AttachmentTest extends org.
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
         
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
 
         Map<String, String> attHeaders = responseAttachment.getHeaders();
@@ -546,7 +547,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -585,7 +586,7 @@ public class AttachmentTest extends org.
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
 
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
 
         Map<String, String> attHeaders = responseAttachment.getHeaders();
@@ -610,7 +611,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -633,7 +634,7 @@ public class AttachmentTest extends org.
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
 
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
 
         Map<String, String> attHeaders = responseAttachment.getHeaders();
@@ -658,7 +659,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -688,7 +689,7 @@ public class AttachmentTest extends org.
         Assert.assertFalse(attachmentCallbackHandler.getResponseAttachments().isEmpty());
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertFalse(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
     }
 
@@ -711,14 +712,14 @@ public class AttachmentTest extends org.
         attachment[0].setMimeType("text/xml");
         attachment[0].addHeaders(getHeaders(attachment1Id));
         attachment[0].setId(attachment1Id);
-        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         final String attachment2Id = UUID.randomUUID().toString();
         attachment[1] = new Attachment();
         attachment[1].setMimeType("text/plain");
         attachment[1].addHeaders(getHeaders(attachment2Id));
         attachment[1].setId(attachment2Id);
-        attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment[1].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Arrays.asList(attachment));
@@ -739,14 +740,14 @@ public class AttachmentTest extends org.
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(0);
 
         byte[] attachment1Bytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachment1Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachment1Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
         Map<String, String> att1Headers = responseAttachment.getHeaders();
         Assert.assertEquals(6, att1Headers.size());
 
         responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(1);
         byte[] attachment2Bytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachment2Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachment2Bytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/plain", responseAttachment.getMimeType());
 
         Map<String, String> att2Headers = responseAttachment.getHeaders();
@@ -771,7 +772,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -811,7 +812,7 @@ public class AttachmentTest extends org.
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(1);
 
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
 
         Map<String, String> attHeaders = responseAttachment.getHeaders();
@@ -837,7 +838,7 @@ public class AttachmentTest extends org.
         attachment[0].setMimeType("text/xml");
         attachment[0].addHeaders(getHeaders(attachmentId));
         attachment[0].setId(attachmentId);
-        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         signature.setAttachmentCallbackHandler(new CallbackHandler() {
             @Override
@@ -936,7 +937,7 @@ public class AttachmentTest extends org.
         attachment.setMimeType("text/xml");
         attachment.addHeaders(getHeaders(attachmentId));
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
@@ -975,7 +976,7 @@ public class AttachmentTest extends org.
         Attachment responseAttachment = attachmentCallbackHandler.getResponseAttachments().get(1);
 
         byte[] attachmentBytes = readInputStream(responseAttachment.getSourceStream());
-        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        Assert.assertTrue(Arrays.equals(attachmentBytes, SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
         Assert.assertEquals("text/xml", responseAttachment.getMimeType());
 
         Map<String, String> attHeaders = responseAttachment.getHeaders();
@@ -1002,7 +1003,7 @@ public class AttachmentTest extends org.
         attachment[0].setMimeType("text/xml");
         attachment[0].addHeaders(getHeaders(attachmentId));
         attachment[0].setId(attachmentId);
-        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes("UTF-8")));
+        attachment[0].setSourceStream(new ByteArrayInputStream(SOAPUtil.SAMPLE_SOAP_MSG.getBytes(StandardCharsets.UTF_8)));
 
         encrypt.setAttachmentCallbackHandler(new CallbackHandler() {
             @Override

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java Tue Nov  3 12:36:23 2015
@@ -19,6 +19,7 @@
 
 package org.apache.wss4j.dom.message;
 
+import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.util.Arrays;
 import java.util.Collections;
@@ -117,7 +118,7 @@ public class UTDerivedKeyTest extends or
     public void testDerivedKeyWithEncodedPasswordBaseline() throws Exception {
         String password = "password";
         // The SHA-1 of the password is known as a password equivalent in the UsernameToken specification.
-        byte[] passwordHash = MessageDigest.getInstance("SHA-1").digest(password.getBytes("UTF-8"));
+        byte[] passwordHash = MessageDigest.getInstance("SHA-1").digest(password.getBytes(StandardCharsets.UTF_8));
 
         byte[] salt = Base64.decode("LKpycbfgRzwDnBz6kkhAAQ==");
         int iteration = 1049;
@@ -188,7 +189,7 @@ public class UTDerivedKeyTest extends or
         
         WSSecUsernameToken builder = new WSSecUsernameToken();
         builder.setPasswordsAreEncoded(true);
-        builder.setUserInfo("bob", Base64.encode(MessageDigest.getInstance("SHA-1").digest("security".getBytes("UTF-8"))));
+        builder.setUserInfo("bob", Base64.encode(MessageDigest.getInstance("SHA-1").digest("security".getBytes(StandardCharsets.UTF_8))));
         builder.addDerivedKey(false, null, 1000);
         builder.prepare(doc);
         
@@ -391,7 +392,7 @@ public class UTDerivedKeyTest extends or
         
         WSSecUsernameToken builder = new WSSecUsernameToken();
         builder.setPasswordsAreEncoded(true);
-        builder.setUserInfo("bob", Base64.encode(MessageDigest.getInstance("SHA-1").digest("security".getBytes("UTF-8"))));
+        builder.setUserInfo("bob", Base64.encode(MessageDigest.getInstance("SHA-1").digest("security".getBytes(StandardCharsets.UTF_8))));
         builder.addDerivedKey(true, null, 1000);
         builder.prepare(doc);
         

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java Tue Nov  3 12:36:23 2015
@@ -20,6 +20,7 @@
 package org.apache.wss4j.dom.message;
 
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.text.DateFormat;
 import java.util.Collections;
@@ -158,7 +159,7 @@ public class UsernameTokenTest extends o
     public void testUsernameTokenWithEncodedPasswordBaseline() throws Exception {
         String password = "password";
         // The SHA-1 of the password is known as a password equivalent in the UsernameToken specification.
-        byte[] passwordHash = MessageDigest.getInstance("SHA-1").digest(password.getBytes("UTF-8"));
+        byte[] passwordHash = MessageDigest.getInstance("SHA-1").digest(password.getBytes(StandardCharsets.UTF_8));
 
         String nonce = "0x7bXAPZVn40AdCD0Xbt0g==";
         String created = "2010-06-28T15:16:37Z";
@@ -174,7 +175,7 @@ public class UsernameTokenTest extends o
     public void testUsernameTokenWithEncodedPassword() throws Exception {
         WSSecUsernameToken builder = new WSSecUsernameToken();
         builder.setPasswordsAreEncoded(true);
-        builder.setUserInfo("wernerd", Base64.encode(MessageDigest.getInstance("SHA-1").digest("verySecret".getBytes("UTF-8"))));
+        builder.setUserInfo("wernerd", Base64.encode(MessageDigest.getInstance("SHA-1").digest("verySecret".getBytes(StandardCharsets.UTF_8))));
         LOG.info("Before adding UsernameToken PW Digest....");
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java Tue Nov  3 12:36:23 2015
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -114,7 +115,7 @@ public class XOPAttachmentTest extends o
         String attachmentId = UUID.randomUUID().toString();
         final Attachment attachment = new Attachment();
         attachment.setId(attachmentId);
-        attachment.setSourceStream(new ByteArrayInputStream(SOAP_BODY.getBytes("UTF-8")));
+        attachment.setSourceStream(new ByteArrayInputStream(SOAP_BODY.getBytes(StandardCharsets.UTF_8)));
 
         AttachmentCallbackHandler attachmentCallbackHandler = 
             new AttachmentCallbackHandler(Collections.singletonList(attachment));

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java Tue Nov  3 12:36:23 2015
@@ -53,6 +53,8 @@ import javax.xml.parsers.ParserConfigura
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.KeyStore;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
@@ -93,7 +95,7 @@ public class AbstractPolicyTestBase exte
                 this.getClass().getClassLoader().getResourceAsStream("testdata/wsdl/wsdl-template.wsdl"));
         NodeList nodeList = document.getElementsByTagNameNS("*", SPConstants.P_LOCALNAME);
 
-        Document policyDocument = documentBuilder.parse(new ByteArrayInputStream(policyString.getBytes("UTF-8")));
+        Document policyDocument = documentBuilder.parse(new ByteArrayInputStream(policyString.getBytes(StandardCharsets.UTF_8)));
         Node policyNode = document.importNode(policyDocument.getDocumentElement(), true);
         Element element = (Element) nodeList.item(0);
         if (replacePolicyElement) {
@@ -177,7 +179,7 @@ public class AbstractPolicyTestBase exte
         return new ECKeyValueSecurityTokenImpl(ecKeyValueType, null, null);
     }
 
-    protected String loadResourceAsString(String resource, String encoding) throws IOException {
+    protected String loadResourceAsString(String resource, Charset encoding) throws IOException {
         InputStreamReader inputStreamReader = new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(resource), encoding);
         StringBuilder stringBuilder = new StringBuilder();
         int read = 0;

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java Tue Nov  3 12:36:23 2015
@@ -28,6 +28,7 @@ import org.apache.wss4j.stax.test.Inboun
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 public class WSP13SpecTest extends AbstractPolicyTestBase {
@@ -37,7 +38,7 @@ public class WSP13SpecTest extends Abstr
     @Test
     public void testTransportBindingC11a() throws Exception {
         {
-            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -45,7 +46,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(null, null, null, policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", StandardCharsets.UTF_8);
 
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
@@ -53,7 +54,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.HttpsToken, 2, "Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}HttpsToken not satisfied", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", StandardCharsets.UTF_8);
 
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
@@ -61,7 +62,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.RequiredElement, 4, "Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp must be present", policyEnforcer, securityEventList);
             }
         {
-            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", StandardCharsets.UTF_8);
 
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
@@ -69,7 +70,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.UsernameToken, 0, "Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken not satisfied", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/transportBindingPolicyC11.xml", StandardCharsets.UTF_8);
 
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
@@ -81,7 +82,7 @@ public class WSP13SpecTest extends Abstr
     @Test
     public void testAsymmetricBindingC31a() throws Exception {
         {
-            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -89,7 +90,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(null, null, null, policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -97,7 +98,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.RequiredElement, 8, "Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp must be present", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -105,7 +106,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(SecurityEventConstants.X509Token, 0, "Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}X509Token not satisfied", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/asymmetricBindingPolicyC31.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -117,7 +118,7 @@ public class WSP13SpecTest extends Abstr
     @Test
     public void testSymmetricBindingC21a() throws Exception {
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -125,7 +126,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(null, null, null, policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -133,7 +134,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.RequiredElement, 4, "Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp must be present", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -141,7 +142,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.SamlToken, -1, "Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}IssuedToken not satisfied", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -149,7 +150,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.UsernameToken, 0, "Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken not satisfied", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21a.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -161,7 +162,7 @@ public class WSP13SpecTest extends Abstr
     @Test
     public void testSymmetricBindingC21b() throws Exception {
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -169,7 +170,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(null, null, null, policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -177,7 +178,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.RequiredElement, 4, "Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp must be present", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -185,7 +186,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.SamlToken, -1, "Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}IssuedToken not satisfied", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     
@@ -193,7 +194,7 @@ public class WSP13SpecTest extends Abstr
             applyPolicy(WSSecurityEventConstants.UsernameToken, 0, "Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken not satisfied", policyEnforcer, securityEventList);
         }
         {
-            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", "UTF-8");
+            String policyString = loadResourceAsString("testdata/policy/symmetricBindingPolicyC21b.xml", StandardCharsets.UTF_8);
     
             PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
     

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java Tue Nov  3 12:36:23 2015
@@ -18,7 +18,7 @@
  */
 package org.apache.wss4j.stax.impl.processor.output;
 
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
@@ -93,14 +93,8 @@ public class DerivedKeyTokenOutputProces
                 }
             }
 
-            byte[] label;
-            try {
-                String defaultLabel = WSSConstants.WS_SecureConversation_DEFAULT_LABEL + WSSConstants.WS_SecureConversation_DEFAULT_LABEL;
-                label = defaultLabel.getBytes("UTF-8");
-            } catch (UnsupportedEncodingException e) {
-                throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "empty", 
-                                              new Object[] {"UTF-8 encoding is not supported"});
-            }
+            String defaultLabel = WSSConstants.WS_SecureConversation_DEFAULT_LABEL + WSSConstants.WS_SecureConversation_DEFAULT_LABEL;
+            byte[] label = defaultLabel.getBytes(StandardCharsets.UTF_8);
 
             byte[] nonce = WSSConstants.generateBytes(16);
 

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/InboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/InboundWSSec.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/InboundWSSec.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/InboundWSSec.java Tue Nov  3 12:36:23 2015
@@ -18,6 +18,7 @@
  */
 package org.apache.wss4j.stax.setup;
 
+import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -240,7 +241,7 @@ public class InboundWSSec {
         securityContextImpl.put(WSSConstants.XMLINPUTFACTORY, xmlInputFactory);
 
         DocumentContextImpl documentContext = new DocumentContextImpl();
-        documentContext.setEncoding(xmlStreamReader.getEncoding() != null ? xmlStreamReader.getEncoding() : "UTF-8");
+        documentContext.setEncoding(xmlStreamReader.getEncoding() != null ? xmlStreamReader.getEncoding() : StandardCharsets.UTF_8.name());
         InputProcessorChainImpl inputProcessorChain = new InputProcessorChainImpl(securityContextImpl, documentContext);
         inputProcessorChain.addProcessor(new XMLEventReaderInputProcessor(securityProperties, xmlStreamReader));
         inputProcessorChain.addProcessor(new SecurityHeaderInputProcessor(securityProperties));

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/utils/WSSUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/utils/WSSUtils.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/utils/WSSUtils.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/utils/WSSUtils.java Tue Nov  3 12:36:23 2015
@@ -19,7 +19,7 @@
 package org.apache.wss4j.stax.utils;
 
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -117,8 +117,8 @@ public class WSSUtils extends XMLSecurit
     public static String doPasswordDigest(byte[] nonce, String created, String password) throws WSSecurityException {
         try {
             byte[] b1 = nonce != null ? nonce : new byte[0];
-            byte[] b2 = created != null ? created.getBytes("UTF-8") : new byte[0];
-            byte[] b3 = password.getBytes("UTF-8");
+            byte[] b2 = created != null ? created.getBytes(StandardCharsets.UTF_8) : new byte[0];
+            byte[] b3 = password.getBytes(StandardCharsets.UTF_8);
             byte[] b4 = new byte[b1.length + b2.length + b3.length];
             int offset = 0;
             System.arraycopy(b1, 0, b4, offset, b1.length);
@@ -135,8 +135,6 @@ public class WSSUtils extends XMLSecurit
             return new String(Base64.encodeBase64(sha.digest()));
         } catch (NoSuchAlgorithmException e) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "decoding.general");
-        } catch (UnsupportedEncodingException e) {
-            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
         }
     }
 

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java?rev=1712280&r1=1712279&r2=1712280&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java Tue Nov  3 12:36:23 2015
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -161,7 +162,7 @@ public abstract class AbstractTestBase e
             throws Exception {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
-        XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
+        XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>());
         XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument);
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
@@ -173,7 +174,7 @@ public abstract class AbstractTestBase e
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WSSSecurityProperties securityProperties = ConfigurationConverter.convert(config);
         OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
-        XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, "UTF-8", new ArrayList<SecurityEvent>());
+        XMLStreamWriter xmlStreamWriter = wsSecOut.processOutMessage(baos, StandardCharsets.UTF_8.name(), new ArrayList<SecurityEvent>());
         XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument);
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();