Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Jetty & UNC paths - a possible bug

http://bugs.eclipse.org

under RT/Jetty

thanks!
Jesse

On Tuesday, May 17, 2011, Michele Rossi <michele.rossi@xxxxxxxxx> wrote:
> Hi,we might have discovered a bug with the way Jetty handles UNC paths.
> We have a scenario where our jetty instances are deployed (and started) on Windows UNC paths.In such scenario my Spring stack fails as Jetty is unable to resolve the Resources correctly.
>
>
> The suspected culprit is org.eclipse.jetty.util.resource.Resource line 163
>
>
> File file=new File(resource).getCanonicalFile();
> url=new URL(URIUtil.encodePath(file.toURL().toString()));
>
> should be
>
> File file=new File(resource).getCanonicalFile();
> url=new URL(URIUtil.encodePath(file.toURI().toURL().toString()));
>
> java.io.File.toURL() is deprecated and it doesn't work correctly.
>
>
> The following code snippet shows what happens:
>
>
> String filestr = "\\\\192.168.150.83\\folder\\a.txt";
>
>  java.io.File f = new java.io.File(filestr);System.out.println("1 File: " + f);
>
> System.out.println("2 File.toURL: " + f.toURL());System.out.println("3 File.toURI: " + f.toURI());
>
> System.out.println("4 File.toURI.toURL: " + f.toURI().toURL());
> The output is
>
>
> 1 File: \\192.168.150.83\folder\a.txt2 File.toURL: file://192.168.150.83/folder/a.txt3 File.toURI: file:////192.168.150.83/folder/a.txt
>
> 4 File.toURI.toURL: file:////192.168.150.83/folder/a.txt
> As you can see 2 is totally wrong - it no longer references a UNC path.
>
>
> Could I file this as a bug?Is there a Jetty JIRA database?
>
>
> many thanks,Michele
>
>
>
>
>
>
>

-- 
--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx


Back to the top