tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Isaacs <Larry.Isa...@sas.com>
Subject [PATCH] Fix for nested <%@ include ... %> bug
Date Fri, 07 Jul 2000 21:51:22 GMT
I would like to ask again that the nested <%@ include ...%> bug be fixed.  Since not
a lot has changed with JspReader.java, the following patch still works and introduces no failures
in Watchdog.  Please consider for inclusion in Tomcat 3.2.

An earlier e-mail about this included a set of test files to demonstrate that it works.  I
can provide them again if desired, though the ".." patch sent earlier will be needed for the
test to pass.

Thanks,
Larry

========== JspReader.java patchfile ==========
--- JspReader.java.orig	Fri Jul 07 03:20:58 2000
+++ JspReader.java	Fri Jul 07 17:26:18 2000
@@ -138,13 +138,13 @@
             null : master.substring(0, master.lastIndexOf("/") + 1);
         boolean isAbsolute = name.startsWith("/");
 
-        if (parent == null || isAbsolute)
-            pushFile(new File(name), encoding);
-        else
-            pushFile(new File(parent + name), encoding);
-
-        if (master == null)
+        if (parent == null || isAbsolute) {
             master = name;
+            pushFile(new File(name), encoding);
+        } else {
+            master = parent + name;
+            pushFile(new File(master), encoding);
+        }
     }
 
     /**
@@ -202,10 +202,10 @@
 	    caw.close();
 	    if (current == null) {
 		current = new Mark( this, caw.toCharArray(), fileid, getFile(fileid),
-				    file.getParent(), encoding );
+				    master, encoding );
 	    } else {
 		current.pushStream( caw.toCharArray(), fileid, getFile(fileid),
-				    file.getParent(), encoding );
+				    master, encoding );
 	    }
 
         } catch (FileNotFoundException fnfe) {
@@ -239,7 +239,10 @@
 		(Constants.getString("jsp.error.file.not.registered",
 				     new Object[] {fName}));
 
-	return current.popStream();
+	boolean r = current.popStream();
+	if (r)
+		master = current.baseDir;
+	return r;
     }
 	
     protected JspReader(String file, JspCompilationContext ctx, String encoding) 
==============================================

__________
Larry Isaacs		
Larry.Isaacs@sas.com
SAS Institute Inc.

Mime
View raw message