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 2018/06/06 08:24:44 UTC

svn commit: r1832986 [3/7] - in /santuario/xml-security-java/branches/2.0.x-fixes: ./ src/main/java/org/apache/jcp/xml/dsig/internal/dom/ src/main/java/org/apache/xml/security/ src/main/java/org/apache/xml/security/c14n/ src/main/java/org/apache/xml/se...

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java Wed Jun  6 08:24:42 2018
@@ -46,7 +46,7 @@ public class XMLX509CertificateTest exte
             SEP + "signature-x509-crt.xml");
 
         FileInputStream fis = new FileInputStream(f);
-        Document doc = XMLUtils.createDocumentBuilder(false).parse(fis);
+        Document doc = XMLUtils.parse(fis, false);
         NodeList nl = doc.getElementsByTagNameNS
                 (Constants.SignatureSpecNS, "X509Certificate");
         XMLX509Certificate xmlCert =

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java Wed Jun  6 08:24:42 2018
@@ -22,8 +22,6 @@ import java.io.FileInputStream;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.apache.xml.security.Init;
 import org.apache.xml.security.keys.content.x509.XMLX509Digest;
 import org.apache.xml.security.utils.Base64;
@@ -39,8 +37,6 @@ public class XMLX509DigestTest extends A
     private static final String BASEDIR = System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
     private static final String SEP = System.getProperty("file.separator");
 
-    private DocumentBuilder documentBuilder;
-
     private X509Certificate certControl;
 
     private final String algorithmURIControl = "http://www.w3.org/2001/04/xmlenc#sha256";
@@ -49,8 +45,6 @@ public class XMLX509DigestTest extends A
     private final byte[] digestControl;
 
     public XMLX509DigestTest() throws Exception {
-        documentBuilder = XMLUtils.createDocumentBuilder(false);
-
         certControl = loadCertificate("cert-X509Digest.crt");
 
         digestControl = Base64.decode(digestBase64Control);
@@ -62,7 +56,7 @@ public class XMLX509DigestTest extends A
 
     @org.junit.Test
     public void testSchema() throws Exception {
-        XMLX509Digest x509Digest = new XMLX509Digest(documentBuilder.newDocument(), digestControl, algorithmURIControl);
+        XMLX509Digest x509Digest = new XMLX509Digest(XMLUtils.newDocument(false), digestControl, algorithmURIControl);
         Element element = x509Digest.getElement();
 
         assertEquals("http://www.w3.org/2009/xmldsig11#", element.getNamespaceURI());
@@ -82,14 +76,14 @@ public class XMLX509DigestTest extends A
 
     @org.junit.Test
     public void testDigestOnConstructionWithCert() throws Exception {
-        XMLX509Digest x509Digest = new XMLX509Digest(documentBuilder.newDocument(), certControl, algorithmURIControl);
+        XMLX509Digest x509Digest = new XMLX509Digest(XMLUtils.newDocument(false), certControl, algorithmURIControl);
         assertEquals(algorithmURIControl, x509Digest.getAlgorithm());
         assertArrayEquals(digestControl, x509Digest.getDigestBytes());
     }
 
     @org.junit.Test
     public void testDigestOnConstructionWithBytes() throws Exception {
-        XMLX509Digest x509Digest = new XMLX509Digest(documentBuilder.newDocument(), digestControl, algorithmURIControl);
+        XMLX509Digest x509Digest = new XMLX509Digest(XMLUtils.newDocument(false), digestControl, algorithmURIControl);
         assertEquals(algorithmURIControl, x509Digest.getAlgorithm());
         assertArrayEquals(digestControl, x509Digest.getDigestBytes());
     }
@@ -110,7 +104,7 @@ public class XMLX509DigestTest extends A
     }
 
     private Document loadXML(String fileName) throws Exception {
-        return documentBuilder.parse(new FileInputStream(getControlFilePath(fileName)));
+        return XMLUtils.parse(new FileInputStream(getControlFilePath(fileName)), false);
     }
 
     private X509Certificate loadCertificate(String fileName) throws Exception {

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509IssuerSerialTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509IssuerSerialTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509IssuerSerialTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509IssuerSerialTest.java Wed Jun  6 08:24:42 2018
@@ -32,7 +32,7 @@ public class XMLX509IssuerSerialTest ext
     private Document doc;
 
     public XMLX509IssuerSerialTest() throws Exception {
-        doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        doc = XMLUtils.newDocument(false);
     }
 
     @org.junit.Test

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyInfoReferenceResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyInfoReferenceResolverTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyInfoReferenceResolverTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyInfoReferenceResolverTest.java Wed Jun  6 08:24:42 2018
@@ -25,8 +25,6 @@ import java.security.cert.CertificateFac
 import java.security.cert.X509Certificate;
 import java.security.spec.X509EncodedKeySpec;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.apache.xml.security.Init;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.utils.Base64;
@@ -43,11 +41,7 @@ public class KeyInfoReferenceResolverTes
     private static final String BASEDIR = System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
     private static final String SEP = System.getProperty("file.separator");
 
-    private DocumentBuilder documentBuilder;
-
     public KeyInfoReferenceResolverTest() throws Exception {
-        documentBuilder = XMLUtils.createDocumentBuilder(false);
-
         if (!Init.isInitialized()) {
             Init.init();
         }
@@ -138,7 +132,7 @@ public class KeyInfoReferenceResolverTes
     }
 
     private Document loadXML(String fileName) throws Exception {
-        return documentBuilder.parse(new FileInputStream(getControlFilePath(fileName)));
+        return XMLUtils.parse(new FileInputStream(getControlFilePath(fileName)), false);
     }
 
     private PublicKey loadPublicKey(String filePath, String algorithm) throws Exception {

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyResolverTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyResolverTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/KeyResolverTest.java Wed Jun  6 08:24:42 2018
@@ -35,7 +35,6 @@ import javax.crypto.Cipher;
 import javax.crypto.NoSuchPaddingException;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.SecretKeySpec;
-import javax.xml.parsers.DocumentBuilder;
 
 import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.encryption.EncryptedData;
@@ -105,8 +104,7 @@ public class KeyResolverTest extends org
         KeyResolverSpi privateKeyResolver = new PrivateKeyResolver(ks, pwd);
         KeyResolverSpi secretKeyResolver = new SecretKeyResolver(ks, pwd);
 
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
 
         KeyInfo ki;
         X509Data x509data;
@@ -216,7 +214,7 @@ public class KeyResolverTest extends org
         }
 
         // Create a sample XML document
-        Document document = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document document = XMLUtils.newDocument(false);
 
         Element rootElement = document.createElement("root");
         document.appendChild(rootElement);

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/RetrievalMethodResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/RetrievalMethodResolverTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/RetrievalMethodResolverTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/RetrievalMethodResolverTest.java Wed Jun  6 08:24:42 2018
@@ -21,8 +21,6 @@ package org.apache.xml.security.test.dom
 import java.io.FileInputStream;
 import java.security.Security;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.utils.XMLUtils;
@@ -52,8 +50,7 @@ public class RetrievalMethodResolverTest
             fis = new FileInputStream(filename);
         }
 
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.parse(fis);
+        Document doc = XMLUtils.parse(fis, false);
 
         KeyInfo keyInfo = new KeyInfo(doc.getDocumentElement(), null);
 
@@ -72,8 +69,7 @@ public class RetrievalMethodResolverTest
             fis = new FileInputStream(filename);
         }
 
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.parse(fis);
+        Document doc = XMLUtils.parse(fis, false);
 
         KeyInfo keyInfo = new KeyInfo(doc.getDocumentElement(), null);
 

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java Wed Jun  6 08:24:42 2018
@@ -22,8 +22,6 @@ import java.io.FileInputStream;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.apache.xml.security.Init;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.keys.storage.StorageResolver;
@@ -38,15 +36,11 @@ public class X509DigestResolverTest exte
     private static final String BASEDIR = System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
     private static final String SEP = System.getProperty("file.separator");
 
-    private DocumentBuilder documentBuilder;
-
     private X509Certificate certControl;
 
     private StorageResolver storageResolver;
 
     public X509DigestResolverTest() throws Exception {
-        documentBuilder = XMLUtils.createDocumentBuilder(false);
-
         certControl = loadCertificate("cert-X509Digest.crt");
 
         storageResolver = new StorageResolver(new SingleCertificateResolver(certControl));
@@ -83,7 +77,7 @@ public class X509DigestResolverTest exte
     }
 
     private Document loadXML(String fileName) throws Exception {
-        return documentBuilder.parse(new FileInputStream(getControlFilePath(fileName)));
+        return XMLUtils.parse(new FileInputStream(getControlFilePath(fileName)), false);
     }
 
     private X509Certificate loadCertificate(String fileName) throws Exception {

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenAlgorithmTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenAlgorithmTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenAlgorithmTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenAlgorithmTest.java Wed Jun  6 08:24:42 2018
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.secure_val;
 
 import java.io.File;
+import java.io.FileInputStream;
 
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.signature.XMLSignatureException;
@@ -69,8 +70,7 @@ public class ForbiddenAlgorithmTest exte
 
         File f = new File(directory + "/" + file);
 
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false, false);
-        org.w3c.dom.Document doc = db.parse(f);
+        org.w3c.dom.Document doc = XMLUtils.parse(new FileInputStream(f), false, false);
 
         Element sigElement =
             (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRefCountTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRefCountTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRefCountTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRefCountTest.java Wed Jun  6 08:24:42 2018
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.secure_val;
 
 import java.io.File;
+import java.io.FileInputStream;
 
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.signature.Manifest;
@@ -69,8 +70,7 @@ public class ForbiddenRefCountTest exten
 
         File f = new File(directory + "/" + file);
 
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        org.w3c.dom.Document doc = db.parse(f);
+        org.w3c.dom.Document doc = XMLUtils.parse(new FileInputStream(f), false);
 
         Element manifestElement =
             (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenReferenceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenReferenceTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenReferenceTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenReferenceTest.java Wed Jun  6 08:24:42 2018
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.secure_val;
 
 import java.io.File;
+import java.io.FileInputStream;
 
 import org.apache.xml.security.signature.Manifest;
 import org.apache.xml.security.signature.MissingResourceFailureException;
@@ -69,8 +70,7 @@ public class ForbiddenReferenceTest exte
 
         File f = new File(directory + "/" + file);
 
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        org.w3c.dom.Document doc = db.parse(f);
+        org.w3c.dom.Document doc = XMLUtils.parse(new FileInputStream(f), false);
 
         Element manifestElement =
             (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRetrievalMethodTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRetrievalMethodTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRetrievalMethodTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/ForbiddenRetrievalMethodTest.java Wed Jun  6 08:24:42 2018
@@ -20,8 +20,6 @@ package org.apache.xml.security.test.dom
 
 import java.io.FileInputStream;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.utils.XMLUtils;
 import org.w3c.dom.Document;
@@ -50,8 +48,7 @@ public class ForbiddenRetrievalMethodTes
             fis = new FileInputStream(filename);
         }
 
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.parse(fis);
+        Document doc = XMLUtils.parse(fis, false);
 
         KeyInfo keyInfo = new KeyInfo(doc.getDocumentElement(), null);
         keyInfo.setSecureValidation(true);

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/WrappingAttackTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/WrappingAttackTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/WrappingAttackTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/secure_val/WrappingAttackTest.java Wed Jun  6 08:24:42 2018
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.secure_val;
 
 import java.io.File;
+import java.io.FileInputStream;
 
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.signature.XMLSignatureException;
@@ -74,8 +75,7 @@ public class WrappingAttackTest extends
 
         File f = new File(directory + "/" + file);
 
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false, false);
-        org.w3c.dom.Document doc = db.parse(f);
+        org.w3c.dom.Document doc = XMLUtils.parse(new FileInputStream(f), false, false);
 
         Element sigElement =
             (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,
@@ -94,8 +94,7 @@ public class WrappingAttackTest extends
 
         File f = new File(directory + "/" + file);
 
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false, false);
-        org.w3c.dom.Document doc = db.parse(f);
+        org.w3c.dom.Document doc = XMLUtils.parse(new FileInputStream(f), false, false);
 
         Element sigElement =
             (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/CreateSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/CreateSignatureTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/CreateSignatureTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/CreateSignatureTest.java Wed Jun  6 08:24:42 2018
@@ -61,11 +61,9 @@ public class CreateSignatureTest extends
     private static final String BASEDIR = System.getProperty("basedir");
     private static final String SEP = System.getProperty("file.separator");
 
-    private KeyPair kp = null;
-    private javax.xml.parsers.DocumentBuilder db;
+    private KeyPair kp;
 
     public CreateSignatureTest() throws Exception {
-        db = XMLUtils.createDocumentBuilder(false);
         org.apache.xml.security.Init.init();
         kp = KeyPairGenerator.getInstance("RSA").genKeyPair();
     }
@@ -76,7 +74,7 @@ public class CreateSignatureTest extends
      */
     @org.junit.Test
     public void testEmptyNodeSet() throws Exception {
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Element envelope = doc.createElementNS("http://www.usps.gov/", "Envelope");
         envelope.appendChild(doc.createTextNode("\n"));
         doc.appendChild(envelope);
@@ -151,7 +149,7 @@ public class CreateSignatureTest extends
 
     @org.junit.Test
     public void testXFilter2Signature() throws Exception {
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
         doc.appendChild(doc.createComment(" Comment before "));
         Element root = doc.createElementNS("", "RootElement");
 
@@ -193,7 +191,7 @@ public class CreateSignatureTest extends
         String signedDoc = new String(bos.toByteArray());
 
         // Now Verify
-        doc = db.parse(new ByteArrayInputStream(signedDoc.getBytes()));
+        doc = XMLUtils.parse(new ByteArrayInputStream(signedDoc.getBytes()), false);
 
         XPathFactory xpf = XPathFactory.newInstance();
         XPath xpath = xpf.newXPath();
@@ -211,7 +209,7 @@ public class CreateSignatureTest extends
     public void testCanonicalizedOctetStream() throws Exception {
         String signedXML = doSign();
 
-        Document doc = db.parse(new ByteArrayInputStream(signedXML.getBytes()));
+        Document doc = XMLUtils.parse(new ByteArrayInputStream(signedXML.getBytes()), false);
 
         XPathFactory xpf = XPathFactory.newInstance();
         XPath xpath = xpf.newXPath();
@@ -246,10 +244,9 @@ public class CreateSignatureTest extends
         assertTrue(si.verify(false));
     }
 
-
     private String doSign() throws Exception {
         PrivateKey privateKey = kp.getPrivate();
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
         doc.appendChild(doc.createComment(" Comment before "));
         Element root = doc.createElementNS("", "RootElement");
 
@@ -294,7 +291,7 @@ public class CreateSignatureTest extends
         }
         ks.load(fis, "changeit".toCharArray());
         PrivateKey privateKey = (PrivateKey) ks.getKey("mullan", "changeit".toCharArray());
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
         X509Certificate signingCert = (X509Certificate) ks.getCertificate("mullan");
         doc.appendChild(doc.createComment(" Comment before "));
         Element root = doc.createElementNS("", "RootElement");
@@ -331,7 +328,7 @@ public class CreateSignatureTest extends
     }
 
     private void doVerify(String signedXML) throws Exception {
-        Document doc = db.parse(new ByteArrayInputStream(signedXML.getBytes()));
+        Document doc = XMLUtils.parse(new ByteArrayInputStream(signedXML.getBytes()), false);
 
         XPathFactory xpf = XPathFactory.newInstance();
         XPath xpath = xpf.newXPath();

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ECDSASignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ECDSASignatureTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ECDSASignatureTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ECDSASignatureTest.java Wed Jun  6 08:24:42 2018
@@ -59,8 +59,6 @@ public class ECDSASignatureTest extends
 
     private KeyStore keyStore;
 
-    private javax.xml.parsers.DocumentBuilder db;
-
     public ECDSASignatureTest() throws Exception {
         //
         // If the BouncyCastle provider is not installed, then try to load it
@@ -86,8 +84,6 @@ public class ECDSASignatureTest extends
 
         //String id = "http://apache.org/xml/properties/dom/document-class-name";
         //dbf.setAttribute(id, IndexedDocument.class.getName());
-
-        db = XMLUtils.createDocumentBuilder(false);
         org.apache.xml.security.Init.init();
     }
 
@@ -147,7 +143,7 @@ public class ECDSASignatureTest extends
     private byte[] doSign() throws Exception {
         PrivateKey privateKey =
             (PrivateKey)keyStore.getKey("ECDSA", ECDSA_JKS_PASSWORD.toCharArray());
-        org.w3c.dom.Document doc = db.newDocument();
+        org.w3c.dom.Document doc = XMLUtils.newDocument(false);
         doc.appendChild(doc.createComment(" Comment before "));
         Element root = doc.createElementNS("", "RootElement");
 
@@ -187,7 +183,7 @@ public class ECDSASignatureTest extends
     }
 
     private void doVerify(InputStream is) throws Exception {
-        org.w3c.dom.Document doc = this.db.parse(is);
+        org.w3c.dom.Document doc = XMLUtils.parse(is, false);
 
         XPathFactory xpf = XPathFactory.newInstance();
         XPath xpath = xpf.newXPath();

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/HMACOutputLengthTest.java Wed Jun  6 08:24:42 2018
@@ -19,6 +19,7 @@
 package org.apache.xml.security.test.dom.signature;
 
 import java.io.File;
+import java.io.FileInputStream;
 
 import javax.crypto.SecretKey;
 
@@ -73,7 +74,7 @@ public class HMACOutputLengthTest extend
 
     @org.junit.Test
     public void test_generate_hmac_sha1_40() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         XMLSignature sig =
             new XMLSignature(
                 doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1,
@@ -95,7 +96,7 @@ public class HMACOutputLengthTest extend
             new File(BASEDIR + SEP + "src/test/resources" + SEP + "javax" + SEP + "xml"
                      + SEP + "crypto" + SEP + "dsig" + SEP, data);
 
-        Document doc = XMLUtils.createDocumentBuilder(false).parse(file);
+        Document doc = XMLUtils.parse(new FileInputStream(file), false);
         NodeList nl =
             doc.getElementsByTagNameNS(Constants.SignatureSpecNS, "Signature");
         if (nl.getLength() == 0) {

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/InvalidKeyTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/InvalidKeyTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/InvalidKeyTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/InvalidKeyTest.java Wed Jun  6 08:24:42 2018
@@ -65,7 +65,7 @@ public class InvalidKeyTest extends org.
         FileInputStream is = new FileInputStream(BASEDIR + SEP +
             "src/test/resources/org/apache/xml/security/samples/input/test-assertion.xml");
 
-        Document e = XMLUtils.createDocumentBuilder(false).parse(is);
+        Document e = XMLUtils.parse(is, false);
 
         Node assertion = e.getFirstChild();
         while (!(assertion instanceof Element)) {

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/KeyValueTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/KeyValueTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/KeyValueTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/KeyValueTest.java Wed Jun  6 08:24:42 2018
@@ -22,8 +22,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.security.PublicKey;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -39,16 +37,10 @@ public class KeyValueTest extends org.ju
     private static final String BASEDIR = System.getProperty("basedir");
     private static final String SEP = System.getProperty("file.separator");
 
-    private DocumentBuilder db;
-
     static {
         Init.init();
     }
 
-    public KeyValueTest() throws Exception {
-        db = XMLUtils.createDocumentBuilder(false);
-    }
-
     @org.junit.Test
     public void testDSAPublicKey() throws Exception {
         File f = null;
@@ -59,7 +51,7 @@ public class KeyValueTest extends org.ju
         } else {
             f = new File(filename);
         }
-        Document doc = db.parse(new FileInputStream(f));
+        Document doc = XMLUtils.parse(new FileInputStream(f), false);
         NodeList nl = doc.getElementsByTagNameNS(Constants.SignatureSpecNS, "Signature");
         XMLSignature sig = new XMLSignature
             ((Element) nl.item(0), f.toURI().toURL().toString());

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/NoKeyInfoTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/NoKeyInfoTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/NoKeyInfoTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/NoKeyInfoTest.java Wed Jun  6 08:24:42 2018
@@ -21,8 +21,6 @@ package org.apache.xml.security.test.dom
 import java.io.File;
 import java.io.FileInputStream;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -41,12 +39,6 @@ public class NoKeyInfoTest extends org.j
         Init.init();
     }
 
-    private DocumentBuilder db;
-
-    public NoKeyInfoTest() throws Exception {
-        db = XMLUtils.createDocumentBuilder(false);
-    }
-
     @org.junit.Test
     public void testNullKeyInfo() throws Exception {
         File f = null;
@@ -57,7 +49,7 @@ public class NoKeyInfoTest extends org.j
         } else {
             f = new File(filename);
         }
-        Document doc = db.parse(new FileInputStream(f));
+        Document doc = XMLUtils.parse(new FileInputStream(f), false);
         NodeList nl = doc.getElementsByTagNameNS(Constants.SignatureSpecNS, "Signature");
         XMLSignature sig = new XMLSignature
             ((Element) nl.item(0), f.toURI().toURL().toString());

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java Wed Jun  6 08:24:42 2018
@@ -139,8 +139,7 @@ public class PreCalculatedDigestSignatur
     }
 
     private XMLSignature createXmlSignature() throws ParserConfigurationException, XMLSecurityException {
-        DocumentBuilder documentBuilder = createDocumentBuilder();
-        Document signatureDocument = documentBuilder.newDocument();
+        Document signatureDocument = XMLUtils.newDocument(false);
         Element root = createSignatureRoot(signatureDocument);
 
         String baseURI = "";

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ProcessingInstructionTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ProcessingInstructionTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ProcessingInstructionTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/ProcessingInstructionTest.java Wed Jun  6 08:24:42 2018
@@ -24,7 +24,6 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.security.cert.X509Certificate;
 
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
@@ -63,9 +62,8 @@ public class ProcessingInstructionTest e
     @org.junit.Test
     public void testProcessingInstruction() throws Exception {
         String signatureFileName = dir + "upp_sign.xml";
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
         File f = new File(signatureFileName);
-        Document doc = db.parse(new FileInputStream(f));
+        Document doc = XMLUtils.parse(new FileInputStream(f), false);
 
         Node obj =
             doc.getElementsByTagNameNS("http://uri.etsi.org/01903/v1.3.2#", "QualifyingProperties").item(0);

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureReferenceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureReferenceTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureReferenceTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureReferenceTest.java Wed Jun  6 08:24:42 2018
@@ -26,7 +26,6 @@ import java.security.PublicKey;
 import java.util.Enumeration;
 
 import javax.xml.crypto.dsig.DigestMethod;
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.w3c.dom.Document;
@@ -94,8 +93,7 @@ public class SignatureReferenceTest exte
     // See SANTUARIO-465
     @org.junit.Test
     public void testNoReferenceChildren() throws ParserConfigurationException, XMLSecurityException {
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(true);
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(true, false);
         Element referenceElement = doc.createElementNS(Constants.SignatureSpecNS, "Reference");
         referenceElement.setAttributeNS(null, "URI", "#_12345");
 
@@ -166,8 +164,7 @@ public class SignatureReferenceTest exte
     }
 
     private Document getOriginalDocument() throws Throwable {
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
 
         Element rootElement = doc.createElementNS("http://ns.example.org/", "root");
         rootElement.appendChild(doc.createTextNode("Hello World!"));

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/SignatureTest.java Wed Jun  6 08:24:42 2018
@@ -25,8 +25,6 @@ import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.util.Enumeration;
 
-import javax.xml.parsers.DocumentBuilder;
-
 import org.apache.xml.security.Init;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.signature.XMLSignatureException;
@@ -170,8 +168,7 @@ public class SignatureTest extends org.j
     }
 
     private Document getOriginalDocument() throws Throwable {
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
 
         Element rootElement = doc.createElementNS("http://ns.example.org/", "root");
         rootElement.appendChild(doc.createTextNode("Hello World!"));

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java Wed Jun  6 08:24:42 2018
@@ -28,7 +28,6 @@ import java.security.PublicKey;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.xpath.XPath;
@@ -165,9 +164,7 @@ public class UnknownAlgoSignatureTest ex
 
     public static Document getDocument(File file)
         throws ParserConfigurationException, SAXException, IOException {
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.parse(new FileInputStream(file));
-        return doc;
+        return XMLUtils.parse(new FileInputStream(file), false);
     }
 
 }

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java Wed Jun  6 08:24:42 2018
@@ -36,55 +36,53 @@ public class X509DataTest extends org.ju
     private static final String BASEDIR = System.getProperty("basedir");
 
     KeyStore ks = null;
-    
+
     @org.junit.Test
     public void testAddX509SubjectName() throws Exception {
         Init.init();
 
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
         XMLSignature sig = new XMLSignature(doc, "", XMLSignature.ALGO_ID_SIGNATURE_DSA);
-        
+
         doc.appendChild(sig.getElement());
         sig.addDocument("");
-        
-        //Add in the KeyInfo for the certificate that we used the private key of	         
-        X509Certificate cert =getCertificate();
+
+        //Add in the KeyInfo for the certificate that we used the private key of
+        X509Certificate cert = getCertificate();
         sig.addKeyInfo(cert);
         sig.addKeyInfo(cert.getPublicKey());
-        
+
         // Add these three lines
         org.apache.xml.security.keys.KeyInfo ki = sig.getKeyInfo();
         ki.itemX509Data(0).addSubjectName(cert.getSubjectX500Principal().getName());
         ki.itemX509Data(0).addIssuerSerial(cert.getIssuerX500Principal().getName(), cert.getSerialNumber());
-        
+
         sig.sign(getPrivateKey());
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         XMLUtils.outputDOM(doc, os);
         XMLSignature newSig = getSignature(os.toByteArray());
-        
+
         assertNotNull(newSig.getKeyInfo().itemX509Data(0));
         assertEquals(cert.getSubjectX500Principal().getName(),
                      newSig.getKeyInfo().itemX509Data(0).itemSubjectName(0).getSubjectName());
         assertEquals(cert.getIssuerX500Principal().getName(),
                      newSig.getKeyInfo().itemX509Data(0).itemIssuerSerial(0).getIssuerName());
     }
-    
+
     private XMLSignature getSignature(byte[] s) throws Exception {
 
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.parse(new ByteArrayInputStream(s));
+        Document doc = XMLUtils.parse(new ByteArrayInputStream(s), false);
         Element el = (Element)doc.getFirstChild();
         return new XMLSignature(el, "");
     }
-    
+
     private KeyStore getKeyStore() throws Exception {
         if (ks != null) {
             return ks;
         }
         String keystoreType = "JKS";
         String keystoreFile = "src/test/resources/org/apache/xml/security/samples/input/keystore.jks";
-        String keystorePass = "xmlsecurity";        
+        String keystorePass = "xmlsecurity";
         ks = KeyStore.getInstance(keystoreType);
         FileInputStream fis = null;
         if (BASEDIR != null && !"".equals(BASEDIR)) {
@@ -96,18 +94,18 @@ public class X509DataTest extends org.ju
         ks.load(fis, keystorePass.toCharArray());
         return ks;
     }
-    
+
     private X509Certificate getCertificate() throws Exception {
-        String certificateAlias = "test";       
+        String certificateAlias = "test";
         X509Certificate cert =
             (X509Certificate) getKeyStore().getCertificate(certificateAlias);
         return cert;
     }
-    
+
     private PrivateKey getPrivateKey() throws Exception {
         String privateKeyAlias = "test";
-        String privateKeyPass = "xmlsecurity";      
-        PrivateKey privateKey = 
+        String privateKeyPass = "xmlsecurity";
+        PrivateKey privateKey =
             (PrivateKey) getKeyStore().getKey(privateKeyAlias, privateKeyPass.toCharArray());
         return privateKey;
     }

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/XmlSecTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/XmlSecTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/XmlSecTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/signature/XmlSecTest.java Wed Jun  6 08:24:42 2018
@@ -26,7 +26,6 @@ import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
@@ -70,8 +69,7 @@ public class XmlSecTest extends org.juni
 
     private void checkXmlSignatureSoftwareStack(boolean cert) throws Exception {
         Init.init();
-        DocumentBuilder documentBuilder = XMLUtils.createDocumentBuilder(false);
-        Document testDocument = documentBuilder.newDocument();
+        Document testDocument = XMLUtils.newDocument(false);
 
         Element rootElement =
             testDocument.createElementNS("urn:namespace", "tns:document");

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformBase64DecodeTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformBase64DecodeTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformBase64DecodeTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformBase64DecodeTest.java Wed Jun  6 08:24:42 2018
@@ -20,7 +20,6 @@ package org.apache.xml.security.test.dom
 
 import java.io.ByteArrayInputStream;
 
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
@@ -104,11 +103,8 @@ public class TransformBase64DecodeTest e
             + "</Object>\n"
             ;
         //J+
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
 
-        db.setErrorHandler(new org.apache.xml.security.utils.IgnoreAllErrorHandler());
-
-        Document doc = db.parse(new ByteArrayInputStream(input.getBytes()));
+        Document doc = XMLUtils.parse(new ByteArrayInputStream(input.getBytes()), false, true, true);
         //XMLUtils.circumventBug2650(doc);
 
         XPathFactory xpf = XPathFactory.newInstance();
@@ -136,8 +132,7 @@ public class TransformBase64DecodeTest e
     }
 
     private static Document createDocument() throws ParserConfigurationException {
-        DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        Document doc = db.newDocument();
+        Document doc = XMLUtils.newDocument(false);
 
         if (doc == null) {
             throw new RuntimeException("Could not create a Document");

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java Wed Jun  6 08:24:42 2018
@@ -88,7 +88,7 @@ public class TransformXSLTTest extends o
 
     private static Document getDocument(File file)
         throws ParserConfigurationException, SAXException, IOException {
-        return XMLUtils.createDocumentBuilder(false).parse(new FileInputStream(file));
+        return XMLUtils.parse(new FileInputStream(file), false);
     }
 
 }

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java Wed Jun  6 08:24:42 2018
@@ -1,156 +1,155 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.xml.security.test.dom.transforms.implementations;
-
-import java.io.ByteArrayInputStream;
-
-import org.apache.xml.security.Init;
-import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.utils.Constants;
-import org.apache.xml.security.utils.XMLUtils;
-import org.w3c.dom.Element;
-
-public class Xpath2TransformationTest extends org.junit.Assert {
-    
-    static {
-        Init.init();
-    }
-    
-    @org.junit.Test
-    public void testXpath2Transform() throws Exception {
-        String sig="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + 
-        "<edoc:EDOC xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" sysid=\"CC9CC230-C0A8024E01A3CA10-AC154F78\">\r\n" + 
-        "   <edoc:Version>2.0</edoc:Version>\r\n" + 
-        "   <edoc:Object edocVersion=\"2.0\">\r\n" + 
-        "      <edoc:ObjectMetadata>\r\n" + 
-        "         <edoc:ObjectType>Record</edoc:ObjectType>\r\n" + 
-        "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\r\n" + 
-        "      </edoc:ObjectMetadata>\r\n" + 
-        "      <edoc:ObjectContent>\r\n" + 
-        "         <edoc:Record>\r\n" + 
-        "            <edoc:RecordMetadata></edoc:RecordMetadata>\r\n" + 
-        "            <edoc:Document id=\"Revision-1-Document-1\">\r\n" + 
-        "               <edoc:DocumentMetadata>\r\n" + 
-        "                  <dc:date>2003-07-20</dc:date>\r\n" + 
-        "                  <dc:type>20</dc:type>\r\n" + 
-        "                  <dc:format>PDF</dc:format>\r\n" + 
-        "                  <edoc:customer-number>222222</edoc:customer-number>\r\n" + 
-        "               </edoc:DocumentMetadata>\r\n" + 
-        "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\r\n" + 
-        "                  <edoc:EncodingMetadata>\r\n" + 
-        "                  </edoc:EncodingMetadata>\r\n" + 
-        "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\r\n" + 
-        "               </edoc:Encoding>\r\n" + 
-        "            </edoc:Document>\r\n" + 
-        "         </edoc:Record>\r\n" + 
-        "      </edoc:ObjectContent>\r\n" + 
-        "   </edoc:Object>\r\n" + 
-        "<edoc:SignatureBlock id=\"Revision-1-Signature-1\"><edoc:SignatureDate>2006-08-09T17:21:35</edoc:SignatureDate><edoc:Signer>Hess Yvan (first signature)</edoc:Signer><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\r\n" + 
-        "<ds:SignedInfo>\r\n" + 
-        "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"></ds:CanonicalizationMethod>\r\n" + 
-        "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\r\n" + 
-        "<ds:Reference URI=\"\">\r\n" + 
-        "<ds:Transforms>\r\n" + 
-        "<ds:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\">\r\n" + 
-        "<dsig-xpath:XPath xmlns:dsig-xpath=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">/edoc:EDOC/edoc:Object</dsig-xpath:XPath>\r\n" + 
-        "</ds:Transform>\r\n" + 
-        "</ds:Transforms>\r\n" + 
-        "<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\r\n" + 
-        "<ds:DigestValue>YMXHTYArDBcWDG99epurfdSEAWM=</ds:DigestValue>\r\n" + 
-        "</ds:Reference>\r\n" + 
-        "</ds:SignedInfo>\r\n" + 
-        "<ds:SignatureValue>\r\n" + 
-        "Un2HBIOcwGe36k8eDEJISKP8/EmCp813JlmV0qqxIPVgdMsIJXR5Wky6uqwP+E3wAXj4NykW76GV\r\n" + 
-        "1eSD9dTKw/M/bFMbId0nBp0ZFaFE5DKU/My4956qr2oyJqiFRKOokCxds0jMQvGcKeWVC9oAROxR\r\n" + 
-        "byZQbrtjGw9YS+D5afY=\r\n" + 
-        "</ds:SignatureValue>\r\n" + 
-        "<ds:KeyInfo>\r\n" + 
-        "<ds:X509Data>\r\n" + 
-        "<ds:X509Certificate>\r\n" + 
-        "MIIDADCCAmmgAwIBAgIGAQpEtx7tMA0GCSqGSIb3DQEBBQUAMIGXMRQwEgYDVQQGEwtTd2l0emVy\r\n" + 
-        "bGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6MRUwEwYDVQQLEwxIeXBl\r\n" + 
-        "cnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxJzAlBgNVBAMTHklNVEYgUm9vdENl\r\n" + 
-        "cnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNjAzMjgyMjAwMDBaFw0xNjAzMTcyMzAwMDBaMIGMMRQw\r\n" + 
-        "EgYDVQQGEwtTd2l0emVybGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6\r\n" + 
-        "MRUwEwYDVQQLEwxIeXBlcnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxHDAaBgNV\r\n" + 
-        "BAMTE0lNVEYgRW5kQ2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOxpALzU\r\n" + 
-        "r8TjtFB7ghScWXdaDuHHRM7bPOoyuDSCxCznCBQitrwT/Un/vkZjDxSTG1bLWObqUMf1Yf6ul30n\r\n" + 
-        "nU9NsHO2fr7+YwtGnCV5vZ+qzWSQBY7qS+Gg8Ft9z0PluNRe84ukcQt7mdqSYet2qKbYWLP8tyFc\r\n" + 
-        "XCYs0JL5E6aTAgMBAAGjYDBeMB8GA1UdIwQYMBaAFIeIxHkuiPSRw5OArsqR7wZYgVPlMB0GA1Ud\r\n" + 
-        "DgQWBBRrfNhYheJHag+VBqDPWEOQyt3rqDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIFoDAN\r\n" + 
-        "BgkqhkiG9w0BAQUFAAOBgQB4OVKzObDkpadteusbvcEin2GdK3B2qz/HwqH07AEt/pQbJ/oQOsYL\r\n" + 
-        "qVyDFt3umJ5uHon15nkps3HRE4MoYNfVbtz1G+0nMcAbxVYJDIfC4YBJRUAm/aA0twfkiH6gFmLi\r\n" + 
-        "V8o5YRtkjXvZQKUtJ/Ps/m0DAC4A935jTHDd6F4FCw==\r\n" + 
-        "</ds:X509Certificate>\r\n" + 
-        "</ds:X509Data>\r\n" + 
-        "</ds:KeyInfo>\r\n" + 
-        "</ds:Signature></edoc:SignatureBlock></edoc:EDOC>";
-        
-        String correctC14n="<edoc:Object xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" edocVersion=\"2.0\">\n" + 
-        "      <edoc:ObjectMetadata>\n" + 
-        "         <edoc:ObjectType>Record</edoc:ObjectType>\n" + 
-        "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\n" + 
-        "      </edoc:ObjectMetadata>\n" + 
-        "      <edoc:ObjectContent>\n" + 
-        "         <edoc:Record>\n" + 
-        "            <edoc:RecordMetadata></edoc:RecordMetadata>\n" + 
-        "            <edoc:Document id=\"Revision-1-Document-1\">\n" + 
-        "               <edoc:DocumentMetadata>\n" + 
-        "                  <dc:date>2003-07-20</dc:date>\n" + 
-        "                  <dc:type>20</dc:type>\n" + 
-        "                  <dc:format>PDF</dc:format>\n" + 
-        "                  <edoc:customer-number>222222</edoc:customer-number>\n" + 
-        "               </edoc:DocumentMetadata>\n" + 
-        "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\n" + 
-        "                  <edoc:EncodingMetadata>\n" + 
-        "                  </edoc:EncodingMetadata>\n" + 
-        "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\n" + 
-        "               </edoc:Encoding>\n" + 
-        "            </edoc:Document>\n" + 
-        "         </edoc:Record>\n" + 
-        "      </edoc:ObjectContent>\n" + 
-        "   </edoc:Object>";
-        
-        ByteArrayInputStream is = new ByteArrayInputStream(sig.getBytes());
-
-        javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
-        org.w3c.dom.Document doc = db.parse(is);
-        Element sigElement =
-            (Element) doc.getElementsByTagNameNS(
-                Constants.SignatureSpecNS, Constants._TAG_SIGNATURE).item(0);
-        XMLSignature sign = new XMLSignature(sigElement, "");
-        boolean verify =
-            sign.checkSignatureValue(sign.getKeyInfo().getPublicKey());
-        if (!verify) {
-            for (int i = 0; i < sign.getSignedInfo().getLength(); i++) {
-                boolean refVerify =
-                    sign.getSignedInfo().getVerificationResult(i);	            
-                if (!refVerify) {
-                    byte[] contentBytes = 
-                        sign.getSignedInfo().item(i).getContentsAfterTransformation().getBytes();
-                    assertEquals(
-                        correctC14n, 
-                        new String(contentBytes)
-                    );
-                }
-            }
-        }
-    }
-    
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.xml.security.test.dom.transforms.implementations;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.xml.security.Init;
+import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.utils.Constants;
+import org.apache.xml.security.utils.XMLUtils;
+import org.w3c.dom.Element;
+
+public class Xpath2TransformationTest {
+
+    static {
+        Init.init();
+    }
+
+    @org.junit.Test
+    public void testXpath2Transform() throws Exception {
+        String sig="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<edoc:EDOC xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" sysid=\"CC9CC230-C0A8024E01A3CA10-AC154F78\">\r\n" +
+        "   <edoc:Version>2.0</edoc:Version>\r\n" +
+        "   <edoc:Object edocVersion=\"2.0\">\r\n" +
+        "      <edoc:ObjectMetadata>\r\n" +
+        "         <edoc:ObjectType>Record</edoc:ObjectType>\r\n" +
+        "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\r\n" +
+        "      </edoc:ObjectMetadata>\r\n" +
+        "      <edoc:ObjectContent>\r\n" +
+        "         <edoc:Record>\r\n" +
+        "            <edoc:RecordMetadata></edoc:RecordMetadata>\r\n" +
+        "            <edoc:Document id=\"Revision-1-Document-1\">\r\n" +
+        "               <edoc:DocumentMetadata>\r\n" +
+        "                  <dc:date>2003-07-20</dc:date>\r\n" +
+        "                  <dc:type>20</dc:type>\r\n" +
+        "                  <dc:format>PDF</dc:format>\r\n" +
+        "                  <edoc:customer-number>222222</edoc:customer-number>\r\n" +
+        "               </edoc:DocumentMetadata>\r\n" +
+        "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\r\n" +
+        "                  <edoc:EncodingMetadata>\r\n" +
+        "                  </edoc:EncodingMetadata>\r\n" +
+        "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\r\n" +
+        "               </edoc:Encoding>\r\n" +
+        "            </edoc:Document>\r\n" +
+        "         </edoc:Record>\r\n" +
+        "      </edoc:ObjectContent>\r\n" +
+        "   </edoc:Object>\r\n" +
+        "<edoc:SignatureBlock id=\"Revision-1-Signature-1\"><edoc:SignatureDate>2006-08-09T17:21:35</edoc:SignatureDate><edoc:Signer>Hess Yvan (first signature)</edoc:Signer><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\r\n" +
+        "<ds:SignedInfo>\r\n" +
+        "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"></ds:CanonicalizationMethod>\r\n" +
+        "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\r\n" +
+        "<ds:Reference URI=\"\">\r\n" +
+        "<ds:Transforms>\r\n" +
+        "<ds:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\">\r\n" +
+        "<dsig-xpath:XPath xmlns:dsig-xpath=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">/edoc:EDOC/edoc:Object</dsig-xpath:XPath>\r\n" +
+        "</ds:Transform>\r\n" +
+        "</ds:Transforms>\r\n" +
+        "<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\r\n" +
+        "<ds:DigestValue>YMXHTYArDBcWDG99epurfdSEAWM=</ds:DigestValue>\r\n" +
+        "</ds:Reference>\r\n" +
+        "</ds:SignedInfo>\r\n" +
+        "<ds:SignatureValue>\r\n" +
+        "Un2HBIOcwGe36k8eDEJISKP8/EmCp813JlmV0qqxIPVgdMsIJXR5Wky6uqwP+E3wAXj4NykW76GV\r\n" +
+        "1eSD9dTKw/M/bFMbId0nBp0ZFaFE5DKU/My4956qr2oyJqiFRKOokCxds0jMQvGcKeWVC9oAROxR\r\n" +
+        "byZQbrtjGw9YS+D5afY=\r\n" +
+        "</ds:SignatureValue>\r\n" +
+        "<ds:KeyInfo>\r\n" +
+        "<ds:X509Data>\r\n" +
+        "<ds:X509Certificate>\r\n" +
+        "MIIDADCCAmmgAwIBAgIGAQpEtx7tMA0GCSqGSIb3DQEBBQUAMIGXMRQwEgYDVQQGEwtTd2l0emVy\r\n" +
+        "bGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6MRUwEwYDVQQLEwxIeXBl\r\n" +
+        "cnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxJzAlBgNVBAMTHklNVEYgUm9vdENl\r\n" +
+        "cnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNjAzMjgyMjAwMDBaFw0xNjAzMTcyMzAwMDBaMIGMMRQw\r\n" +
+        "EgYDVQQGEwtTd2l0emVybGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6\r\n" +
+        "MRUwEwYDVQQLEwxIeXBlcnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxHDAaBgNV\r\n" +
+        "BAMTE0lNVEYgRW5kQ2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOxpALzU\r\n" +
+        "r8TjtFB7ghScWXdaDuHHRM7bPOoyuDSCxCznCBQitrwT/Un/vkZjDxSTG1bLWObqUMf1Yf6ul30n\r\n" +
+        "nU9NsHO2fr7+YwtGnCV5vZ+qzWSQBY7qS+Gg8Ft9z0PluNRe84ukcQt7mdqSYet2qKbYWLP8tyFc\r\n" +
+        "XCYs0JL5E6aTAgMBAAGjYDBeMB8GA1UdIwQYMBaAFIeIxHkuiPSRw5OArsqR7wZYgVPlMB0GA1Ud\r\n" +
+        "DgQWBBRrfNhYheJHag+VBqDPWEOQyt3rqDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIFoDAN\r\n" +
+        "BgkqhkiG9w0BAQUFAAOBgQB4OVKzObDkpadteusbvcEin2GdK3B2qz/HwqH07AEt/pQbJ/oQOsYL\r\n" +
+        "qVyDFt3umJ5uHon15nkps3HRE4MoYNfVbtz1G+0nMcAbxVYJDIfC4YBJRUAm/aA0twfkiH6gFmLi\r\n" +
+        "V8o5YRtkjXvZQKUtJ/Ps/m0DAC4A935jTHDd6F4FCw==\r\n" +
+        "</ds:X509Certificate>\r\n" +
+        "</ds:X509Data>\r\n" +
+        "</ds:KeyInfo>\r\n" +
+        "</ds:Signature></edoc:SignatureBlock></edoc:EDOC>";
+
+        String correctC14n="<edoc:Object xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" edocVersion=\"2.0\">\n" +
+        "      <edoc:ObjectMetadata>\n" +
+        "         <edoc:ObjectType>Record</edoc:ObjectType>\n" +
+        "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\n" +
+        "      </edoc:ObjectMetadata>\n" +
+        "      <edoc:ObjectContent>\n" +
+        "         <edoc:Record>\n" +
+        "            <edoc:RecordMetadata></edoc:RecordMetadata>\n" +
+        "            <edoc:Document id=\"Revision-1-Document-1\">\n" +
+        "               <edoc:DocumentMetadata>\n" +
+        "                  <dc:date>2003-07-20</dc:date>\n" +
+        "                  <dc:type>20</dc:type>\n" +
+        "                  <dc:format>PDF</dc:format>\n" +
+        "                  <edoc:customer-number>222222</edoc:customer-number>\n" +
+        "               </edoc:DocumentMetadata>\n" +
+        "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\n" +
+        "                  <edoc:EncodingMetadata>\n" +
+        "                  </edoc:EncodingMetadata>\n" +
+        "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\n" +
+        "               </edoc:Encoding>\n" +
+        "            </edoc:Document>\n" +
+        "         </edoc:Record>\n" +
+        "      </edoc:ObjectContent>\n" +
+        "   </edoc:Object>";
+
+        org.w3c.dom.Document doc = XMLUtils.parse(new ByteArrayInputStream(sig.getBytes()), false);
+        Element sigElement =
+            (Element) doc.getElementsByTagNameNS(
+                Constants.SignatureSpecNS, Constants._TAG_SIGNATURE).item(0);
+        XMLSignature sign = new XMLSignature(sigElement, "");
+        boolean verify =
+            sign.checkSignatureValue(sign.getKeyInfo().getPublicKey());
+        if (!verify) {
+            for (int i = 0; i < sign.getSignedInfo().getLength(); i++) {
+                boolean refVerify =
+                    sign.getSignedInfo().getVerificationResult(i);
+                if (!refVerify) {
+                    byte[] contentBytes =
+                        sign.getSignedInfo().item(i).getContentsAfterTransformation().getBytes();
+                    assertEquals(
+                        correctC14n,
+                        new String(contentBytes)
+                    );
+                }
+            }
+        }
+    }
+
+}

Added: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/XMLUtilsPerformanceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/XMLUtilsPerformanceTest.java?rev=1832986&view=auto
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/XMLUtilsPerformanceTest.java (added)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/XMLUtilsPerformanceTest.java Wed Jun  6 08:24:42 2018
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.xml.security.test.dom.utils;
+
+import java.io.StringReader;
+
+import org.apache.xml.security.utils.XMLUtils;
+import org.junit.Test;
+import org.xml.sax.InputSource;
+
+import com.carrotsearch.junitbenchmarks.AbstractBenchmark;
+import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
+
+/**
+ * Some benchmark tests for the caching logic in XMLUtils
+ */
+public class XMLUtilsPerformanceTest extends AbstractBenchmark {
+
+    @BenchmarkOptions(callgc = false, benchmarkRounds = 100000, warmupRounds = 100)
+    @Test
+    public void testCreateDocumentBuilder() throws Exception {
+        InputSource inputSource = new InputSource(new StringReader("<xml>123</xml>"));
+        XMLUtils.createDocumentBuilder(false).parse(inputSource);
+    }
+
+    @BenchmarkOptions(callgc = false, benchmarkRounds = 100000, warmupRounds = 100)
+    @Test
+    public void testNewDocument() throws Exception {
+        XMLUtils.newDocument(false);
+    }
+
+    @BenchmarkOptions(callgc = false, benchmarkRounds = 100000, warmupRounds = 100)
+    @Test
+    public void testParse() throws Exception {
+        InputSource inputSource = new InputSource(new StringReader("<xml>123</xml>"));
+        XMLUtils.parse(inputSource, false);
+    }
+}

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResolverDirectHTTPTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResolverDirectHTTPTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResolverDirectHTTPTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResolverDirectHTTPTest.java Wed Jun  6 08:24:42 2018
@@ -49,7 +49,7 @@ public class ResolverDirectHTTPTest exte
 
     @Test
     public void testBug40783() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uri = doc.createAttribute("id");
         uri.setNodeValue("urn:ddd:uuu");
         doc.createElement("test").setAttributeNode(uri);
@@ -64,7 +64,7 @@ public class ResolverDirectHTTPTest exte
     @Test
     @Ignore
     public void testProxyAuth() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uri = doc.createAttribute("URI");
         uri.setNodeValue(url);
 
@@ -73,7 +73,7 @@ public class ResolverDirectHTTPTest exte
         resolverDirectHTTP.engineSetProperty("http.proxy.port", proxyPort);
         resolverDirectHTTP.engineSetProperty("http.proxy.username", proxyUsername);
         resolverDirectHTTP.engineSetProperty("http.proxy.password", proxyPassword);
-        ResourceResolverContext context = 
+        ResourceResolverContext context =
             new ResourceResolverContext(uri, url, true);
         resolverDirectHTTP.engineResolveURI(context);
     }
@@ -81,7 +81,7 @@ public class ResolverDirectHTTPTest exte
     @Test
     @Ignore
     public void testProxyAuthWithWrongPassword() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uri = doc.createAttribute("URI");
         uri.setNodeValue(url);
 
@@ -90,7 +90,7 @@ public class ResolverDirectHTTPTest exte
         resolverDirectHTTP.engineSetProperty("http.proxy.port", proxyPort);
         resolverDirectHTTP.engineSetProperty("http.proxy.username", proxyUsername);
         resolverDirectHTTP.engineSetProperty("http.proxy.password", "wrongPassword");
-        ResourceResolverContext context = 
+        ResourceResolverContext context =
             new ResourceResolverContext(uri, url, true);
         try {
             resolverDirectHTTP.engineResolveURI(context);
@@ -103,14 +103,14 @@ public class ResolverDirectHTTPTest exte
     @Test
     @Ignore
     public void testServerAuth() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uri = doc.createAttribute("URI");
         uri.setNodeValue(url);
 
         ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
         resolverDirectHTTP.engineSetProperty("http.basic.username", serverUsername);
         resolverDirectHTTP.engineSetProperty("http.basic.password", serverPassword);
-        ResourceResolverContext context = 
+        ResourceResolverContext context =
             new ResourceResolverContext(uri, url, true);
         resolverDirectHTTP.engineResolveURI(context);
     }
@@ -118,14 +118,14 @@ public class ResolverDirectHTTPTest exte
     @Test
     @Ignore
     public void testServerAuthWithWrongPassword() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uri = doc.createAttribute("URI");
         uri.setNodeValue(url);
 
         ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
         resolverDirectHTTP.engineSetProperty("http.basic.username", serverUsername);
         resolverDirectHTTP.engineSetProperty("http.basic.password", "wrongPassword");
-        ResourceResolverContext context = 
+        ResourceResolverContext context =
             new ResourceResolverContext(uri, url, true);
         try {
             resolverDirectHTTP.engineResolveURI(context);
@@ -138,7 +138,7 @@ public class ResolverDirectHTTPTest exte
     @Test
     @Ignore
     public void testProxyAndServerAuth() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uri = doc.createAttribute("URI");
         uri.setNodeValue(url);
 
@@ -149,7 +149,7 @@ public class ResolverDirectHTTPTest exte
         resolverDirectHTTP.engineSetProperty("http.proxy.password", proxyPassword);
         resolverDirectHTTP.engineSetProperty("http.basic.username", serverUsername);
         resolverDirectHTTP.engineSetProperty("http.basic.password", serverPassword);
-        ResourceResolverContext context = 
+        ResourceResolverContext context =
             new ResourceResolverContext(uri, url, true);
         resolverDirectHTTP.engineResolveURI(context);
     }

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResourceResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResourceResolverTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResourceResolverTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/dom/utils/resolver/ResourceResolverTest.java Wed Jun  6 08:24:42 2018
@@ -48,7 +48,7 @@ public class ResourceResolverTest extend
         String className =
             "org.apache.xml.security.test.dom.utils.resolver.OfflineResolver";
         ResourceResolver.registerAtStart(className);
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uriAttr = doc.createAttribute("URI");
         uriAttr.setValue("http://www.apache.org");
         ResourceResolver res =
@@ -72,7 +72,7 @@ public class ResourceResolverTest extend
 
     @org.junit.Test
     public void testLocalFileWithEmptyBaseURI() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Attr uriAttr = doc.createAttribute("URI");
         String basedir = System.getProperty("basedir");
         String file = new File(basedir, "pom.xml").toURI().toString();

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java Wed Jun  6 08:24:42 2018
@@ -280,7 +280,7 @@ public class Canonicalizer11Test extends
 //      dfactory.setNamespaceAware(true);
 //
 //      DocumentBuilder db = dfactory.newDocumentBuilder();
-//      Document doc = db.newDocument();
+//      Document doc = XMLUtils.newDocument(false);
 //
 //      xpath = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_XPATH);
 //

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java Wed Jun  6 08:24:42 2018
@@ -233,7 +233,7 @@ public class Canonicalizer20010315Exclus
      */
     @org.junit.Test
     public void test24Aexcl() throws Exception {
-        Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
+        Document doc = XMLUtils.newDocument(false);
         Element local = doc.createElementNS("foo:bar", "dsig:local");
         Element test = doc.createElementNS("http://example.net", "etsi:test");
         Element elem2 = doc.createElementNS("http://example.net", "etsi:elem2");

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java Wed Jun  6 08:24:42 2018
@@ -316,7 +316,7 @@ public class Canonicalizer20010315Test e
 //      dfactory.setNamespaceAware(true);
 //
 //      DocumentBuilder db = dfactory.newDocumentBuilder();
-//      Document doc = db.newDocument();
+//      Document doc = XMLUtils.newDocument(false);
 //
 //      xpath = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_XPATH);
 //

Modified: santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/ExclusiveC14NInteropTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/ExclusiveC14NInteropTest.java?rev=1832986&r1=1832985&r2=1832986&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/ExclusiveC14NInteropTest.java (original)
+++ santuario/xml-security-java/branches/2.0.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/ExclusiveC14NInteropTest.java Wed Jun  6 08:24:42 2018
@@ -30,7 +30,6 @@ import java.security.spec.DSAPublicKeySp
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.KeySpec;
 
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.TransformerFactory;
@@ -82,8 +81,7 @@ public class ExclusiveC14NInteropTest ex
         // Read in plaintext document
         InputStream sourceDocument =
                 this.getClass().getClassLoader().getResourceAsStream("interop/c14n/Y1/exc-signature.xml");
-        DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
-        Document document = builder.parse(sourceDocument);
+        Document document = XMLUtils.parse(sourceDocument, false);
 
         // Set up the Key
         Key publicKey = getPublicKey();
@@ -104,7 +102,7 @@ public class ExclusiveC14NInteropTest ex
         InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
         XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
 
-        StAX2DOM.readDoc(XMLUtils.createDocumentBuilder(false), securityStreamReader);
+        StAX2DOM.readDoc(XMLUtils.newDocument(false), securityStreamReader);
     }
 
     private static PublicKey getPublicKey()