[java-support] branch maint-7 updated: Add a test checking disallow-doctype feature.

Scott Cantor cantor.2 at osu.edu
Mon Jan 22 17:28:02 EST 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch maint-7
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=a4533c652ccc5fec351e6d47e07bb450a9a40b62

The following commit(s) were added to refs/heads/maint-7 by this push:
       new  a4533c6   Add a test checking disallow-doctype feature.
a4533c6 is described below

commit a4533c652ccc5fec351e6d47e07bb450a9a40b62
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jan 22 17:27:59 2018 -0500

    Add a test checking disallow-doctype feature.
---
 .../utilities/java/support/xml/BasicParserPoolTest.java     | 13 ++++++++++++-
 .../utilities/java/support/xml/dtdParserPoolTest.xml        |  5 +++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java b/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
index 4feb4bc..573f962 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/xml/BasicParserPoolTest.java
@@ -63,6 +63,8 @@ public class BasicParserPoolTest {
     private static final String SCHEMA_FILE = TEST_DIR + "basicParserPoolTest.xsd";
 
     private static final String XML_FILE = TEST_DIR + "basicParserPoolTest.xml";
+    
+    private static final String DTD_FILE = TEST_DIR + "dtdParserPoolTest.xml";
 
     private BasicParserPool basicParserPool;
     /** Max size of the pool we're using. */
@@ -489,9 +491,18 @@ public class BasicParserPoolTest {
         
         // Get file name the same way that SchemaBuilderTest does
         checkParsedDocument(basicParserPool.parse(new FileReader("src/test/resources/" + XML_FILE)));
-
     }
 
+    @Test(expectedExceptions=XMLParserException.class)
+    public void testDTD() throws IOException, ComponentInitializationException, XMLParserException, FileNotFoundException {
+
+        basicParserPool.initialize();
+        
+        Resource r = new ClassPathResource(DTD_FILE);
+        
+        basicParserPool.parse(r.getInputStream());
+    }
+    
     @Test public void testNewDocument() throws ComponentInitializationException, XMLParserException {
         basicParserPool.initialize();
         Assert.assertNotNull(basicParserPool.newDocument(), "Create new document");
diff --git a/src/test/resources/net/shibboleth/utilities/java/support/xml/dtdParserPoolTest.xml b/src/test/resources/net/shibboleth/utilities/java/support/xml/dtdParserPoolTest.xml
new file mode 100644
index 0000000..6c57c53
--- /dev/null
+++ b/src/test/resources/net/shibboleth/utilities/java/support/xml/dtdParserPoolTest.xml
@@ -0,0 +1,5 @@
+<!DOCTYPE Parent PUBLIC "simple" "simple.dtd">
+<Parent xmlns="https://www.example.org/Example">
+    <Child1/>
+    <Child2/>
+</Parent>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list