diff --git a/VERSION.txt b/VERSION.txt index 1d8a8d66202..ff479e72bef 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,5 +1,6 @@ jetty-7.5.0-SNAPSHOT + 351516 Refactored sessions to better support nosql session managers + + 351576 Do not use deprecated method File.toURL() jetty-7.4.4.v20110707 July 7th 2011 + 308851 Converted all jetty-client module tests to JUnit 4 diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/ContextDeployer.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/ContextDeployer.java index f979243d75f..a4520fabfea 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/ContextDeployer.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/ContextDeployer.java @@ -219,7 +219,7 @@ public class ContextDeployer extends AbstractLifeCycle @Deprecated public void setConfigurationDir(File file) throws Exception { - setConfigurationDir(Resource.newResource(file.toURL())); + setConfigurationDir(Resource.newResource(Resource.toURL(file))); } /* ------------------------------------------------------------ */ diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java index 0a5f541afd9..7418a2877b4 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/MockAppProvider.java @@ -52,7 +52,7 @@ public class MockAppProvider extends AbstractLifeCycle implements AppProvider WebAppContext context = new WebAppContext(); File war = new File(webappsDir,app.getOriginId().substring(5)); - context.setWar(Resource.newResource(war.toURI().toURL()).toString()); + context.setWar(Resource.newResource(Resource.toURL(war)).toString()); String path = war.getName(); diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java index db047df32e3..270b9fbcd89 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java @@ -42,6 +42,7 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.PathAssert; import org.eclipse.jetty.toolchain.test.TestingDir; import org.eclipse.jetty.util.IO; +import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.xml.XmlConfiguration; import org.junit.Assert; @@ -132,7 +133,7 @@ public class XmlConfiguredJetty public void addConfiguration(File xmlConfigFile) throws MalformedURLException { - _xmlConfigurations.add(xmlConfigFile.toURI().toURL()); + _xmlConfigurations.add(Resource.toURL(xmlConfigFile)); } public void addConfiguration(String testConfigName) throws MalformedURLException diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java index 99081c499ef..efb44bba5fe 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerTest.java @@ -271,7 +271,7 @@ public class ContextHandlerTest ContextHandler handler = new ContextHandler(); assertTrue("Not a directory " + testDirectory,testDirectory.isDirectory()); - handler.setBaseResource(Resource.newResource(testDirectory.toURI().toURL())); + handler.setBaseResource(Resource.newResource(Resource.toURL(testDirectory))); List paths = new ArrayList(handler.getResourcePaths(root)); assertEquals(2,paths.size()); diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Classpath.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Classpath.java index 0e83c27b7ba..0f49e0b28b8 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Classpath.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Classpath.java @@ -127,7 +127,7 @@ public class Classpath { URL[] urls = new URL[cnt]; for (int i=0; i < cnt; i++) { try { - String u=((_elements.elementAt(i))).toURL().toString(); + String u=_elements.elementAt(i).toURI().toURL().toString(); urls[i] = new URL(encodeFileURL(u)); } catch (MalformedURLException e) {} } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java index e37b223e88f..21efe8a76af 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/FileResource.java @@ -183,7 +183,7 @@ public class FileResource extends URLResource String can=_file.getCanonicalPath(); if (abs.length()!=can.length() || !abs.equals(can)) - _alias=new File(can).toURI().toURL(); + _alias=Resource.toURL(new File(can)); _aliasChecked=true; diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java index ae3945f7376..f74a3844703 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java @@ -160,7 +160,7 @@ public abstract class Resource implements ResourceFactory resource=resource.substring(2); File file=new File(resource).getCanonicalFile(); - url=file.toURI().toURL(); + url=Resource.toURL(file); URLConnection connection=url.openConnection(); connection.setUseCaches(useCaches); @@ -642,5 +642,15 @@ public abstract class Resource implements ResourceFactory throw new IllegalArgumentException(destination+" exists"); writeTo(new FileOutputStream(destination),0,-1); } - + + /* ------------------------------------------------------------ */ + /** Generate a properly encoded URL from a {@link File} instance. + * @param file Target file. + * @return URL of the target file. + * @throws MalformedURLException + */ + public static URL toURL(File file) throws MalformedURLException + { + return Resource.toURL(file); + } } diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java index 6d15e3726a9..899452f69ac 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlParser.java @@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParserFactory; import org.eclipse.jetty.util.LazyList; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.resource.Resource; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -212,7 +213,7 @@ public class XmlParser { if (Log.isDebugEnabled()) Log.debug("parse: " + file); - return parse(new InputSource(file.toURL().toString())); + return parse(new InputSource(Resource.toURL(file).toString())); } /* ------------------------------------------------------------ */