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 17:37:39 UTC
svn commit: r1803889 [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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -19,7 +19,6 @@
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;
@@ -101,9 +100,9 @@ public class BaltimoreEncTest extends or
nodeCount = countNodes(doc);
// Create the keys
- jebBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
- jobBytes = "abcdefghijklmnop".getBytes(StandardCharsets.US_ASCII);
- jedBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes(StandardCharsets.US_ASCII);
+ jebBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
+ jobBytes = "abcdefghijklmnop".getBytes("ASCII");
+ jedBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes("ASCII");
// Certificate information
rsaCertSerialNumber = "1014918766910";
@@ -615,7 +614,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, StandardCharsets.US_ASCII);
+ String input = new String(data, "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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -19,7 +19,6 @@
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;
@@ -118,7 +117,7 @@ public class BobKeyResolver extends KeyR
if (engineCanResolve(element, BaseURI, storage)) {
try {
DESedeKeySpec keySpec =
- new DESedeKeySpec("abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII));
+ new DESedeKeySpec("abcdefghijklmnopqrstuvwx".getBytes("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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -20,7 +20,6 @@ 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;
@@ -115,7 +114,7 @@ public class EncryptContentTest extends
}
Document doc = null;
- try (InputStream is = new ByteArrayInputStream(DATA.getBytes(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(DATA.getBytes("UTF8"))) {
doc = db.parse(is);
}
NodeList dataToEncrypt = doc.getElementsByTagName("user");
@@ -167,7 +166,7 @@ public class EncryptContentTest extends
}
Document doc = null;
- try (InputStream is = new ByteArrayInputStream(MULTIPLE_USER_DATA.getBytes(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(MULTIPLE_USER_DATA.getBytes("UTF8"))) {
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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -42,7 +42,6 @@ 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;
@@ -102,7 +101,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(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(SAMPLE_MSG.getBytes("UTF8"))) {
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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -23,7 +23,6 @@ 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;
@@ -702,13 +701,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(StandardCharsets.US_ASCII), "AES");
+ Key key = new SecretKeySpec("abcdefghijklmnop".getBytes("ASCII"), "AES");
cipherDecrypt.init(XMLCipher.DECRYPT_MODE, key);
byte[] decryptBytes = cipherDecrypt.decryptToByteArray(ee);
assertEquals("A test encrypted secret",
- new String(decryptBytes, StandardCharsets.US_ASCII));
+ new String(decryptBytes, "ASCII"));
} else {
LOG.warn(
"Test testSameDocumentCipherReference skipped as "
@@ -735,7 +734,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(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
doc = db.parse(is);
}
Element elem = (Element)doc.getDocumentElement().getFirstChild();
@@ -761,7 +760,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(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(DATA2.getBytes("UTF8"))) {
doc = db.parse(is);
}
elem = (Element)doc.getDocumentElement().getFirstChild();
@@ -788,7 +787,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(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(DATA3.getBytes("UTF8"))) {
doc = db.parse(is);
}
elem = (Element)doc.getDocumentElement();
@@ -854,7 +853,7 @@ public class XMLCipherTest extends org.j
canon.notReset();
canon.canonicalizeSubtree(e);
baos.close();
- String before = baos.toString(StandardCharsets.UTF_8.name());
+ String before = baos.toString("UTF-8");
byte[] serialized = baos.toByteArray();
EncryptedData encryptedData = null;
@@ -868,7 +867,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, StandardCharsets.UTF_8);
+ String after = new String(bytes, "UTF-8");
assertEquals(before, after);
// test with null type
@@ -1004,7 +1003,7 @@ public class XMLCipherTest extends org.j
baos.write(serBytes);
baos.close();
- return baos.toString(StandardCharsets.UTF_8.name());
+ return baos.toString("UTF-8");
}
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=1803889&r1=1803888&r2=1803889&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 17:37:38 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(java.nio.charset.StandardCharsets.UTF_8))
+ Base64.getMimeDecoder().decode("ZHVtbXkxMjM=".getBytes("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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -20,9 +20,6 @@ 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;
/**
@@ -72,7 +69,7 @@ public class BaltimoreTest extends Inter
String filename = merlinsDir15 + "signature-enveloping-hmac-sha1.xml";
boolean verify = this.verifyHMAC(filename, new OfflineResolver(), false,
- "secret".getBytes(StandardCharsets.US_ASCII));
+ "secret".getBytes("ASCII"));
if (!verify) {
LOG.error("Verification failed for " + filename);
@@ -92,7 +89,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(StandardCharsets.US_ASCII);
+ byte[] hmacKey = "secret".getBytes("ASCII");
try {
this.verifyHMAC(filename, resolver, followManifests, hmacKey);
@@ -338,7 +335,7 @@ public class BaltimoreTest extends Inter
String filename = merlinsDir23 + "signature-enveloping-hmac-sha1.xml";
boolean verify = this.verifyHMAC(filename, new OfflineResolver(), false,
- "secret".getBytes(StandardCharsets.US_ASCII));
+ "secret".getBytes("ASCII"));
if (!verify) {
LOG.error("Verification failed for " + filename);
@@ -358,7 +355,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(StandardCharsets.US_ASCII);
+ byte[] hmacKey = "secret".getBytes("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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -19,9 +19,6 @@
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;
@@ -69,7 +66,7 @@ public class IAIKTest extends InteropTes
gregorsDir + "signatureAlgorithms/signatures/hMACShortSignature.xml";
ResourceResolverSpi resolver = new OfflineResolver();
boolean followManifests = false;
- byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
+ byte[] hmacKey = "secret".getBytes("ASCII");
try {
this.verifyHMAC(filename, resolver, followManifests, hmacKey);
@@ -96,7 +93,7 @@ public class IAIKTest extends InteropTes
String filename = gregorsDir + "signatureAlgorithms/signatures/hMACSignature.xml";
ResourceResolverSpi resolver = new OfflineResolver();
boolean followManifests = false;
- byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
+ byte[] hmacKey = "secret".getBytes("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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -19,7 +19,6 @@
package org.apache.xml.security.test.dom.signature;
import java.io.File;
-import java.nio.charset.StandardCharsets;
import javax.crypto.SecretKey;
@@ -81,7 +80,7 @@ public class HMACOutputLengthTest extend
40, Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS
);
try {
- sig.sign(getSecretKey("secret".getBytes(StandardCharsets.US_ASCII)));
+ sig.sign(getSecretKey("secret".getBytes("ASCII")));
fail("Expected HMACOutputLength Exception");
} catch (XMLSignatureException xse) {
// System.out.println(xse.getMessage());
@@ -104,7 +103,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(StandardCharsets.US_ASCII));
+ SecretKey sk = signature.createSecretKey("secret".getBytes("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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -86,7 +86,7 @@ public class XMLSignatureInputTest exten
public void testSetOctetStreamGetOctetStream()
throws IOException, CanonicalizationException, InvalidCanonicalizerException {
InputStream inputStream =
- new ByteArrayInputStream(_octetStreamTextInput.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ new ByteArrayInputStream(_octetStreamTextInput.getBytes("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, java.nio.charset.StandardCharsets.UTF_8);
+ String resString = new String(resBytes, "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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -78,7 +78,7 @@ public class EmptyNamespaceTest {
transformer.setProperties(properties);
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- InputStream stream = new ByteArrayInputStream(message.getBytes(java.nio.charset.StandardCharsets.UTF_8))) {
+ InputStream stream = new ByteArrayInputStream(message.getBytes("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(java.nio.charset.StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(message.getBytes("UTF-8"))) {
document = documentBuilder.parse(is);
}
@@ -109,7 +109,7 @@ public class EmptyNamespaceTest {
byte[] output =
transformer.engineCanonicalizeSubTree(document, inclusiveNamespaces);
- String result = new String(output, java.nio.charset.StandardCharsets.UTF_8);
+ String result = new String(output, "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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -44,7 +44,6 @@ 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;
@@ -94,7 +93,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(StandardCharsets.UTF_8.name()));
+ XMLAssert.assertXMLEqual(readTestFile(), baos.toString("UTF-8"));
}
@Test
@@ -102,7 +101,7 @@ public class XMLSecurityStreamReaderTest
XMLSecurityProperties securityProperties = new XMLSecurityProperties();
InboundSecurityContextImpl securityContext = new InboundSecurityContextImpl();
DocumentContextImpl documentContext = new DocumentContextImpl();
- documentContext.setEncoding(StandardCharsets.UTF_8.name());
+ documentContext.setEncoding("UTF-8");
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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -38,7 +38,6 @@ 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.*;
/**
@@ -91,8 +90,8 @@ public class XMLSecurityStreamWriterTest
xmlSecurityStreamWriter.setNamespaceContext(namespaceContext);
stdXmlStreamWriter.setNamespaceContext(namespaceContext);
- xmlSecurityStreamWriter.writeStartDocument(StandardCharsets.UTF_8.name(), "1.0");
- stdXmlStreamWriter.writeStartDocument(StandardCharsets.UTF_8.name(), "1.0");
+ xmlSecurityStreamWriter.writeStartDocument("UTF-8", "1.0");
+ stdXmlStreamWriter.writeStartDocument("UTF-8", "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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -35,7 +35,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.nio.charset.StandardCharsets;
/**
*/
@@ -245,9 +244,9 @@ public class Canonicalizer11Test extends
boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
if (!equals) {
- System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
}
assertTrue(equals);
@@ -636,7 +635,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(), StandardCharsets.UTF_8), new String(refBytes, StandardCharsets.UTF_8));
+ assertEquals(new String(baos.toByteArray(), "UTF-8"), new String(refBytes, "UTF-8"));
}
assertTrue(result);
}
@@ -674,7 +673,7 @@ public class Canonicalizer11Test extends
// public static byte[] convertToUTF16(byte input[]) throws Exception {
//
// //String ENCODING_ISO8859_1 = "ISO-8859-1";
-// //String ENCODING_UTF8 = java.nio.charset.StandardCharsets.UTF_8;
+// //String ENCODING_UTF8 = "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=1803889&r1=1803888&r2=1803889&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 17:37:38 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, java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "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, java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "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, java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "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, java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML1);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML2);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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(), java.nio.charset.StandardCharsets.UTF_8), c14nXML);
+ assertEquals(new String(baos.toByteArray(), "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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -36,7 +36,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.nio.charset.StandardCharsets;
/**
*/
@@ -90,9 +89,9 @@ public class Canonicalizer20010315Test e
boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
if (!equals) {
- System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
}
assertTrue(equals);
@@ -132,9 +131,9 @@ public class Canonicalizer20010315Test e
boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
if (!equals) {
- System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
}
assertTrue(equals);
@@ -397,9 +396,9 @@ public class Canonicalizer20010315Test e
boolean equals = java.security.MessageDigest.isEqual(reference, baos.toByteArray());
if (!equals) {
- System.out.println("Expected:\n" + new String(reference, StandardCharsets.UTF_8));
+ System.out.println("Expected:\n" + new String(reference, "UTF-8"));
System.out.println("");
- System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8));
+ System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
}
assertTrue(equals);
@@ -713,7 +712,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(), StandardCharsets.UTF_8), new String(refBytes, StandardCharsets.UTF_8));
+ assertEquals(new String(baos.toByteArray(), "UTF-8"), new String(refBytes, "UTF-8"));
}
assertTrue(result);
}
@@ -757,7 +756,7 @@ public class Canonicalizer20010315Test e
// public static byte[] convertToUTF16(byte input[]) throws Exception {
//
// //String ENCODING_ISO8859_1 = "ISO-8859-1";
-// //String ENCODING_UTF8 = StandardCharsets.UTF_8;
+// //String ENCODING_UTF8 = "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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -91,7 +91,7 @@ public class Santuario191Test extends or
xmlSecEvent = (XMLSecEvent) xmlSecEventReader.nextEvent();
}
- assertEquals(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8), EXPECTED_RESULT);
+ assertEquals(new String(baos.toByteArray(), "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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -22,7 +22,6 @@ 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;
@@ -116,7 +115,7 @@ public class BaltimoreEncTest extends or
Document document = builder.parse(sourceDocument);
// Set up the Key
- byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
+ byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
SecretKey secretKey = new SecretKeySpec(keyBytes, "DESede");
// XMLUtils.outputDOM(document, System.out);
@@ -154,7 +153,7 @@ public class BaltimoreEncTest extends or
Document document = builder.parse(sourceDocument);
// Set up the Key
- byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes(StandardCharsets.US_ASCII);
+ byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes("ASCII");
SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
// XMLUtils.outputDOM(document, System.out);
@@ -192,7 +191,7 @@ public class BaltimoreEncTest extends or
Document document = builder.parse(sourceDocument);
// Set up the Key
- byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
+ byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
// XMLUtils.outputDOM(document, System.out);
@@ -230,7 +229,7 @@ public class BaltimoreEncTest extends or
Document document = builder.parse(sourceDocument);
// Set up the Key
- byte[] keyBytes = "abcdefghijklmnop".getBytes(StandardCharsets.US_ASCII);
+ byte[] keyBytes = "abcdefghijklmnop".getBytes("ASCII");
SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
// XMLUtils.outputDOM(document, System.out);
@@ -302,7 +301,7 @@ public class BaltimoreEncTest extends or
Document document = builder.parse(sourceDocument);
// Set up the Key
- byte[] keyBytes = "abcdefghijklmnop".getBytes(StandardCharsets.US_ASCII);
+ byte[] keyBytes = "abcdefghijklmnop".getBytes("ASCII");
SecretKey secretKey = new SecretKeySpec(keyBytes, "AES");
// XMLUtils.outputDOM(document, System.out);
@@ -338,7 +337,7 @@ public class BaltimoreEncTest extends or
Document document = builder.parse(sourceDocument);
// Set up the Key
- byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes(StandardCharsets.US_ASCII);
+ byte[] keyBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
SecretKey secretKey = new SecretKeySpec(keyBytes, "DESede");
// XMLUtils.outputDOM(document, System.out);
@@ -374,7 +373,7 @@ public class BaltimoreEncTest extends or
Document document = builder.parse(sourceDocument);
// Set up the Key
- byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes(StandardCharsets.US_ASCII);
+ byte[] keyBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes("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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -21,7 +21,6 @@ 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;
@@ -936,7 +935,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(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
document = db.parse(is);
}
@@ -1004,7 +1003,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(StandardCharsets.UTF_8))) {
+ try (InputStream is = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -21,7 +21,6 @@ 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;
@@ -97,7 +96,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -107,7 +106,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -156,7 +155,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -166,7 +165,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -211,7 +210,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -247,7 +246,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -257,7 +256,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -306,7 +305,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -316,7 +315,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -367,7 +366,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -377,7 +376,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -425,7 +424,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -435,7 +434,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -494,7 +493,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -504,7 +503,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -563,7 +562,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -573,7 +572,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -633,7 +632,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -643,7 +642,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -705,7 +704,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -715,7 +714,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -768,7 +767,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -778,7 +777,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -839,7 +838,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -849,7 +848,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -918,7 +917,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -928,7 +927,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -989,7 +988,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -999,7 +998,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1060,7 +1059,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1070,7 +1069,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1125,7 +1124,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1135,7 +1134,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1186,7 +1185,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1196,7 +1195,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1249,7 +1248,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1259,7 +1258,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1314,7 +1313,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1324,7 +1323,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1381,7 +1380,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1391,7 +1390,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document =
XMLUtils.createDocumentBuilder(false).parse(new ByteArrayInputStream(baos.toByteArray()));
@@ -1442,7 +1441,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1452,7 +1451,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1504,18 +1503,18 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
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(StandardCharsets.UTF_8))) {
+ try (InputStream sourceDocument = new ByteArrayInputStream(DATA1.getBytes("UTF8"))) {
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument);
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
}
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1567,18 +1566,18 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
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(StandardCharsets.UTF_8))) {
+ try (InputStream sourceDocument = new ByteArrayInputStream(DATA2.getBytes("UTF8"))) {
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sourceDocument);
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
}
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -1628,7 +1627,7 @@ public class EncryptionCreationTest exte
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -1638,7 +1637,7 @@ public class EncryptionCreationTest exte
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
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=1803889&r1=1803888&r2=1803889&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 17:37:38 2017
@@ -22,7 +22,6 @@ 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;
@@ -130,7 +129,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -140,7 +139,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -198,7 +197,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -208,7 +207,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -266,7 +265,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -276,7 +275,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -332,7 +331,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -342,7 +341,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -397,7 +396,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -407,7 +406,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -462,7 +461,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -472,7 +471,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -527,7 +526,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -537,7 +536,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -597,7 +596,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -607,7 +606,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -667,7 +666,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -677,7 +676,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -737,7 +736,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -747,7 +746,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
@@ -807,7 +806,7 @@ public class KeyWrapEncryptionCreationTe
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, StandardCharsets.UTF_8.name());
+ XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");
InputStream sourceDocument =
this.getClass().getClassLoader().getResourceAsStream(
@@ -817,7 +816,7 @@ public class KeyWrapEncryptionCreationTe
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- // System.out.println("Got:\n" + new String(baos.toByteArray(), StandardCharsets.UTF_8.name()));
+ // System.out.println("Got:\n" + new String(baos.toByteArray(), "UTF-8"));
Document document = null;
try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {