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/compiler Mark.java JspReader.java JspDocumentParser.java ErrorDispatcher.java
Date Tue, 13 Jul 2004 18:40:09 GMT
luehe       2004/07/13 11:40:09

  Modified:    jasper2/src/share/org/apache/jasper/compiler Mark.java
                        JspReader.java JspDocumentParser.java
                        ErrorDispatcher.java
  Log:
  Fixed Bugzilla 30073 ("NPE when compiling .jspx with broken xml format in jspcmode")
  
  Revision  Changes    Path
  1.9       +7 -2      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Mark.java
  
  Index: Mark.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Mark.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Mark.java	12 Jul 2004 22:54:33 -0000	1.8
  +++ Mark.java	13 Jul 2004 18:40:08 -0000	1.9
  @@ -18,6 +18,7 @@
   import java.util.Stack;
   import java.net.URL;
   import java.net.MalformedURLException;
  +import org.apache.jasper.JspCompilationContext;
   
   /**
    * Mark represents a point in the JSP input. 
  @@ -53,6 +54,7 @@
       // reader that owns this mark (so we can look up fileid's)
       private JspReader reader;
   
  +    private JspCompilationContext ctxt;
   
       /**
        * Constructor
  @@ -68,6 +70,7 @@
            String inBaseDir, String inEncoding) {
   
           this.reader = reader;
  +        this.ctxt = reader.getJspCompilationContext();
           this.stream = inStream;
           this.cursor = 0;
           this.line = 1;
  @@ -86,6 +89,7 @@
       Mark(Mark other) {
   
           this.reader = other.reader;
  +        this.ctxt = other.reader.getJspCompilationContext();
           this.stream = other.stream;
           this.fileId = other.fileId;
           this.fileName = other.fileName;
  @@ -106,9 +110,10 @@
       /**
        * Constructor
        */    
  -    Mark(String filename, int line, int col) {
  +    Mark(JspCompilationContext ctxt, String filename, int line, int col) {
   
           this.reader = null;
  +        this.ctxt = ctxt;
           this.stream = null;
           this.cursor = 0;
           this.line = line;
  @@ -210,7 +215,7 @@
        * @exception MalformedURLException if the resource pathname is incorrect
        */
       public URL getURL() throws MalformedURLException {
  -        return reader.getResource(getFile());
  +        return ctxt.getResource(getFile());
       }
   
       public String toShortString() {
  
  
  
  1.21      +8 -0      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java
  
  Index: JspReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- JspReader.java	12 May 2004 17:45:37 -0000	1.20
  +++ JspReader.java	13 Jul 2004 18:40:08 -0000	1.21
  @@ -99,6 +99,14 @@
   	singleFile = false;
   	pushFile(fname, encoding, reader);
       }
  +
  +    /*
  +     * @return JSP compilation context with which this JspReader is 
  +     * associated
  +     */
  +    JspCompilationContext getJspCompilationContext() {
  +        return context;
  +    }
       
       String getFile(int fileid) {
   	return (String) sourceFiles.elementAt(fileid);
  
  
  
  1.81      +12 -10    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java
  
  Index: JspDocumentParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- JspDocumentParser.java	6 May 2004 22:55:23 -0000	1.80
  +++ JspDocumentParser.java	13 Jul 2004 18:40:08 -0000	1.81
  @@ -199,7 +199,8 @@
               jspDocParser.err.jspError("jsp.error.data.file.read", path, ioe);
           } catch (SAXParseException e) {
               jspDocParser.err.jspError
  -                (new Mark(path, e.getLineNumber(), e.getColumnNumber()),
  +                (new Mark(jspDocParser.ctxt, path, e.getLineNumber(),
  +                          e.getColumnNumber()),
                    e.getMessage());
           } catch (Exception e) {
               jspDocParser.err.jspError(e);
  @@ -271,8 +272,8 @@
                   locator);
           }
   
  -        startMark =
  -            new Mark(path, locator.getLineNumber(), locator.getColumnNumber());
  +        startMark = new Mark(ctxt, path, locator.getLineNumber(),
  +                             locator.getColumnNumber());
   
           if (attrs != null) {
               /*
  @@ -483,7 +484,7 @@
               if (charBuffer.length() > 0) {
                   new Node.TemplateText(charBuffer.toString(), startMark, current);
               }
  -            startMark = new Mark(path, locator.getLineNumber(),
  +            startMark = new Mark(ctxt, path, locator.getLineNumber(),
                                    locator.getColumnNumber());
               charBuffer = null;
               return;
  @@ -516,7 +517,7 @@
                           ttext = new CharArrayWriter();
                           //We subtract two from the column number to
                           //account for the '${' that we've already parsed
  -                        startMark = new Mark(path, line, column - 2);
  +                        startMark = new Mark(ctxt, path, line, column - 2);
                       }
                       // following "${" to first unquoted "}"
                       i++;
  @@ -550,7 +551,7 @@
                                   startMark,
                                   current);
                               ttext = new CharArrayWriter();
  -                            startMark = new Mark(path, line, column);
  +                            startMark = new Mark(ctxt, path, line, column);
                               break;
                           }
                           if (ch == '"')
  @@ -581,8 +582,8 @@
                   new Node.TemplateText(ttext.toString(), startMark, current);
               }
           }
  -        startMark =
  -            new Mark(path, locator.getLineNumber(), locator.getColumnNumber());
  +        startMark = new Mark(ctxt, path, locator.getLineNumber(),
  +                             locator.getColumnNumber());
   
           charBuffer = null;
       }
  @@ -668,6 +669,7 @@
           if (!inDTD) {
               startMark =
                   new Mark(
  +                    ctxt,
                       path,
                       locator.getLineNumber(),
                       locator.getColumnNumber());
  @@ -681,8 +683,8 @@
       public void startCDATA() throws SAXException {
   
           processChars();  // Flush char buffer and remove white spaces
  -        startMark =
  -            new Mark(path, locator.getLineNumber(), locator.getColumnNumber());
  +        startMark = new Mark(ctxt, path, locator.getLineNumber(),
  +                             locator.getColumnNumber());
       }
   
       /*
  
  
  
  1.21      +3 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java
  
  Index: ErrorDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ErrorDispatcher.java	25 May 2004 21:27:55 -0000	1.20
  +++ ErrorDispatcher.java	13 Jul 2004 18:40:08 -0000	1.21
  @@ -385,10 +385,12 @@
                   try {
                       file = where.getURL().toString();
                   } catch (MalformedURLException me) {
  +                    // Fallback to using context-relative path
                       file = where.getFile();
                   }
               } else {
  -                // Get the context-relative resource path
  +                // Get the context-relative resource path, so as to not
  +                // disclose any local filesystem details
                   file = where.getFile();
               }
   	    line = where.getLineNumber();
  
  
  

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


Mime
View raw message