You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by James Duncan Davidson <du...@x180.com> on 2000/01/10 09:08:09 UTC

FW: 2 Bugfixes for Tomcat team


----------
From: Bradley Neuberg <bn...@randomwalk.com>
Date: Tue, 28 Dec 1999 17:50:39 -0500
To: webmaster@jakarta.apache.org
Subject: 2 Bugfixes for Tomcat team

Howdy there Jakarta webmaster!  I can't seem to find any email address
to submit bug reports and bug fixes to, so I'm sending this to you.
Could you forward it to the correct person on the Tomcat sub-project of
the Jakarta team?

I found an error that doesn't allow JSPs to be loaded from WAR files.
The error that is returned from a WAR file if a JSP file is requested is
a NullPointerException in org.apache.jasper.compiler.JspCompiler at line
262 in the method computeClassFileData.  There are two reasons for this
bug.  First, in getResource() in
org.apache.tomcat.core.ServletContextFacade around line 267:

267:  mappedPath = mappedPath.substring(1, mappedPath.length());

the mappedPath is created incorrectly.  The line above results in a JAR
URL of the following:
war:file:D:\java\projects\RWPortfolio\Startup
Project\bneuberg\webapp.war!jsp/AddTransaction.jsp

when in fact the URL should be

war:file:D:\java\projects\RWPortfolio\Startup
Project\bneuberg\webapp.war!/jsp/AddTransaction.jsp

This can be fixed as follows:

267:  mappedPath = mappedPath.substring(0, mappedPath.length());

where we take the substring from zero instead of one.

The second error is in getRealPath() in the same class around line 193:

193:     } else {
194:        // realPath is null
195:     }

What is occurring here is that the if statement before this checked to
see if we are dealing with an expanded WAR file:

163:       if (context.isWARExpanded()) {

because this is a compressed unexpanded WAR file, this if statement
evaluates to false, and then drops into the else at line 193.  However,
this else doesn't do anything!  What it should be is the following:

193:     } else {
194:         return url.toString();
195:     }

After making these two fixes JSP support works with unexpanded WAR
files.  I don't have the time to submit code nor do I have CVS access,
so I'm emailing this instead.  Servlet's still don't work from
unexpanded WAR files; I'll try to send a fix for this.  Thanks for all
your work on Jakarta!

Thanks,
  Brad Neuberg
  Random Walk Computing