There are a few problems caused by "#" in directory names, and it
looks to me like they're at least partly Tomcat's fault.

1. The classloader problem that you reported: Tomcat converts file
pathnames to URLs for URLClassLoader, using File.toURL which handles
"#" poorly. This could be Sun's fault, but following a note in their
docs here:
http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#toURL()
I was able to fix this problem in Tomcat by calling File.toURI and
then URI.toURL. (That's the workaround I referred to before.)

2. After fixing problem 1, I found that JSPs don't work because Jasper
screws up the pathname of its output directory. There's some code in
JspCompilationContext that concatenates directories using both URL and
file syntax, truncating it at the "#" and using both "\" and "/"
directory separators (in Windows). It looks screwy to me, I don't see
why it should be using URLs to concatenate file pathnames.

3, etc. There are several other places in Tomcat where File.toURL is
used and I think it could have problems with "#" in pathnames, but I
don't know what the effects are.

So it's pretty clear to me that Tomcat could handle pathnames with "#"
chars better. Is it worth the trouble to find and fix all the related
problems, or is it simpler to tell people not to use unusual directory
names? I could help fix some of the problems, but there are some that
I haven't figured out.
-- 
Len

On 8/12/07, Markus Schiegl <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Len Popp wrote:
> > I'm not sure the topic is ready to be nailed shut just yet...
> >
> Oh, i have no objections keeping it alive. Unfortunately my java skills
> are limited so reporting and testing is the best i can do to help.
>
> > The problem is due to the way Tomcat converts pathnames to URLs when
> > it uses URLClassLoader. Tomcat calls the method File.toURL and that
> > fails when there's a "#" in the pathname. But the Javadoc for
> > File.toURL suggests a workaround: Convert the pathname to a URI first,
> > then to a URL.
>
> thanks for your confirmation. Looking through bugs.sun.com this seems to
> be an inherent behaviour with reports starting in 1999. So fixing it in
> Tomcat would be great, but i'm hesitating calling it a "bug" from
> Tomcats POV - more a feature request.
>
> @Len: Do you have a (javadoc)link for this workaround/suggestion? thx!
>
> >
> > I tried that (in ClassLoaderFactory) and it seem to fix the
> > classloader problem. Tomcat starts up fine - but it can't compile any
> > JSPs. So there are other components of Tomcat that have similar
> > problems.
>
> I tried something with a similar result. Just moved CATALINA_HOME to
> some non-#-directory but left CATALINA_BASE as it was. This way Tomcat
> started but webapplications could not be deployed/did not work.
>
> >
> > So, my advice is to see how hard it would be for you to get the #s out
> > of your pathnames. That may be easier than fixing Tomcat.
>
> I'm just waiting for some feedback from sun but avoiding #s in directory
> and file names in the java world is probably the way to go. Otherwise
> every java application must be forced to workaround this problem. And
> the latter is more work - if possible at all - than getting rid of #s.
>
> kind regards,
>    Markus
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to