tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/xml XmlMapper.java
Date Thu, 19 Jul 2001 21:43:02 GMT
costin      01/07/19 14:43:02

  Modified:    src/share/org/apache/tomcat/util/compat Jdk11Compat.java
                        Jdk12Support.java
               src/share/org/apache/tomcat/util/xml XmlMapper.java
  Log:
  First part of the 2696 fix.
  
  Revision  Changes    Path
  1.6       +7 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk11Compat.java
  
  Index: Jdk11Compat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk11Compat.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Jdk11Compat.java	2001/06/17 18:09:14	1.5
  +++ Jdk11Compat.java	2001/07/19 21:43:02	1.6
  @@ -61,6 +61,8 @@
   import org.apache.tomcat.util.depend.*;
   
   import java.net.URL;
  +import java.util.ResourceBundle;
  +import java.util.Locale;
   
   /** General-purpose utility to provide backward-compatibility and JDK
       independence. This allow use of JDK1.2 ( or higher ) facilities if
  @@ -124,7 +126,11 @@
       }
   
       // Other methods, as needed
  -        
  +
  +    public java.util.ResourceBundle getBundle(String name, Locale loc, ClassLoader cl )
{
  +	return ResourceBundle.getBundle(name, loc);
  +    }
  +    
   
       // -------------------- Factory -------------------- 
       /** Get a compatibiliy helper class.
  
  
  
  1.4       +10 -0     jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk12Support.java
  
  Index: Jdk12Support.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/compat/Jdk12Support.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Jdk12Support.java	2001/06/17 18:09:13	1.3
  +++ Jdk12Support.java	2001/07/19 21:43:02	1.4
  @@ -118,6 +118,16 @@
           return null;
       }
   
  +    public java.util.ResourceBundle getBundle(String name, Locale loc, ClassLoader cl )
{
  +	if( cl==null )
  +	    cl=getContextClassLoader();
  +	if( cl==null )
  +	    return ResourceBundle.getBundle(name, loc);
  +	else
  +	    return ResourceBundle.getBundle(name, loc, cl);
  +    }
  +    
  +
       // -------------------- Support --------------------
       static class PrivilegedProxy implements PrivilegedExceptionAction
       {
  
  
  
  1.35      +20 -1     jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java
  
  Index: XmlMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- XmlMapper.java	2001/07/16 00:20:57	1.34
  +++ XmlMapper.java	2001/07/19 21:43:02	1.35
  @@ -14,6 +14,7 @@
   import org.xml.sax.*;
   import org.xml.sax.helpers.*;
   
  +import org.apache.tomcat.util.compat.*;
   
   /**
    * SAX Handler - it will read the XML and construct java objects
  @@ -75,7 +76,7 @@
   	throws SAXException
       {
   	try {
  -	    //	    if( debug>0) log(sp + "<" + tag + " " + attributes + ">");
  +	    if( debug>5) log(sp + " <" + tag + " " + attributes + ">");
   	    attributeStack[sp]=attributes;
   	    tagStack[sp]=tag;
   	    sp++;
  @@ -255,7 +256,14 @@
       public XmlMapper getMapper() {
   	return this;
       }
  +
  +    boolean useLocalLoader=true;
       
  +    public void useLocalLoader(boolean b ) {
  +	useLocalLoader=b;
  +    }
  +    static final Jdk11Compat jdk11Compat=Jdk11Compat.getJdkCompat();
  +
       /** read an XML file, construct and return the object hierarchy
        */
       public Object readXml(File xmlFile, Object root)
  @@ -266,12 +274,23 @@
   	    this.pushObject( root );
   	}
   	try {
  +	    // reset the context loader, so we find the parser in the current dir
  +	    ClassLoader cl=null;
  +	    if( useLocalLoader ) {
  +		cl=jdk11Compat.getContextClassLoader();
  +		jdk11Compat.setContextClassLoader( this.getClass().getClassLoader());
  +	    }
  +	    
   	    SAXParser parser=null;
   	    SAXParserFactory factory = SAXParserFactory.newInstance();
   	    factory.setNamespaceAware(false);
   	    factory.setValidating(validating);
   	    parser = factory.newSAXParser();
   	    parser.parse(xmlFile, this);
  +
  +	    if( useLocalLoader && cl!= null ) {
  +		jdk11Compat.setContextClassLoader(cl);
  +	    }
   
   	    return root;
   	    // assume the stack is in the right position.
  
  
  

Mime
View raw message