mrglavas    2004/01/21 14:52:43

  Modified:    java/src/org/apache/xerces/xinclude XIncludeHandler.java
  Log:
  Fixing a few bugs. We weren't propogating the parent parser's
  entity resolver or security manager to the child parser.
  
  Revision  Changes    Path
  1.18      +40 -6     
xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java
  
  Index: XIncludeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- XIncludeHandler.java      21 Jan 2004 17:07:30 -0000      1.17
  +++ XIncludeHandler.java      21 Jan 2004 22:52:43 -0000      1.18
  @@ -69,6 +69,7 @@
   import org.apache.xerces.util.IntStack;
   import org.apache.xerces.util.ObjectFactory;
   import org.apache.xerces.util.ParserConfigurationSettings;
  +import org.apache.xerces.util.SecurityManager;
   import org.apache.xerces.util.URI;
   import org.apache.xerces.util.XMLAttributesImpl;
   import org.apache.xerces.util.XMLResourceIdentifierImpl;
  @@ -202,10 +203,14 @@
       protected static final String ERROR_REPORTER =
           Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
   
  -    /** Property identifier: grammar pool . */
  +    /** Property identifier: entity resolver. */
       protected static final String ENTITY_RESOLVER =
           Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
   
  +    /** property identifier: security manager. */
  +    protected static final String SECURITY_MANAGER =
  +        Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
  +
       /** Recognized features. */
       private static final String[] RECOGNIZED_FEATURES =
           { ALLOW_UE_AND_NOTATION_EVENTS };
  @@ -214,12 +219,11 @@
       private static final Boolean[] FEATURE_DEFAULTS = { Boolean.TRUE };
   
       /** Recognized properties. */
  -
       private static final String[] RECOGNIZED_PROPERTIES =
  -        { ERROR_REPORTER, ENTITY_RESOLVER };
  +        { ERROR_REPORTER, ENTITY_RESOLVER, SECURITY_MANAGER };
   
       /** Property defaults. */
  -    private static final Object[] PROPERTY_DEFAULTS = { null, null };
  +    private static final Object[] PROPERTY_DEFAULTS = { null, null, null };
   
       // instance variables
   
  @@ -247,6 +251,7 @@
       protected XIncludeNamespaceSupport fNamespaceContext;
       protected XMLErrorReporter fErrorReporter;
       protected XMLEntityResolver fEntityResolver;
  +    protected SecurityManager fSecurityManager;
   
       // these are needed for XML Base processing
       protected XMLResourceIdentifier fCurrentBaseURI;
  @@ -353,6 +358,7 @@
           catch (XMLConfigurationException e) {
           }
   
  +        // Get error reporter.
           try {
               XMLErrorReporter value =
                   (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
  @@ -367,6 +373,7 @@
               fErrorReporter = null;
           }
   
  +        // Get entity resolver.
           try {
               XMLEntityResolver value =
                   (XMLEntityResolver)componentManager.getProperty(
  @@ -382,6 +389,23 @@
           catch (XMLConfigurationException e) {
               fEntityResolver = null;
           }
  +             
  +        // Get security manager.
  +        try {
  +            SecurityManager value =
  +                (SecurityManager)componentManager.getProperty(
  +                    SECURITY_MANAGER);
  +
  +            if (value != null) {
  +                fSecurityManager = value;
  +                if (fChildConfig != null) {
  +                    fChildConfig.setProperty(SECURITY_MANAGER, value);
  +                }
  +            }
  +        }
  +        catch (XMLConfigurationException e) {
  +            fSecurityManager = null;
  +        }
   
           fSettings = new ParserConfigurationSettings();
           copyFeatures(componentManager, fSettings);
  @@ -461,6 +485,13 @@
                   fChildConfig.setProperty(propertyId, value);
               }
           }
  +        if (propertyId.equals(SECURITY_MANAGER)) {
  +            fSecurityManager = (SecurityManager)value;
  +            if (fChildConfig != null) {
  +                fChildConfig.setProperty(propertyId, value);
  +            }
  +        }        
  +        
       } // setProperty(String,Object)
   
       /** 
  @@ -1171,8 +1202,11 @@
                           ObjectFactory.findClassLoader(),
                           true);
   
  -                // use the same error reporter
  -                fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter);
  +                // use the same error reporter, entity resolver, and security 
manager.
  +                if (fErrorReporter != null) 
fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter);
  +                if (fEntityResolver != null) 
fChildConfig.setProperty(ENTITY_RESOLVER, fEntityResolver);
  +                if (fSecurityManager != null) 
fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager);                
  +                
                   // use the same namespace context
                   fChildConfig.setProperty(
                       Constants.XERCES_PROPERTY_PREFIX
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to