+1
Craig
Larry Isaacs wrote:
> In Tomcat 3.2b7 (and earlier), invoking
> http://localhost:8080/test/jsp/Helloworld.jsp results in an NPE in
> JspCompiler.isOutDated(). This occurs because getRealPath() returns
> null since the 'w' should be uppercase, hence it is considered an
> "unsafe" path. To make this error return "file not found", I propose
> the following patches for 3.2b7.
>
> ===== JspCompiler.java Patch =====
> RCS file:
>/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspCompiler.java,v
> retrieving revision 1.14.2.1
> diff -u -r1.14.2.1 JspCompiler.java
> --- JspCompiler.java 2000/07/25 20:45:09 1.14.2.1
> +++ JspCompiler.java 2000/11/15 12:13:12
> @@ -304,7 +304,11 @@
> public boolean isOutDated() {
> File jspReal = null;
>
> - jspReal = new File(ctxt.getRealPath(jsp.getPath()));
> + String realPath = ctxt.getRealPath(jsp.getPath());
> + if (realPath == null)
> + return true;
> +
> + jspReal = new File(realPath);
>
> File classFile = new File(getClassFileName());
> if (classFile.exists()) {
> ==================================
>
> ===== JspReader.java patch =====
> RCS file:
>/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java,v
> retrieving revision 1.16.2.4
> diff -u -r1.16.2.4 JspReader.java
> --- JspReader.java 2000/11/06 04:08:14 1.16.2.4
> +++ JspReader.java 2000/11/15 12:12:29
> @@ -171,6 +171,9 @@
> ? file.getAbsolutePath()
> : context.getRealPath(file.toString());
>
> + if (longName == null)
> + throw new FileNotFoundException(file.toString());
> +
> int fileid = registerSourceFile(longName);
>
> if (fileid == -1)
> ================================
>
> This probably won't eliminate the head scratching, but at least they will
> be scratching their heads for the right reason. :-) Also, this will make
> section 6.7 in the Readme correct about the error seen due to a case mismatch.
>
> If no one objects, I'll commit these changes this afternoon.
>
> Cheers,
> Larry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]