diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarFileResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarFileResource.java index 7fa224ece1a..434aa887565 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarFileResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarFileResource.java @@ -211,19 +211,6 @@ class JarFileResource extends JarResource break; } } - - if (_directory && !_urlString.endsWith("/")) - { - _urlString+="/"; - try - { - _url=new URL(_urlString); - } - catch(MalformedURLException ex) - { - LOG.warn(ex); - } - } } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/URLResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/URLResource.java index 1a8ffdb7ac3..b696817e50b 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/URLResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/URLResource.java @@ -37,8 +37,8 @@ import org.eclipse.jetty.util.log.Logger; public class URLResource extends Resource { private static final Logger LOG = Log.getLogger(URLResource.class); - protected URL _url; - protected String _urlString; + protected final URL _url; + protected final String _urlString; protected URLConnection _connection; protected InputStream _in=null; @@ -48,7 +48,7 @@ public class URLResource extends Resource protected URLResource(URL url, URLConnection connection) { _url = url; - _urlString=_url.toString(); + _urlString=_url.toExternalForm(); _connection=connection; } @@ -116,14 +116,14 @@ public class URLResource extends Resource /* ------------------------------------------------------------ */ /** - * Returns true if the respresenetd resource is a container/directory. + * Returns true if the represented resource is a container/directory. * If the resource is not a file, resources ending with "/" are * considered directories. */ @Override public boolean isDirectory() { - return exists() && _url.toString().endsWith("/"); + return exists() && _urlString.endsWith("/"); }