[java-support] branch main updated: Add a disabled canary test for an apparent bug in JAXP.
Scott Cantor
cantor.2 at osu.edu
Wed Apr 6 14:39:57 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=b48c851703d5f7edd0416eaf6d74a2e7ed1e7fb7
The following commit(s) were added to refs/heads/main by this push:
new b48c851 Add a disabled canary test for an apparent bug in JAXP.
b48c851 is described below
commit b48c851703d5f7edd0416eaf6d74a2e7ed1e7fb7
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Apr 6 10:39:53 2022 -0400
Add a disabled canary test for an apparent bug in JAXP.
---
.../java/support/xml/SerializeSupportTest.java | 39 +++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java b/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
index 89bf9d8..552c0fc 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
@@ -30,6 +30,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -214,6 +215,42 @@ public class SerializeSupportTest {
Assert.assertEquals(SerializeSupport.nodeToString(dom.getFirstChild()), SerializeSupport.nodeToString(parent),
"Should serialize to same output");
assertEquals(dom.getFirstChild(), parent);
+ }
+
+ /**
+ * This test should in fact fail because the default XML version of 1.0 should not allow for
+ * the ASCII 25 code point in the text node.
+ *
+ * @throws XMLParserException
+ */
+ @Test(enabled=false) public void testXMLVersion() throws XMLParserException {
+
+ final Document doc = parserPool.newDocument();
+ final Element root = doc.createElementNS(null, "test");
+ doc.appendChild(root);
+ final StringBuilder data = new StringBuilder("foo");
+ data.append((char) 25);
+ data.append("bar");
+ final Text text = doc.createTextNode(data.toString());
+ root.appendChild(text);
+
+ final DOMImplementationLS domLS = SerializeSupport.getDOMImplementationLS(parent);
+ final LSSerializer serializer = SerializeSupport.getLSSerializer(domLS, null);
+ // Should be the default.
+ //serializer.getDomConfig().setParameter("well-formed", true);
+
+ final LSOutput serializerOut = domLS.createLSOutput();
+ final ByteArrayOutputStream output = new ByteArrayOutputStream();
+ serializerOut.setByteStream(output);
+ try {
+ serializer.write(doc, serializerOut);
+ Assert.fail("Should have thrown a DOM error.");
+ } catch (final DOMException e) {
+ // expected
+ }
+
+ //System.out.println(output.toString());
}
-}
+
+}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list