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

2004-08-10 Thread luehe
luehe   2004/08/10 16:33:02

  Modified:jasper2/src/share/org/apache/jasper/compiler Tag: TOMCAT_5_0
Mark.java JspReader.java JspDocumentParser.java
ErrorDispatcher.java
  Log:
  Ported fix for Bugzilla 30073 (NPE when compiling .jspx with broken xml format in 
jspcmode)
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.7.2.2   +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.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- Mark.java 10 Aug 2004 23:16:08 -  1.7.2.1
  +++ Mark.java 10 Aug 2004 23:33:01 -  1.7.2.2
  @@ -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.20.2.1  +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.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- JspReader.java12 May 2004 17:45:37 -  1.20
  +++ JspReader.java10 Aug 2004 23:33:02 -  1.20.2.1
  @@ -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.80.2.1  +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.80.2.1
  diff -u -r1.80 -r1.80.2.1
  --- JspDocumentParser.java6 May 2004 22:55:23 -   1.80
  +++ JspDocumentParser.java10 Aug 2004 23:33:02 -  1.80.2.1
  @@ -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) {

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

2004-07-13 Thread luehe
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  ChangesPath
  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 -  1.8
  +++ Mark.java 13 Jul 2004 18:40:08 -  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.java12 May 2004 17:45:37 -  1.20
  +++ JspReader.java13 Jul 2004 18:40:08 -  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.java6 May 2004 22:55:23 -   1.80
  +++ JspDocumentParser.java13 Jul 2004 18:40:08 -  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,