tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser ParserUtils.java
Date Wed, 09 Oct 2002 18:25:39 GMT
luehe       2002/10/09 11:25:39

  Modified:    jasper2/src/share/org/apache/jasper/compiler JspConfig.java
                        TagLibraryInfoImpl.java TldLocationsCache.java
               jasper2/src/share/org/apache/jasper/xmlparser
                        ParserUtils.java
  Log:
  Removed redundant code
  
  Revision  Changes    Path
  1.5       +4 -5      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java
  
  Index: JspConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JspConfig.java	9 Oct 2002 17:41:13 -0000	1.4
  +++ JspConfig.java	9 Oct 2002 18:25:39 -0000	1.5
  @@ -105,8 +105,7 @@
   	    return;
   	}
   
  -	ClassLoader cl = this.getClass().getClassLoader();
  -	ParserUtils pu = ParserUtils.createParserUtils(cl);
  +	ParserUtils pu = new ParserUtils();
   	TreeNode webApp = pu.parseXMLDocument(WEB_XML, is);
   	if (webApp == null || !"2.4".equals(webApp.findAttribute("version"))) {
   	    defaultIsELIgnored = "true";
  
  
  
  1.16      +4 -5      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
  
  Index: TagLibraryInfoImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TagLibraryInfoImpl.java	27 Sep 2002 20:18:32 -0000	1.15
  +++ TagLibraryInfoImpl.java	9 Oct 2002 18:25:39 -0000	1.16
  @@ -258,8 +258,7 @@
           Vector functionVector = new Vector();
   
           // Create an iterator over the child elements of our <taglib> element
  -        ClassLoader cl = ctxt.getClassLoader();
  -        ParserUtils pu = ParserUtils.createParserUtils(cl);
  +        ParserUtils pu = new ParserUtils();
           TreeNode tld = pu.parseXMLDocument(uri, in);
           Iterator list = tld.findChildren();
   
  
  
  
  1.8       +12 -13    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java
  
  Index: TldLocationsCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TldLocationsCache.java	7 Oct 2002 22:52:22 -0000	1.7
  +++ TldLocationsCache.java	9 Oct 2002 18:25:39 -0000	1.8
  @@ -118,7 +118,7 @@
       public static final int ROOT_REL_URI = 1;
       public static final int NOROOT_REL_URI = 2;
   
  -    static private final String WEB_XML = "/WEB-INF/web.xml";
  +    private static final String WEB_XML = "/WEB-INF/web.xml";
       
       /**
        * The mapping of the 'global' tag library URI to the location
  @@ -128,17 +128,21 @@
        *    [1] If the location is a jar file, this is the location
        *        of the tld.
        */
  -    private Hashtable mappings = new Hashtable();
  +    private Hashtable mappings;
   
  -    private Hashtable tlds = new Hashtable();
  +    private Hashtable tlds;
  +
  +    private boolean initialized;
  +    private ServletContext ctxt;
   
  -    private boolean initialized=false;
  -    ServletContext ctxt;
       //*********************************************************************
       // Constructor and Initilizations
       
       public TldLocationsCache(ServletContext ctxt) {
  -        this.ctxt=ctxt;
  +        this.ctxt = ctxt;
  +	mappings = new Hashtable();
  +	tlds = new Hashtable();
  +	initialized = false;
       }
   
       private void init() {
  @@ -168,10 +172,7 @@
           }
   
           // Parse the web application deployment descriptor
  -        ClassLoader cl =
  -            // (ClassLoader) ctxt.getAttribute(Constants.SERVLET_CLASS_LOADER);
  -            this.getClass().getClassLoader();
  -        ParserUtils pu = ParserUtils.createParserUtils(cl);
  +        ParserUtils pu = new ParserUtils();
           TreeNode webtld = pu.parseXMLDocument(WEB_XML, is);
   
   	// Allow taglib be an element of the root or jsp-config (JSP2.0)
  @@ -286,7 +287,6 @@
       private String parseTldForUri(String resourcePath, InputStream in) 
           throws JasperException
       {
  -
           // Parse the tag library descriptor at the specified resource path
           ParserUtils pu = new ParserUtils();
           TreeNode tld = pu.parseXMLDocument(resourcePath, in);
  @@ -297,7 +297,6 @@
                   return body;
           }
           return null; // No <uri> element is present
  -
       }
   
       //*********************************************************************
  @@ -333,7 +332,7 @@
        *     ROOT_REL_URI
        *     NOROOT_REL_URI
        */
  -    static public int uriType(String uri) {
  +    public static int uriType(String uri) {
           if (uri.indexOf(':') != -1) {
               return ABS_URI;
           } else if (uri.startsWith("/")) {
  
  
  
  1.6       +7 -74     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java
  
  Index: ParserUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ParserUtils.java	9 Oct 2002 16:47:31 -0000	1.5
  +++ ParserUtils.java	9 Oct 2002 18:25:39 -0000	1.6
  @@ -54,19 +54,9 @@
    */ 
   package org.apache.jasper.xmlparser;
   
  -
   import java.io.InputStream;
   import java.io.IOException;
   
  -import java.lang.reflect.InvocationTargetException;
  -import java.lang.reflect.Method;
  -
  -import java.net.MalformedURLException;
  -import java.net.URL;
  -import java.net.URLClassLoader;
  -
  -import java.util.HashMap;
  -
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
  @@ -100,13 +90,6 @@
    */
   
   public class ParserUtils {
  -    // ----------------------------------------------------- Instance Variables
  -
  -    /**
  -     * The class loader to use for accessing our XML parser.
  -     */
  -    protected ClassLoader classLoader = null;
  -
   
       /**
        * An error handler for use when parsing XML documents.
  @@ -120,7 +103,8 @@
       static EntityResolver entityResolver = new MyEntityResolver();
   
       // Turn off for JSP 2.0 until switch over to using xschema.
  -    public static boolean validating=false;
  +    public static boolean validating = false;
  +
   
       // --------------------------------------------------------- Public Methods
   
  @@ -173,20 +157,6 @@
   
           // Convert the resulting document to a graph of TreeNodes
           return (convert(null, document.getDocumentElement()));
  -        
  -
  -    }
  -
  -
  -    /**
  -     * Set the class loader used to access our XML parser.
  -     *
  -     * @param classLoader The new class loader
  -     */
  -    public void setClassLoader(ClassLoader classLoader) {
  -
  -        this.classLoader = classLoader;
  -
       }
   
   
  @@ -204,7 +174,6 @@
   
           // Construct a new TreeNode for this node
           TreeNode treeNode = new TreeNode(node.getNodeName(), parent);
  -        //         System.out.println("PU: " + node.getNodeName());
   
           // Convert all attributes of this node
           NamedNodeMap attributes = node.getAttributes();
  @@ -214,9 +183,6 @@
                   Node attribute = attributes.item(i);
                   treeNode.addAttribute(attribute.getNodeName(),
                                         attribute.getNodeValue());
  -                //                 System.out.println("PU: " + 
  -                //                                    attribute.getNodeName() + "=" + 
  -                //                                    attribute.getNodeValue());
               }
           }
   
  @@ -243,39 +209,6 @@
           
           // Return the completed TreeNode graph
           return (treeNode);
  -
  -    }
  -
  -
  -    // ------------------------------------------------------- Static Variables
  -
  -
  -    /**
  -     * The special class loaders for each web application's XML parser,
  -     * keyed by the web application class loader instance.  FIXME - this
  -     * probably interferes with garbage collection after an application reload.
  -     */
  -    //    private static HashMap classLoaders = new HashMap();
  -
  -
  -    // --------------------------------------------------------- Static Methods
  -
  -
  -    /**
  -     * Create (if necessary) and return an instance of ParserUtils that has
  -     * been loaded by our subordinate class loader (and therefore should have
  -     * access to the XML parser that is visible to repositories of that
  -     * class loader).
  -     *
  -     * @param parentLoader The web application class loader
  -     */
  -    public synchronized static ParserUtils createParserUtils
  -        (ClassLoader parentLoader) {
  -
  -        ParserUtils parserUtils = null;
  -        parserUtils = new ParserUtils();
  -        parserUtils.setClassLoader(parentLoader);
  -        return (parserUtils);
       }
   }
   
  @@ -297,14 +230,14 @@
                           Constants.getString("jsp.error.internal.filenotfound", 
   					    new Object[]{resourcePath}));
   		}
  -		InputSource isrc =
  -		    new InputSource(input);
  +		InputSource isrc = new InputSource(input);
   		return isrc;
   	    }
   	}
  -        System.out.println("Resolve entity failed"  + publicId + " " + systemId );
  +        System.out.println("Resolve entity failed"  + publicId + " "
  +			   + systemId );
   	Constants.message("jsp.error.parse.xml.invalidPublicId",
  -				new Object[]{publicId}, Logger.ERROR);
  +			  new Object[]{publicId}, Logger.ERROR);
           return null;
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message