Bug 42202 - if you install tomcat in a directory with spaces it ignores TLD files inside jar files
Summary: if you install tomcat in a directory with spaces it ignores TLD files inside ...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.24
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-23 14:07 UTC by Rodrigo Urubatan
Modified: 2007-04-25 09:36 UTC (History)
0 users



Attachments
a patch that fixes this bug (936 bytes, patch)
2007-04-23 14:08 UTC, Rodrigo Urubatan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rodrigo Urubatan 2007-04-23 14:07:38 UTC
if you install tomcat or a web application in a directory with spaces in the
name, for example "C:\Program Files\vds\tomcat" for tomcat or "C:\Program
Files\vds\console" for a web application.
the TLD files that are inside the META-INF directory of the jar files will not
be loaded.

the problem is is the file treatment inside the TldConfig class ...
I have attached a patch with the correction.
this bug is found in Tomcat 6 too
Comment 1 Rodrigo Urubatan 2007-04-23 14:08:36 UTC
Created attachment 20023 [details]
a patch that fixes this bug
Comment 2 Remy Maucherat 2007-04-23 14:22:06 UTC
If you could explain how this patch is a good idea and solves something, I would
be interested :)
Comment 3 Rodrigo Urubatan 2007-04-23 15:43:41 UTC
in the current code tomcat gets all the URLs from the URLClassloader, and call
the getFile() method to get the file name, after it creates a File object and
gets the CanonicalName to create the final File object that will be used later ...
but the CanonicalName when it is running on windows and has spaces on the name,
is some thing like:
Program%20Files/...
when the file object is created, and the exists method is called it returns
false because the File object does not know how to convert %20 to " " ...
if you look at the code in the patch, instead of calling the getFile, creating a
File object, getCanonicalName, create another File object that does not know how
to handle %20 ...

I just take the original URL object, call the toURI method and pass it to the
apropriate File constructor that will handle the %20 correctly ...

with this patch it works fine, and loads the TLDs from the applications that are
in directories with spaces in the names ...
Comment 4 Remy Maucherat 2007-04-24 06:42:48 UTC
Ok, but your patch was not good (not all URLs are %xx encoded).
Comment 5 Rodrigo Urubatan 2007-04-24 07:17:08 UTC
but the URI class understand all URI formats, being it %xx encoded or not ...
Comment 6 Remy Maucherat 2007-04-24 07:44:31 UTC
How about stopping using "..." ?
The issue has been fixed in the 6 branch, but not using your patch.
Comment 7 Rodrigo Urubatan 2007-04-24 08:02:46 UTC
Ok, I'll not use "..." 
the fix is already in the trunk? I have just tested it and it still not working
Comment 8 Rodrigo Urubatan 2007-04-25 07:37:02 UTC
testes in tomcat 6 trunk and the bug still there.
Comment 9 Remy Maucherat 2007-04-25 08:00:46 UTC
This is not the case. Please do not reopen this bug report.
Comment 10 Rodrigo Urubatan 2007-04-25 09:07:34 UTC
so this bug will not bi fixed?
change it to wont be fixed, but not to fixed, because it is not fixed.
Comment 11 Remy Maucherat 2007-04-25 09:11:18 UTC
If you're out there to post nonsense, then I suggest you do not post (it is very
easy to verify the patch I committed will fix the problem you reported, and I
have also tested the fix). This is a bug report, not your blog.
Comment 12 Rodrigo Urubatan 2007-04-25 09:36:32 UTC
sorry, it appears that I was having a problem with the proxy I'm behind here.
I updated twice the sources and it was not downloading did not had your patch.
I had to download all again from another network without a proxy to get the
sources with your patch applied.
Sorry again.