You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@locus.apache.org on 2000/10/05 22:22:59 UTC

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

pierred     00/10/05 13:22:59

  Modified:    jasper/src/share/org/apache/jasper/compiler
                        ParserController.java
  Log:
  Fix for the following bug:
  "Requesting a non-existent JSP page returns an error 500
  that reports a java.io.FileNotFoundException as the root cause."
  
  A 404 should instead be sent back.
  
  ParserController will now simply let a FileNotFoundException go
  up the food chain so that JspServletWrapper::service() can
  appropriately call response.sendError(HttpServletResponse.SC_NOT_FOUND...)
  
  Revision  Changes    Path
  1.2       +5 -7      jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java
  
  Index: ParserController.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParserController.java	2000/09/19 19:19:21	1.1
  +++ ParserController.java	2000/10/05 20:22:58	1.2
  @@ -162,7 +162,9 @@
       //*********************************************************************
       // Parse
   
  -    public void parse(String inFileName) throws JasperException {
  +    public void parse(String inFileName) 
  +	throws FileNotFoundException, JasperException 
  +    {
           parse(inFileName, null);
       }
   
  @@ -174,7 +176,7 @@
        * @param The name of the jsp file to be parsed.
        */
       public void parse(String inFileName, String encoding)
  -	throws JasperException
  +	throws FileNotFoundException, JasperException
       {
           //p("parse(" + inFileName + ", " + encoding + ")");
           resolveFileName(inFileName);
  @@ -212,8 +214,6 @@
               } else {
                   (new Parser(ctxt, file, encoding, reader, jspHandler)).parse();
               }
  -        } catch (FileNotFoundException ex) {
  -            throw new JasperException(ex);
           } finally {
               if (reader != null) {
                   try {
  @@ -401,7 +401,7 @@
       }
   
       private InputStreamReader getReader(File file, String encoding)
  -	throws JasperException
  +	throws FileNotFoundException, JasperException
       {
           InputStream in;
           InputStreamReader reader;
  @@ -419,8 +419,6 @@
   		reader = new InputStreamReader(in, encoding);
   	    }
   	    return reader;
  -	} catch (FileNotFoundException ex) {
  -	    throw new JasperException(ex);
   	} catch (UnsupportedEncodingException ex) {
   	    throw new JasperException(ex);
   	}