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 2019/06/25 16:50:00 UTC
svn commit: r1862079 - in
/santuario/xml-security-java/branches/2.1.x-fixes/src:
main/java/org/apache/xml/security/utils/
test/java/org/apache/xml/security/test/dom/c14n/implementations/
test/java/org/apache/xml/security/test/dom/resource/ test/java/or...
Author: coheigea
Date: Tue Jun 25 16:50:00 2019
New Revision: 1862079
URL: http://svn.apache.org/viewvc?rev=1862079&view=rev
Log:
Removing EntityResolver calls
Removed:
santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/resource/TestVectorResolver.java
Modified:
santuario/xml-security-java/branches/2.1.x-fixes/src/main/java/org/apache/xml/security/utils/XMLUtils.java
santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java
santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java
santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java
santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java
Modified: santuario/xml-security-java/branches/2.1.x-fixes/src/main/java/org/apache/xml/security/utils/XMLUtils.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.1.x-fixes/src/main/java/org/apache/xml/security/utils/XMLUtils.java?rev=1862079&r1=1862078&r2=1862079&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.1.x-fixes/src/main/java/org/apache/xml/security/utils/XMLUtils.java (original)
+++ santuario/xml-security-java/branches/2.1.x-fixes/src/main/java/org/apache/xml/security/utils/XMLUtils.java Tue Jun 25 16:50:00 2019
@@ -1115,26 +1115,12 @@ public final class XMLUtils {
}
public static Document read(InputSource inputSource, boolean validating) throws ParserConfigurationException, SAXException, IOException {
- return read(inputSource, validating, true, (EntityResolver)null);
+ return read(inputSource, validating, true, null);
}
public static Document read(InputSource inputSource, boolean validating, boolean disAllowDocTypeDeclarations)
throws ParserConfigurationException, SAXException, IOException {
- return read(inputSource, validating, disAllowDocTypeDeclarations, (EntityResolver)null);
- }
-
- public static Document read(InputSource inputSource, boolean validating, boolean disAllowDocTypeDeclarations, EntityResolver resolver)
- throws ParserConfigurationException, SAXException, IOException {
- DocumentBuilder documentBuilder = createDocumentBuilder(validating, disAllowDocTypeDeclarations);
- if (resolver != null) {
- documentBuilder.setEntityResolver(resolver);
- }
- Document doc = documentBuilder.parse(inputSource);
- if (resolver != null) {
- documentBuilder.setEntityResolver(null);
- }
- repoolDocumentBuilder(documentBuilder);
- return doc;
+ return read(inputSource, validating, disAllowDocTypeDeclarations, null);
}
public static Document read(InputSource inputSource, boolean validating, boolean disAllowDocTypeDeclarations, ErrorHandler errorHandler)
Modified: santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java?rev=1862079&r1=1862078&r2=1862079&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java Tue Jun 25 16:50:00 2019
@@ -356,10 +356,6 @@ public class Canonicalizer11Test {
ParserConfigurationException, CanonicalizationException,
InvalidCanonicalizerException, TransformerException, XPathExpressionException {
- // org.xml.sax.EntityResolver resolver = new TestVectorResolver();
- // documentBuilder.setEntityResolver(resolver);
- // Document doc = documentBuilder.parse(resolver.resolveEntity(null, fileIn));
-
Document doc = XMLUtils.read(fileIn, validating, false, new IgnoreAllErrorHandler());
Canonicalizer c14n = Canonicalizer.getInstance(c14nURI);
Modified: santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java?rev=1862079&r1=1862078&r2=1862079&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java Tue Jun 25 16:50:00 2019
@@ -23,6 +23,7 @@ import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -47,7 +48,6 @@ import org.apache.xml.security.c14n.Cano
import org.apache.xml.security.c14n.Canonicalizer;
import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.apache.xml.security.test.dom.DSNamespaceContext;
-import org.apache.xml.security.test.dom.resource.TestVectorResolver;
import org.apache.xml.security.utils.IgnoreAllErrorHandler;
import org.apache.xml.security.utils.JavaUtils;
import org.apache.xml.security.utils.XMLUtils;
@@ -608,8 +608,7 @@ public class Canonicalizer20010315Test {
//String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
//boolean validating = true;
- org.xml.sax.EntityResolver resolver = new TestVectorResolver();
- Document doc = XMLUtils.read(resolver.resolveEntity(null, fileIn), false, false, resolver);
+ Document doc = XMLUtils.read(new FileInputStream(fileIn), false, false);
String xpath = "(//. | //@* | //namespace::*)"
+ "[ "
@@ -631,8 +630,7 @@ public class Canonicalizer20010315Test {
Canonicalizer c14n =
Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
byte c14nBytes[] = c14n.canonicalizeXPathNodeSet(nodes);
- InputStream refStream = resolver.resolveEntity(null,
- fileRef).getByteStream();
+ InputStream refStream = new FileInputStream(fileRef);
byte refBytes[] = JavaUtils.getBytesFromStream(refStream);
assertEquals(new String(refBytes),new String(c14nBytes));
}
@@ -720,10 +718,7 @@ public class Canonicalizer20010315Test {
Canonicalizer c14n =
Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
byte c14nBytes[] = c14n.canonicalize(utf16);
- org.xml.sax.EntityResolver resolver = new TestVectorResolver();
- InputStream refStream =
- resolver.resolveEntity(
- null, prefix + "/in/testTranslationFromUTF16toUTF8.xml").getByteStream();
+ InputStream refStream = new FileInputStream(prefix + "/in/testTranslationFromUTF16toUTF8.xml");
byte refBytes[] = JavaUtils.getBytesFromStream(refStream);
boolean equal = java.security.MessageDigest.isEqual(refBytes, c14nBytes);
@@ -1033,10 +1028,6 @@ public class Canonicalizer20010315Test {
ParserConfigurationException, CanonicalizationException,
InvalidCanonicalizerException, TransformerException, XPathExpressionException {
- // org.xml.sax.EntityResolver resolver = new TestVectorResolver();
- // documentBuilder.setEntityResolver(resolver);
- // Document doc = documentBuilder.parse(resolver.resolveEntity(null, fileIn));
-
Document doc = XMLUtils.read(fileIn, validating, false, new IgnoreAllErrorHandler());
Modified: santuario/xml-security-java/branches/2.1.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.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java?rev=1862079&r1=1862078&r2=1862079&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer11Test.java Tue Jun 25 16:50:00 2019
@@ -331,43 +331,6 @@ public class Canonicalizer11Test {
}
}
-// /**
-// * The XPath data model represents data using UCS characters.
-// * Implementations MUST use XML processors that support UTF-8 and UTF-16
-// * and translate to the UCS character domain. For UTF-16, the leading byte
-// * order mark is treated as an artifact of encoding and stripped from the
-// * UCS character data (subsequent zero width non-breaking spaces appearing
-// * within the UTF-16 data are not removed) [UTF-16, Section 3.2]. Support
-// * for ISO-8859-1 encoding is RECOMMENDED, and all other character encodings
-// * are OPTIONAL.
-// *
-// * $todo$ implement the test
-// * @throws CanonicalizationException
-// * @throws java.io.FileNotFoundException
-// * @throws java.io.IOException
-// * @throws InvalidCanonicalizerException
-// * @throws javax.xml.parsers.ParserConfigurationException
-// * @throws org.xml.sax.SAXException
-// * @throws javax.xml.transform.TransformerException
-// */
-// public static void testTranslationFromUTF16toUTF8() throws Exception {
-//
-// String val =
-// "<UTF16>The german &auml (which is Unicode &#xE4;): "ä"</UTF16>";
-// byte utf16[] = convertToUTF16(val.getBytes());
-// Canonicalizer c14n =
-// Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
-// byte c14nBytes[] = c14n.canonicalize(utf16);
-// org.xml.sax.EntityResolver resolver = new TestVectorResolver();
-// InputStream refStream = resolver.resolveEntity(
-// null,
-// prefix + "/in/testTranslationFromUTF16toUTF8.xml")
-// .getByteStream();
-// byte refBytes[] = JavaUtils.getBytesFromStream(refStream);
-// boolean equal = java.security.MessageDigest.isEqual(refBytes, c14nBytes);
-//
-// assertTrue("Parser does not translate to UCS character domain", equal);
-// }
//
// /**
// * Method testXMLAttributes1
Modified: santuario/xml-security-java/branches/2.1.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.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java?rev=1862079&r1=1862078&r2=1862079&view=diff
==============================================================================
--- santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/branches/2.1.x-fixes/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315Test.java Tue Jun 25 16:50:00 2019
@@ -435,11 +435,7 @@ public class Canonicalizer20010315Test {
// Canonicalizer c14n =
// Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
// byte c14nBytes[] = c14n.canonicalize(utf16);
-// org.xml.sax.EntityResolver resolver = new TestVectorResolver();
-// InputStream refStream = resolver.resolveEntity(
-// null,
-// prefix + "/in/testTranslationFromUTF16toUTF8.xml")
-// .getByteStream();
+// InputStream refStream = new FileInputStream(prefix + "/in/testTranslationFromUTF16toUTF8.xml");
// byte refBytes[] = JavaUtils.getBytesFromStream(refStream);
// boolean equal = java.security.MessageDigest.isEqual(refBytes, c14nBytes);
//