You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2017/08/02 16:57:42 UTC

svn commit: r1803868 [2/4] - in /santuario/xml-security-java/trunk: ./ src/main/java/org/apache/xml/security/c14n/ src/main/java/org/apache/xml/security/encryption/ src/main/java/org/apache/xml/security/signature/ src/main/java/org/apache/xml/security/...

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java Wed Aug  2 16:57:41 2017
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.encryption;
 
 import java.io.File;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.KeyFactory;
 import java.security.NoSuchAlgorithmException;
@@ -100,9 +101,9 @@ public class BaltimoreEncTest extends or
         nodeCount = countNodes(doc);
 
         // Create the keys
-        jebBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
-        jobBytes = "abcdefghijklmnop".getBytes("ASCII");
-        jedBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes("ASCII");
+        jebBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
+        jobBytes = "abcdefghijklmnop".getBytes(StandardCharsets.US_ASCII);
+        jedBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes(StandardCharsets.US_ASCII);
 
         // Certificate information
         rsaCertSerialNumber = "1014918766910";
@@ -614,7 +615,7 @@ public class BaltimoreEncTest extends or
      * Check a decrypt of data was OK
      */
     private void checkDecryptedData(byte[] data) throws Exception {
-        String input = new String(data, "ASCII");
+        String input = new String(data, StandardCharsets.US_ASCII);
         assertEquals(testDecryptString, input);
     }
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java Wed Aug  2 16:57:41 2017
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.encryption;
 
 import java.security.cert.X509Certificate;
+import java.nio.charset.StandardCharsets;
 import java.security.PublicKey;
 import javax.crypto.SecretKey;
 import javax.crypto.SecretKeyFactory;
@@ -117,7 +118,7 @@ public class BobKeyResolver extends KeyR
         if (engineCanResolve(element, BaseURI, storage)) {
             try {
                 DESedeKeySpec keySpec =
-                    new DESedeKeySpec("abcdefghijklmnopqrstuvwx".getBytes("ASCII"));
+                    new DESedeKeySpec("abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII));
                 SecretKeyFactory keyFactory =
                     SecretKeyFactory.getInstance("DESede");
                 SecretKey key = keyFactory.generateSecret(keySpec);

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java Wed Aug  2 16:57:41 2017
@@ -20,6 +20,7 @@ package org.apache.xml.security.test.dom
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.security.NoSuchAlgorithmException;
 
 import javax.crypto.Cipher;
@@ -114,7 +115,7 @@ public class EncryptContentTest extends
         }
 
         Document doc = null;
-        try (InputStream is = new ByteArrayInputStream(DATA.getBytes("UTF8"))) {
+        try (InputStream is = new ByteArrayInputStream(DATA.getBytes(StandardCharsets.UTF_8))) {
             doc = db.parse(is);
         }
         NodeList dataToEncrypt = doc.getElementsByTagName("user");
@@ -166,7 +167,7 @@ public class EncryptContentTest extends
         }
 
         Document doc = null;
-        try (InputStream is = new ByteArrayInputStream(MULTIPLE_USER_DATA.getBytes("UTF8"))) {
+        try (InputStream is = new ByteArrayInputStream(MULTIPLE_USER_DATA.getBytes(StandardCharsets.UTF_8))) {
             doc = db.parse(is);
         }
         NodeList dataToEncrypt = doc.getElementsByTagName("user");

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java Wed Aug  2 16:57:41 2017
@@ -42,6 +42,7 @@ import javax.xml.xpath.XPathFactory;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.lang.reflect.Field;
+import java.nio.charset.StandardCharsets;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.PrivateKey;
@@ -101,7 +102,7 @@ public class SignedEncryptedTest extends
     public void secureAndVerify(TransformerFactory transformerFactory, boolean useDocumentSerializer) throws Exception {
         DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
         Document document = null;
-        try (InputStream is = new ByteArrayInputStream(SAMPLE_MSG.getBytes("UTF8"))) {
+        try (InputStream is = new ByteArrayInputStream(SAMPLE_MSG.getBytes(StandardCharsets.UTF_8))) {
             document = builder.parse(is);
         }
 

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java Wed Aug  2 16:57:41 2017
@@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.KeyPairGenerator;
 import java.security.KeyPair;
@@ -701,13 +702,13 @@ public class XMLCipherTest extends org.j
 
             // Now the decrypt, with a brand new cipher
             XMLCipher cipherDecrypt = XMLCipher.getInstance();
-            Key key = new SecretKeySpec("abcdefghijklmnop".getBytes("ASCII"), "AES");
+            Key key = new SecretKeySpec("abcdefghijklmnop".getBytes(StandardCharsets.US_ASCII), "AES");
 
             cipherDecrypt.init(XMLCipher.DECRYPT_MODE, key);
             byte[] decryptBytes = cipherDecrypt.decryptToByteArray(ee);
 
             assertEquals("A test encrypted secret",
-                        new String(decryptBytes, "ASCII"));
+                        new String(decryptBytes, StandardCharsets.US_ASCII));
         } else {
             LOG.warn(
                 "Test testSameDocumentCipherReference skipped as "
@@ -734,7 +735,7 @@ public class XMLCipherTest extends org.j
             // Test unused namespaces are preserved
             final String DATA1 = "<ns:root xmlns:ns=\"ns.com\"><ns:elem xmlns:ns2=\"ns2.com\">11</ns:elem></ns:root>";
             Document doc = null;
-            try (InputStream is = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
+            try (InputStream is = new ByteArrayInputStream(DATA1.getBytes(StandardCharsets.UTF_8))) {
                 doc = db.parse(is);
             }
             Element elem = (Element)doc.getDocumentElement().getFirstChild();
@@ -760,7 +761,7 @@ public class XMLCipherTest extends org.j
 
             // Test default namespace undeclaration is preserved
             final String DATA2 = "<ns:root xmlns=\"defns.com\" xmlns:ns=\"ns.com\"><elem xmlns=\"\">11</elem></ns:root>";
-            try (InputStream is = new ByteArrayInputStream(DATA2.getBytes("UTF8"))) {
+            try (InputStream is = new ByteArrayInputStream(DATA2.getBytes(StandardCharsets.UTF_8))) {
                 doc = db.parse(is);
             }
             elem = (Element)doc.getDocumentElement().getFirstChild();
@@ -787,7 +788,7 @@ public class XMLCipherTest extends org.j
             // Test comments and PIs are not treated specially when serializing element content.
             // Other c14n algorithms add a newline after comments and PIs, when they are before or after the document element.
             final String DATA3 = "<root><!--comment1--><?pi1 target1?><elem/><!--comment2--><?pi2 target2?></root>";
-            try (InputStream is = new ByteArrayInputStream(DATA3.getBytes("UTF8"))) {
+            try (InputStream is = new ByteArrayInputStream(DATA3.getBytes(StandardCharsets.UTF_8))) {
                 doc = db.parse(is);
             }
             elem = (Element)doc.getDocumentElement();
@@ -853,7 +854,7 @@ public class XMLCipherTest extends org.j
         canon.notReset();
         canon.canonicalizeSubtree(e);
         baos.close();
-        String before = baos.toString("UTF-8");
+        String before = baos.toString(StandardCharsets.UTF_8.name());
 
         byte[] serialized = baos.toByteArray();
         EncryptedData encryptedData = null;
@@ -867,7 +868,7 @@ public class XMLCipherTest extends org.j
         String algorithm = encryptedData.getEncryptionMethod().getAlgorithm();
         assertEquals(XMLCipher.AES_128, algorithm);
         byte[] bytes = dcipher.decryptToByteArray(dcipher.martial(encryptedData));
-        String after = new String(bytes, "UTF-8");
+        String after = new String(bytes, StandardCharsets.UTF_8);
         assertEquals(before, after);
 
         // test with null type
@@ -1003,7 +1004,7 @@ public class XMLCipherTest extends org.j
         baos.write(serBytes);
         baos.close();
 
-        return baos.toString("UTF-8");
+        return baos.toString(StandardCharsets.UTF_8.name());
     }
 
     private Document document() {

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java Wed Aug  2 16:57:41 2017
@@ -525,7 +525,7 @@ public class XMLEncryption11Test extends
                     "http://www.w3.org/2009/xmlenc11#rsa-oaep",
                     "http://www.w3.org/2001/04/xmlenc#sha512",
                     "http://www.w3.org/2009/xmlenc11#mgf1sha1",
-                    Base64.getMimeDecoder().decode("ZHVtbXkxMjM=".getBytes("UTF-8"))
+                    Base64.getMimeDecoder().decode("ZHVtbXkxMjM=".getBytes(java.nio.charset.StandardCharsets.UTF_8))
                 );
 
             doc =

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/BaltimoreTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/BaltimoreTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/BaltimoreTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/BaltimoreTest.java Wed Aug  2 16:57:41 2017
@@ -20,6 +20,9 @@ package org.apache.xml.security.test.dom
 
 import org.apache.xml.security.test.dom.utils.resolver.OfflineResolver;
 import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
+
+import java.nio.charset.StandardCharsets;
+
 import org.apache.xml.security.signature.XMLSignatureException;
 
 /**
@@ -69,7 +72,7 @@ public class BaltimoreTest extends Inter
 
         String filename = merlinsDir15 + "signature-enveloping-hmac-sha1.xml";
         boolean verify = this.verifyHMAC(filename, new OfflineResolver(), false,
-                                         "secret".getBytes("ASCII"));
+                                         "secret".getBytes(StandardCharsets.US_ASCII));
 
         if (!verify) {
             LOG.error("Verification failed for " + filename);
@@ -89,7 +92,7 @@ public class BaltimoreTest extends Inter
         String filename = merlinsDir15 + "signature-enveloping-hmac-sha1-40.xml";
         ResourceResolverSpi resolver = new OfflineResolver();
         boolean followManifests = false;
-        byte[] hmacKey = "secret".getBytes("ASCII");
+        byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
 
         try {
             this.verifyHMAC(filename, resolver, followManifests, hmacKey);
@@ -335,7 +338,7 @@ public class BaltimoreTest extends Inter
 
         String filename = merlinsDir23 + "signature-enveloping-hmac-sha1.xml";
         boolean verify = this.verifyHMAC(filename, new OfflineResolver(), false,
-                                         "secret".getBytes("ASCII"));
+                                         "secret".getBytes(StandardCharsets.US_ASCII));
 
         if (!verify) {
             LOG.error("Verification failed for " + filename);
@@ -355,7 +358,7 @@ public class BaltimoreTest extends Inter
         String filename = merlinsDir23 + "signature-enveloping-hmac-sha1-40.xml";
         ResourceResolverSpi resolver = new OfflineResolver();
         boolean followManifests = false;
-        byte[] hmacKey = "secret".getBytes("ASCII");
+        byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
 
         try {
             this.verifyHMAC(filename, resolver, followManifests, hmacKey);

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java Wed Aug  2 16:57:41 2017
@@ -19,6 +19,9 @@
 package org.apache.xml.security.test.dom.interop;
 
 import org.apache.xml.security.test.dom.utils.resolver.OfflineResolver;
+
+import java.nio.charset.StandardCharsets;
+
 import org.apache.xml.security.signature.XMLSignatureException;
 import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
 import org.apache.xml.security.utils.resolver.implementations.ResolverAnonymous;
@@ -66,7 +69,7 @@ public class IAIKTest extends InteropTes
             gregorsDir + "signatureAlgorithms/signatures/hMACShortSignature.xml";
         ResourceResolverSpi resolver = new OfflineResolver();
         boolean followManifests = false;
-        byte[] hmacKey = "secret".getBytes("ASCII");
+        byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
 
         try {
             this.verifyHMAC(filename, resolver, followManifests, hmacKey);
@@ -93,7 +96,7 @@ public class IAIKTest extends InteropTes
         String filename = gregorsDir + "signatureAlgorithms/signatures/hMACSignature.xml";
         ResourceResolverSpi resolver = new OfflineResolver();
         boolean followManifests = false;
-        byte[] hmacKey = "secret".getBytes("ASCII");
+        byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
         boolean verify = false;
 
         try {

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java Wed Aug  2 16:57:41 2017
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.signature;
 
 import java.io.File;
+import java.nio.charset.StandardCharsets;
 
 import javax.crypto.SecretKey;
 
@@ -80,7 +81,7 @@ public class HMACOutputLengthTest extend
                 40, Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS
             );
         try {
-            sig.sign(getSecretKey("secret".getBytes("ASCII")));
+            sig.sign(getSecretKey("secret".getBytes(StandardCharsets.US_ASCII)));
             fail("Expected HMACOutputLength Exception");
         } catch (XMLSignatureException xse) {
             // System.out.println(xse.getMessage());
@@ -103,7 +104,7 @@ public class HMACOutputLengthTest extend
         }
         Element sigElement = (Element) nl.item(0);
         XMLSignature signature = new XMLSignature(sigElement, file.toURI().toString());
-        SecretKey sk = signature.createSecretKey("secret".getBytes("ASCII"));
+        SecretKey sk = signature.createSecretKey("secret".getBytes(StandardCharsets.US_ASCII));
         return signature.checkSignatureValue(sk);
     }
 

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/XMLSignatureInputTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/XMLSignatureInputTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/XMLSignatureInputTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/XMLSignatureInputTest.java Wed Aug  2 16:57:41 2017
@@ -86,7 +86,7 @@ public class XMLSignatureInputTest exten
     public void testSetOctetStreamGetOctetStream()
         throws IOException, CanonicalizationException, InvalidCanonicalizerException {
         InputStream inputStream =
-            new ByteArrayInputStream(_octetStreamTextInput.getBytes("UTF-8"));
+            new ByteArrayInputStream(_octetStreamTextInput.getBytes(java.nio.charset.StandardCharsets.UTF_8));
         XMLSignatureInput input = new XMLSignatureInput(inputStream);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         InputStream res = input.getOctetStream();
@@ -101,7 +101,7 @@ public class XMLSignatureInputTest exten
         }
 
         byte resBytes[] = baos.toByteArray();
-        String resString = new String(resBytes, "UTF-8");
+        String resString = new String(resBytes, java.nio.charset.StandardCharsets.UTF_8);
 
         assertTrue(resString.equals(_octetStreamTextInput));
     }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java Wed Aug  2 16:57:41 2017
@@ -78,7 +78,7 @@ public class EmptyNamespaceTest {
         transformer.setProperties(properties);
 
         try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-            InputStream stream = new ByteArrayInputStream(message.getBytes("UTF-8"))) {
+            InputStream stream = new ByteArrayInputStream(message.getBytes(java.nio.charset.StandardCharsets.UTF_8))) {
             transformer.setOutputStream(outputStream);
 
             transformer.transform(stream);
@@ -101,7 +101,7 @@ public class EmptyNamespaceTest {
         documentBuilderFactory.setValidating(false);
         final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
         Document document = null;
-        try (InputStream is = new ByteArrayInputStream(message.getBytes("UTF-8"))) {
+        try (InputStream is = new ByteArrayInputStream(message.getBytes(java.nio.charset.StandardCharsets.UTF_8))) {
             document = documentBuilder.parse(is);
         }
 
@@ -109,7 +109,7 @@ public class EmptyNamespaceTest {
         byte[] output =
                 transformer.engineCanonicalizeSubTree(document, inclusiveNamespaces);
 
-        String result = new String(output, "UTF-8");
+        String result = new String(output, java.nio.charset.StandardCharsets.UTF_8);
         Assert.assertEquals(message, result);
     }
 }
\ No newline at end of file

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamReaderTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamReaderTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamReaderTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamReaderTest.java Wed Aug  2 16:57:41 2017
@@ -44,6 +44,7 @@ import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -93,7 +94,7 @@ public class XMLSecurityStreamReaderTest
         javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         transformer.transform(new StAXSource(xmlSecurityStreamReader), new StreamResult(baos));
-        XMLAssert.assertXMLEqual(readTestFile(), baos.toString("UTF-8"));
+        XMLAssert.assertXMLEqual(readTestFile(), baos.toString(StandardCharsets.UTF_8.name()));
     }
 
     @Test
@@ -101,7 +102,7 @@ public class XMLSecurityStreamReaderTest
         XMLSecurityProperties securityProperties = new XMLSecurityProperties();
         InboundSecurityContextImpl securityContext = new InboundSecurityContextImpl();
         DocumentContextImpl documentContext = new DocumentContextImpl();
-        documentContext.setEncoding("UTF-8");
+        documentContext.setEncoding(StandardCharsets.UTF_8.name());
         InputProcessorChainImpl inputProcessorChain = new InputProcessorChainImpl(securityContext, documentContext);
         inputProcessorChain.addProcessor(new EventReaderProcessor());
         XMLSecurityStreamReader xmlSecurityStreamReader = new XMLSecurityStreamReader(inputProcessorChain, securityProperties);

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamWriterTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamWriterTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamWriterTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamWriterTest.java Wed Aug  2 16:57:41 2017
@@ -38,6 +38,7 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamWriter;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.util.*;
 
 /**
@@ -90,8 +91,8 @@ public class XMLSecurityStreamWriterTest
 
         xmlSecurityStreamWriter.setNamespaceContext(namespaceContext);
         stdXmlStreamWriter.setNamespaceContext(namespaceContext);
-        xmlSecurityStreamWriter.writeStartDocument("UTF-8", "1.0");
-        stdXmlStreamWriter.writeStartDocument("UTF-8", "1.0");
+        xmlSecurityStreamWriter.writeStartDocument(StandardCharsets.UTF_8.name(), "1.0");
+        stdXmlStreamWriter.writeStartDocument(StandardCharsets.UTF_8.name(), "1.0");
 
         xmlSecurityStreamWriter.writeDTD("<!DOCTYPE foobar [\n\t<!ENTITY x0 \"hello\">\n]>");
         stdXmlStreamWriter.writeDTD("<!DOCTYPE foobar [\n\t<!ENTITY x0 \"hello\">\n]>");

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java Wed Aug  2 16:57:41 2017
@@ -35,6 +35,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 /**
  */
@@ -244,9 +245,9 @@ public class Canonicalizer11Test extends
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
         }
 
         assertTrue(equals);
@@ -635,7 +636,7 @@ public class Canonicalizer11Test extends
         // if everything is OK, result is true; we do a binary compare, byte by byte
         boolean result = java.security.MessageDigest.isEqual(refBytes, baos.toByteArray());
         if (!result) {
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), new String(refBytes, "UTF-8"));
+            assertEquals(new String(baos.toByteArray(), StandardCharsets.UTF_8), new String(refBytes, StandardCharsets.UTF_8));
         }
         assertTrue(result);
     }
@@ -673,7 +674,7 @@ public class Canonicalizer11Test extends
 //   public static byte[] convertToUTF16(byte input[]) throws Exception {
 //
 //      //String ENCODING_ISO8859_1 = "ISO-8859-1";
-//      //String ENCODING_UTF8 = "UTF-8";
+//      //String ENCODING_UTF8 = java.nio.charset.StandardCharsets.UTF_8;
 //      String ENCODING_UTF16 = "UTF-16";
 //      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 //      DocumentBuilder db = dbf.newDocumentBuilder();

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java Wed Aug  2 16:57:41 2017
@@ -90,9 +90,9 @@ public class Canonicalizer20010315Exclus
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, java.nio.charset.StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
         }
 
         assertTrue(equals);
@@ -117,9 +117,9 @@ public class Canonicalizer20010315Exclus
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, java.nio.charset.StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
         }
 
         assertTrue(equals);
@@ -144,9 +144,9 @@ public class Canonicalizer20010315Exclus
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, java.nio.charset.StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
         }
 
         assertTrue(equals);
@@ -171,9 +171,9 @@ public class Canonicalizer20010315Exclus
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, java.nio.charset.StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
         }
         assertTrue(equals);
     }
@@ -221,7 +221,7 @@ public class Canonicalizer20010315Exclus
 
         canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-        assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+        assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
     }
 
     /**
@@ -310,7 +310,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
         }
 
         {
@@ -325,7 +325,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
         }
     }
 
@@ -386,7 +386,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML1);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML1);
         }
         {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -399,7 +399,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML2);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML2);
         }
     }
 
@@ -448,7 +448,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
         }
         {
             //exactly the same outcome is expected if #default is not set:
@@ -462,7 +462,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
         }
     }
 
@@ -511,7 +511,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
         }
         {
             //exactly the same outcome is expected if #default is not set:
@@ -525,7 +525,7 @@ public class Canonicalizer20010315Exclus
             c.setOutputStream(baos);
             canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+            assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
         }
     }
 
@@ -572,7 +572,7 @@ public class Canonicalizer20010315Exclus
         c.setOutputStream(baos);
         canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-        assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+        assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
     }
 
     @org.junit.Test
@@ -614,7 +614,7 @@ public class Canonicalizer20010315Exclus
         c.setOutputStream(baos);
         canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-        assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+        assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
     }
 
     @org.junit.Test
@@ -656,7 +656,7 @@ public class Canonicalizer20010315Exclus
         c.setOutputStream(baos);
         canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-        assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+        assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
     }
 
     @org.junit.Test
@@ -698,7 +698,7 @@ public class Canonicalizer20010315Exclus
         c.setOutputStream(baos);
         canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
 
-        assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+        assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
     }
 
     @org.junit.Test
@@ -735,7 +735,7 @@ public class Canonicalizer20010315Exclus
         c.setOutputStream(baos);
         canonicalize(c, new StringReader(XML), new QName("http://xmlsoap.org/Ping", "Ping"));
 
-        assertEquals(new String(baos.toByteArray(), "UTF-8"), c14nXML);
+        assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
     }
 
     private void canonicalize(

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java Wed Aug  2 16:57:41 2017
@@ -36,6 +36,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 /**
  */
@@ -89,9 +90,9 @@ public class Canonicalizer20010315Test e
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
         }
 
         assertTrue(equals);
@@ -131,9 +132,9 @@ public class Canonicalizer20010315Test e
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
         }
 
         assertTrue(equals);
@@ -396,9 +397,9 @@ public class Canonicalizer20010315Test e
         boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
 
         if (!equals) {
-            System.out.println("Expected:\n" + new String(reference, "UTF-8"));
+            System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
             System.out.println("");
-            System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+            System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
         }
 
         assertTrue(equals);
@@ -712,7 +713,7 @@ public class Canonicalizer20010315Test e
         // if everything is OK, result is true; we do a binary compare, byte by byte
         boolean result = java.security.MessageDigest.isEqual(refBytes, baos.toByteArray());
         if (!result) {
-            assertEquals(new String(baos.toByteArray(), "UTF-8"), new String(refBytes, "UTF-8"));
+            assertEquals(new String(baos.toByteArray(), StandardCharsets.UTF_8), new String(refBytes, StandardCharsets.UTF_8));
         }
         assertTrue(result);
     }
@@ -756,7 +757,7 @@ public class Canonicalizer20010315Test e
 //   public static byte[] convertToUTF16(byte input[]) throws Exception {
 //
 //      //String ENCODING_ISO8859_1 = "ISO-8859-1";
-//      //String ENCODING_UTF8 = "UTF-8";
+//      //String ENCODING_UTF8 = StandardCharsets.UTF_8;
 //      String ENCODING_UTF16 = "UTF-16";
 //      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 //      DocumentBuilder db = dbf.newDocumentBuilder();

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Santuario191Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Santuario191Test.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Santuario191Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Santuario191Test.java Wed Aug  2 16:57:41 2017
@@ -91,7 +91,7 @@ public class Santuario191Test extends or
             xmlSecEvent = (XMLSecEvent) xmlSecEventReader.nextEvent();
         }
 
-        assertEquals(new String(baos.toByteArray(), "UTF-8"), EXPECTED_RESULT);
+        assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), EXPECTED_RESULT);
     }
 
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/BaltimoreEncTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/BaltimoreEncTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/BaltimoreEncTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/BaltimoreEncTest.java Wed Aug  2 16:57:41 2017
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.security.KeyFactory;
 import java.security.PrivateKey;
 import java.security.spec.PKCS8EncodedKeySpec;
@@ -115,7 +116,7 @@ public class BaltimoreEncTest extends or
         Document document = builder.parse(sourceDocument);
 
         // Set up the Key
-        byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
+        byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
         SecretKey secretKey = new SecretKeySpec(keyBytes, "DESede");
 
         // XMLUtils.outputDOM(document, System.out);
@@ -153,7 +154,7 @@ public class BaltimoreEncTest extends or
         Document document = builder.parse(sourceDocument);
 
         // Set up the Key
-        byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes("ASCII");
+        byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes(StandardCharsets.US_ASCII);
         SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
 
         // XMLUtils.outputDOM(document, System.out);
@@ -191,7 +192,7 @@ public class BaltimoreEncTest extends or
         Document document = builder.parse(sourceDocument);
 
         // Set up the Key
-        byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
+        byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
         SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
 
         // XMLUtils.outputDOM(document, System.out);
@@ -229,7 +230,7 @@ public class BaltimoreEncTest extends or
         Document document = builder.parse(sourceDocument);
 
         // Set up the Key
-        byte[] keyBytes = "abcdefghijklmnop".getBytes("ASCII");
+        byte[] keyBytes = "abcdefghijklmnop".getBytes(StandardCharsets.US_ASCII);
         SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
 
         // XMLUtils.outputDOM(document, System.out);
@@ -301,7 +302,7 @@ public class BaltimoreEncTest extends or
         Document document = builder.parse(sourceDocument);
 
         // Set up the Key
-        byte[] keyBytes = "abcdefghijklmnop".getBytes("ASCII");
+        byte[] keyBytes = "abcdefghijklmnop".getBytes(StandardCharsets.US_ASCII);
         SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
 
         // XMLUtils.outputDOM(document, System.out);
@@ -337,7 +338,7 @@ public class BaltimoreEncTest extends or
         Document document = builder.parse(sourceDocument);
 
         // Set up the Key
-        byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
+        byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
         SecretKey secretKey = new SecretKeySpec(keyBytes, "DESede");
 
         // XMLUtils.outputDOM(document, System.out);
@@ -373,7 +374,7 @@ public class BaltimoreEncTest extends or
         Document document = builder.parse(sourceDocument);
 
         // Set up the Key
-        byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes("ASCII");
+        byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes(StandardCharsets.US_ASCII);
         SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
 
         // XMLUtils.outputDOM(document, System.out);

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/DecryptionTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/DecryptionTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/DecryptionTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/DecryptionTest.java Wed Aug  2 16:57:41 2017
@@ -21,6 +21,7 @@ package org.apache.xml.security.test.sta
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
@@ -935,7 +936,7 @@ public class DecryptionTest extends Asse
                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns:root xmlns:ns=\"ns.com\"><ns:elem xmlns:ns2=\"ns2.com\">11</ns:elem></ns:root>";
         DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
         Document document = null;
-        try (InputStream is = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
+        try (InputStream is = new ByteArrayInputStream(DATA1.getBytes(StandardCharsets.UTF_8))) {
             document = db.parse(is);
         }
 
@@ -1003,7 +1004,7 @@ public class DecryptionTest extends Asse
                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns:root xmlns=\"defns.com\" xmlns:ns=\"ns.com\"><elem xmlns=\"\">11</elem></ns:root>";
         DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
         Document document = null;
-        try (InputStream is = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
+        try (InputStream is = new ByteArrayInputStream(DATA1.getBytes(StandardCharsets.UTF_8))) {
             document = db.parse(is);
         }
 

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/EncryptionCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/EncryptionCreationTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/EncryptionCreationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/EncryptionCreationTest.java Wed Aug  2 16:57:41 2017
@@ -21,6 +21,7 @@ package org.apache.xml.security.test.sta
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
@@ -96,7 +97,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -106,7 +107,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -155,7 +156,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -165,7 +166,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -210,7 +211,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -246,7 +247,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -256,7 +257,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -305,7 +306,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -315,7 +316,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -366,7 +367,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -376,7 +377,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -424,7 +425,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -434,7 +435,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -493,7 +494,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -503,7 +504,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -562,7 +563,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -572,7 +573,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -632,7 +633,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -642,7 +643,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -704,7 +705,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -714,7 +715,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -767,7 +768,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -777,7 +778,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -838,7 +839,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -848,7 +849,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -917,7 +918,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -927,7 +928,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -988,7 +989,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -998,7 +999,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1059,7 +1060,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1069,7 +1070,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1124,7 +1125,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1134,7 +1135,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1185,7 +1186,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1195,7 +1196,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1248,7 +1249,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1258,7 +1259,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1313,7 +1314,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1323,7 +1324,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1380,7 +1381,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1390,7 +1391,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document =
             XMLUtils.createDocumentBuilder(false).parse(new ByteArrayInputStream(baos.toByteArray()));
@@ -1441,7 +1442,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1451,7 +1452,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1503,18 +1504,18 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         final String DATA1 =
                 "<ns:root xmlns:ns=\"ns.com\"><ns:elem xmlns:ns2=\"ns2.com\">11</ns:elem></ns:root>";
-        try (InputStream sourceDocument = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
+        try (InputStream sourceDocument = new ByteArrayInputStream(DATA1.getBytes(StandardCharsets.UTF_8))) {
             XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument);
 
             XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
             xmlStreamWriter.close();
         }
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1566,18 +1567,18 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         final String DATA2 =
                 "<ns:root xmlns=\"defns.com\" xmlns:ns=\"ns.com\"><elem xmlns=\"\">11</elem></ns:root>";
-        try (InputStream sourceDocument = new ByteArrayInputStream(DATA2.getBytes("UTF8"))) {
+        try (InputStream sourceDocument = new ByteArrayInputStream(DATA2.getBytes(StandardCharsets.UTF_8))) {
             XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument);
 
             XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
             xmlStreamWriter.close();
         }
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1627,7 +1628,7 @@ public class EncryptionCreationTest exte
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -1637,7 +1638,7 @@ public class EncryptionCreationTest exte
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java?rev=1803868&r1=1803867&r2=1803868&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/KeyWrapEncryptionCreationTest.java Wed Aug  2 16:57:41 2017
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
@@ -129,7 +130,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -139,7 +140,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -197,7 +198,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -207,7 +208,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -265,7 +266,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -275,7 +276,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -331,7 +332,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -341,7 +342,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -396,7 +397,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -406,7 +407,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -461,7 +462,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -471,7 +472,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -526,7 +527,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -536,7 +537,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -596,7 +597,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -606,7 +607,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -666,7 +667,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -676,7 +677,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -736,7 +737,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -746,7 +747,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -806,7 +807,7 @@ public class KeyWrapEncryptionCreationTe
 
         OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
+        XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
 
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream(
@@ -816,7 +817,7 @@ public class KeyWrapEncryptionCreationTe
         XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
         xmlStreamWriter.close();
 
-        // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
+        // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
 
         Document document = null;
         try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {