Use of deprecated toUrl method makes sitemesh unable to load sitemesh.xml (and possibly other files) #18

yortx opened this Issue Jul 3, 2012 · 2 comments


None yet

2 participants

yortx commented Jul 3, 2012

Sitemesh uses the deprecated ".toURL" method to get streams to read files, which warns that special and illegal URL characters are not escaped. I'd like to use the special character '#' in the war name, so that tomcat deploys it to a subfolder, but after converting the path to the sitemesh.xml file to an URL, it's interpreted as an anchor, and it can't load the config files.

The solution is just to replace the call to .toUrl in the file objects to the suggested in the deprecated comment: "toURI().toURL()".

@yortx yortx pushed a commit to yortx/sitemesh2 that referenced this issue Jul 3, 2012
Jorge Barreiro Fix the use of deprecated method .toURL in File objects. Fixes issue #18
@yortx yortx referenced this issue Jul 3, 2012

Fixes issue #18 #19

ghorstm commented Jul 17, 2012

The fix doesn't really help as it still wants to make an URL from a file that is already confirmed to exist an be readable.
Why not just make a
is = new FileInputStream(configFile);
this works with paths that have the special char "#" in them.

ghorstm commented Jul 17, 2012

ok, had a small other problem here, toURI().toURL() works for the "#" issue, but do we really need it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment