You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2015/12/07 21:17:23 UTC

svn commit: r1718451 - /xerces/java/trunk/src/org/apache/xerces/parsers/SecureProcessingConfiguration.java

Author: mrglavas
Date: Mon Dec  7 20:17:23 2015
New Revision: 1718451

URL: http://svn.apache.org/viewvc?rev=1718451&view=rev
Log:
Fixing a defect. If the parser is reading an XML 1.1 document, the InternalEntityMonitor was not getting wired into the XML 1.1 pipeline.

Modified:
    xerces/java/trunk/src/org/apache/xerces/parsers/SecureProcessingConfiguration.java

Modified: xerces/java/trunk/src/org/apache/xerces/parsers/SecureProcessingConfiguration.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/parsers/SecureProcessingConfiguration.java?rev=1718451&r1=1718450&r2=1718451&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/SecureProcessingConfiguration.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/SecureProcessingConfiguration.java Mon Dec  7 20:17:23 2015
@@ -30,6 +30,7 @@ import java.util.Properties;
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.XMLEntityDescription;
 import org.apache.xerces.impl.XMLErrorReporter;
+import org.apache.xerces.impl.dtd.XMLDTDProcessor;
 import org.apache.xerces.impl.msg.XMLMessageFormatter;
 import org.apache.xerces.util.SecurityManager;
 import org.apache.xerces.util.SymbolTable;
@@ -43,6 +44,7 @@ import org.apache.xerces.xni.grammars.XM
 import org.apache.xerces.xni.parser.XMLComponentManager;
 import org.apache.xerces.xni.parser.XMLConfigurationException;
 import org.apache.xerces.xni.parser.XMLDTDFilter;
+import org.apache.xerces.xni.parser.XMLDTDScanner;
 import org.apache.xerces.xni.parser.XMLDTDSource;
 import org.apache.xerces.xni.parser.XMLEntityResolver;
 import org.apache.xerces.xni.parser.XMLInputSource;
@@ -274,26 +276,36 @@ public final class SecureProcessingConfi
     /** Configures the XML 1.0 pipeline. */
     protected void configurePipeline() {
         super.configurePipeline();
-        configurePipelineCommon();
+        configurePipelineCommon(true);
     }
     
     /** Configures the XML 1.1 pipeline. */
     protected void configureXML11Pipeline() {
         super.configureXML11Pipeline();
-        configurePipelineCommon();
+        configurePipelineCommon(false);
     }
     
-    private void configurePipelineCommon() {
+    private void configurePipelineCommon(boolean isXML10) {
         if (fSecurityManager != null) {
             fTotalEntitySize = 0;
             if (fInternalEntityMonitor == null) {
                 fInternalEntityMonitor = new InternalEntityMonitor();
             }
             // Reconfigure DTD pipeline. Insert internal entity decl monitor.
-            fDTDScanner.setDTDHandler(fInternalEntityMonitor);
-            fInternalEntityMonitor.setDTDSource(fDTDScanner);
-            fInternalEntityMonitor.setDTDHandler(fDTDProcessor);
-            fDTDProcessor.setDTDSource(fInternalEntityMonitor);
+            final XMLDTDScanner dtdScanner;
+            final XMLDTDProcessor dtdProcessor;
+            if (isXML10) {
+                dtdScanner = fDTDScanner;
+                dtdProcessor = fDTDProcessor;
+            }
+            else {
+                dtdScanner = fXML11DTDScanner;
+                dtdProcessor = fXML11DTDProcessor;
+            }
+            dtdScanner.setDTDHandler(fInternalEntityMonitor);
+            fInternalEntityMonitor.setDTDSource(dtdScanner);
+            fInternalEntityMonitor.setDTDHandler(dtdProcessor);
+            dtdProcessor.setDTDSource(fInternalEntityMonitor);
         }
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org