SANTUARIO-537 - Fixed parameter name "disallowDocTypeDeclarations". Thanks to Peter De Maeyer for the patch. This closes #26.


git-svn-id: https://svn.apache.org/repos/asf/santuario/xml-security-java/trunk@1876477 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/xml/security/parser/XMLParser.java b/src/main/java/org/apache/xml/security/parser/XMLParser.java
index e92528b..6987e0b 100644
--- a/src/main/java/org/apache/xml/security/parser/XMLParser.java
+++ b/src/main/java/org/apache/xml/security/parser/XMLParser.java
@@ -27,6 +27,6 @@
  */
 public interface XMLParser {
 
-    Document parse(InputStream inputStream, boolean disAllowDocTypeDeclarations) throws XMLParserException;
+    Document parse(InputStream inputStream, boolean disallowDocTypeDeclarations) throws XMLParserException;
 
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/xml/security/parser/XMLParserImpl.java b/src/main/java/org/apache/xml/security/parser/XMLParserImpl.java
index 817fe97..4cb4aa5 100644
--- a/src/main/java/org/apache/xml/security/parser/XMLParserImpl.java
+++ b/src/main/java/org/apache/xml/security/parser/XMLParserImpl.java
@@ -52,7 +52,7 @@
             Collections.synchronizedMap(new WeakHashMap<ClassLoader, Queue<DocumentBuilder>>());
 
     @Override
-    public Document parse(InputStream inputStream, boolean disAllowDocTypeDeclarations) throws XMLParserException {
+    public Document parse(InputStream inputStream, boolean disallowDocTypeDeclarations) throws XMLParserException {
         try {
             ClassLoader loader = getContextClassLoader();
             if (loader == null) {
@@ -60,12 +60,12 @@
             }
             // If the ClassLoader is null then just create a DocumentBuilder and use it
             if (loader == null) {
-                DocumentBuilder documentBuilder = createDocumentBuilder(disAllowDocTypeDeclarations);
+                DocumentBuilder documentBuilder = createDocumentBuilder(disallowDocTypeDeclarations);
                 return documentBuilder.parse(inputStream);
             }
 
-            Queue<DocumentBuilder> queue = getDocumentBuilderQueue(disAllowDocTypeDeclarations, loader);
-            DocumentBuilder documentBuilder = getDocumentBuilder(disAllowDocTypeDeclarations, queue);
+            Queue<DocumentBuilder> queue = getDocumentBuilderQueue(disallowDocTypeDeclarations, loader);
+            DocumentBuilder documentBuilder = getDocumentBuilder(disallowDocTypeDeclarations, queue);
             Document doc = documentBuilder.parse(inputStream);
             repoolDocumentBuilder(documentBuilder, queue);
             return doc;
@@ -74,9 +74,9 @@
         }
     }
 
-    private static Queue<DocumentBuilder> getDocumentBuilderQueue(boolean disAllowDocTypeDeclarations, ClassLoader loader) throws ParserConfigurationException {
+    private static Queue<DocumentBuilder> getDocumentBuilderQueue(boolean disallowDocTypeDeclarations, ClassLoader loader) throws ParserConfigurationException {
         Map<ClassLoader, Queue<DocumentBuilder>> docBuilderCache =
-                disAllowDocTypeDeclarations ? DOCUMENT_BUILDERS_DISALLOW_DOCTYPE : DOCUMENT_BUILDERS;
+                disallowDocTypeDeclarations ? DOCUMENT_BUILDERS_DISALLOW_DOCTYPE : DOCUMENT_BUILDERS;
         Queue<DocumentBuilder> queue = docBuilderCache.get(loader);
         if (queue == null) {
             queue = new ArrayBlockingQueue<>(parserPoolSize);
@@ -86,19 +86,19 @@
         return queue;
     }
 
-    private static DocumentBuilder getDocumentBuilder(boolean disAllowDocTypeDeclarations, Queue<DocumentBuilder> queue) throws ParserConfigurationException {
+    private static DocumentBuilder getDocumentBuilder(boolean disallowDocTypeDeclarations, Queue<DocumentBuilder> queue) throws ParserConfigurationException {
         DocumentBuilder db = queue.poll();
         if (db == null) {
-            db = createDocumentBuilder(disAllowDocTypeDeclarations);
+            db = createDocumentBuilder(disallowDocTypeDeclarations);
         }
         return db;
     }
 
-    private static DocumentBuilder createDocumentBuilder(boolean disAllowDocTypeDeclarations) throws ParserConfigurationException {
+    private static DocumentBuilder createDocumentBuilder(boolean disallowDocTypeDeclarations) throws ParserConfigurationException {
         DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
         f.setNamespaceAware(true);
         f.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
-        f.setFeature("http://apache.org/xml/features/disallow-doctype-decl", disAllowDocTypeDeclarations);
+        f.setFeature("http://apache.org/xml/features/disallow-doctype-decl", disallowDocTypeDeclarations);
         return f.newDocumentBuilder();
     }
 
diff --git a/src/main/java/org/apache/xml/security/utils/XMLUtils.java b/src/main/java/org/apache/xml/security/utils/XMLUtils.java
index d7dbb9b..b6b4661 100644
--- a/src/main/java/org/apache/xml/security/utils/XMLUtils.java
+++ b/src/main/java/org/apache/xml/security/utils/XMLUtils.java
@@ -1000,9 +1000,9 @@
         return true;
     }
 
-    public static Document read(InputStream inputStream, boolean disAllowDocTypeDeclarations) throws XMLParserException {
+    public static Document read(InputStream inputStream, boolean disallowDocTypeDeclarations) throws XMLParserException {
         // Delegate to XMLParser implementation
-        return xmlParserImpl.parse(inputStream, disAllowDocTypeDeclarations);
+        return xmlParserImpl.parse(inputStream, disallowDocTypeDeclarations);
     }
 
     /**
diff --git a/src/test/java/org/apache/xml/security/test/dom/parser/CustomXMLParserImpl.java b/src/test/java/org/apache/xml/security/test/dom/parser/CustomXMLParserImpl.java
index 943fa15..d2736ae 100644
--- a/src/test/java/org/apache/xml/security/test/dom/parser/CustomXMLParserImpl.java
+++ b/src/test/java/org/apache/xml/security/test/dom/parser/CustomXMLParserImpl.java
@@ -33,8 +33,8 @@
     private static boolean called;
 
     @Override
-    public Document parse(InputStream inputStream, boolean disAllowDocTypeDeclarations) throws XMLParserException {
-        Document doc = super.parse(inputStream, disAllowDocTypeDeclarations);
+    public Document parse(InputStream inputStream, boolean disallowDocTypeDeclarations) throws XMLParserException {
+        Document doc = super.parse(inputStream, disallowDocTypeDeclarations);
         called = true;
         return doc;
     }