You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ak...@hyperreal.org on 1999/11/23 20:27:27 UTC

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

akv         99/11/23 11:27:23

  Modified:    src/share/org/apache/jasper/compiler JspReader.java
  Log:
  Fix for JDK 1.1/Windows related bug with relative names in jsp:include etc.
  
  Submitted by: Hans Bergsten <ha...@gefionsoftware.com>
  
  Revision  Changes    Path
  1.4       +11 -13    jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java
  
  Index: JspReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JspReader.java	1999/11/08 03:14:27	1.3
  +++ JspReader.java	1999/11/23 19:27:16	1.4
  @@ -86,7 +86,7 @@
   public class JspReader {
       protected char stream[] = null;
       protected Mark current  = null;
  -    File master = null;
  +    String master = null;
   
       Vector sourceFiles = new Vector();
       Stack includeStack;
  @@ -141,19 +141,17 @@
       public void pushFile(String name, String encoding) 
   	throws ParseException, FileNotFoundException
       {
  -	// File is relative to the master page being compiled:
  -	String parent = master == null ? null : master.getParent();
  -        File tmp = new File(name);
  -
  -	boolean isAbsolute = name.startsWith("/") || name.startsWith("\\");
  -
  -	if (parent == null || isAbsolute)
  -	    pushFile(new File(name), encoding);
  -	else
  -	    pushFile(new File(parent, name), encoding);
  +        String parent = master == null ?
  +            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)
  -	    master = new File(name);
  +        if (master == null)
  +            master = name;
       }
   
       /**