You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2004/02/10 00:12:57 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ParserController.java

kinman      2004/02/09 15:12:57

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        ParserController.java
  Log:
  - Fix bugzilla 26796: <%@ include %> fails when tag files are referenced in
    a tag directives.
  
  Revision  Changes    Path
  1.50      +20 -15    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java
  
  Index: ParserController.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- ParserController.java	3 Jan 2004 12:12:21 -0000	1.49
  +++ ParserController.java	9 Feb 2004 23:12:57 -0000	1.50
  @@ -134,8 +134,9 @@
   	// (using an include directive), ctxt.getTagFileJar() returns the 
   	// JAR file from which to read the tag file or included resource,
   	// respectively.
  -	return parse(inFileName, null, ctxt.isTagFile(), false,
  -                     ctxt.getTagFileJarUrl());
  +        isTagFile = ctxt.isTagFile();
  +        directiveOnly = false;
  +        return doParse(inFileName, null, ctxt.getTagFileJarUrl());
       }
   
       /**
  @@ -149,8 +150,9 @@
       public Node.Nodes parse(String inFileName, Node parent,
   			    URL jarFileUrl)
   	        throws FileNotFoundException, JasperException, IOException {
  -        // For files statically included, keep isTagfile and directiveOnly
  -	return parse(inFileName, parent, isTagFile, directiveOnly, jarFileUrl);
  +        // For files that are statically included, isTagfile and directiveOnly
  +        // remain unchanged.
  +        return doParse(inFileName, parent, jarFileUrl);
       }
   
       /**
  @@ -163,8 +165,15 @@
        */
       public Node.Nodes parseTagFileDirectives(String inFileName)
   	        throws FileNotFoundException, JasperException, IOException {
  -	return parse(inFileName, null, true, true,
  -		     (URL) ctxt.getTagFileJarUrls().get(inFileName));
  +        boolean isTagFileSave = isTagFile;
  +        boolean directiveOnlySave = directiveOnly;
  +        isTagFile = true;
  +        directiveOnly = true;
  +        Node.Nodes page = doParse(inFileName, null,
  +                             (URL) ctxt.getTagFileJarUrls().get(inFileName));
  +        directiveOnly = directiveOnlySave;
  +        isTagFile = isTagFileSave;
  +        return page;
       }
   
       /**
  @@ -181,18 +190,14 @@
        * @param jarFile The JAR file from which to read the JSP page or tag file,
        * or null if the JSP page or tag file is to be read from the filesystem
        */
  -    private Node.Nodes parse(String inFileName,
  -			     Node parent,
  -			     boolean isTagFile,
  -			     boolean directivesOnly,
  -			     URL jarFileUrl)
  +    private Node.Nodes doParse(String inFileName,
  +                               Node parent,
  +                               URL jarFileUrl)
   	        throws FileNotFoundException, JasperException, IOException {
   
   	Node.Nodes parsedPage = null;
   	isEncodingSpecifiedInProlog = false;
   	isDefaultPageEncoding = false;
  -        this.isTagFile = isTagFile;
  -        this.directiveOnly = directivesOnly;
   
   	JarFile jarFile = getJarFile(jarFileUrl);
   	String absFileName = resolveFileName(inFileName);
  @@ -229,7 +234,7 @@
   	    try {
   		parsedPage = JspDocumentParser.parse(this, absFileName,
   						     jarFile, parent,
  -						     isTagFile, directivesOnly,
  +						     isTagFile, directiveOnly,
   						     sourceEnc,
   						     jspConfigPageEnc,
   						     isEncodingSpecifiedInProlog);
  @@ -251,7 +256,7 @@
   						    sourceEnc, inStreamReader,
   						    err);
                   parsedPage = Parser.parse(this, jspReader, parent, isTagFile,
  -					  directivesOnly, jarFileUrl,
  +					  directiveOnly, jarFileUrl,
   					  sourceEnc, jspConfigPageEnc,
   					  isDefaultPageEncoding);
               } finally {
  
  
  

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