tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Houghton <...@volunteermatch.org>
Subject patch for org.apache.jasper.CommandLineContext to mangle package names
Date Fri, 22 Mar 2002 01:31:49 GMT
Sometime in the recent past someone noticed that the mapping of a jsp 
file's name to a class name is not one-to-one -- the filename needs 
mangling to conform to java identifiers and to make sure that classes 
aren't named after keywords.

Whoever did this missed the fact that the same mangling needs to happen 
to the intermediate directories that are used to create the package 
name.  I've attached a patch that liberally grabs the mangling code from 
org.apache.jasper.compiler.CommandLineCompiler and drops it into 
org.apache.jasper.CommandLineContext to do that work.

As a heads-up, there's another problem that may need addressing in the 
class name mangling -- if a file is named, for instance, "com.jsp" or 
"org.jsp", the classname shadows any imports from the "com" or "org" 
packages respectively (this is a general problem, these are just 
examples).  I'm not really sure how to get around this -- the simple way 
would be to prepend each class name with some likely-never-to-be-used 
character sequence; the intelligent way would require actually parsing 
the generated .java to make sure that no top-level package name is being 
shadowed.

This requires a little more intelligence than what I was willing to put 
in for this patch. :)

- a.

Mime
View raw message