提交 2dd66726 编写于 作者: J jglick

File.toURL() is deprecated.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19471 71c3de6d-444a-0410-be80-ed276b4c234a
上级 3ec951ec
...@@ -123,19 +123,19 @@ public class ClassicPluginStrategy implements PluginStrategy { ...@@ -123,19 +123,19 @@ public class ClassicPluginStrategy implements PluginStrategy {
baseResourceURL = resolve(archive, baseResourceURL = resolve(archive,
manifest.getMainAttributes().getValue("Resource-Path")) manifest.getMainAttributes().getValue("Resource-Path"))
.toURL(); .toURI().toURL();
} else { } else {
File classes = new File(expandDir, "WEB-INF/classes"); File classes = new File(expandDir, "WEB-INF/classes");
if (classes.exists()) if (classes.exists())
paths.add(classes.toURL()); paths.add(classes.toURI().toURL());
File lib = new File(expandDir, "WEB-INF/lib"); File lib = new File(expandDir, "WEB-INF/lib");
File[] libs = lib.listFiles(JAR_FILTER); File[] libs = lib.listFiles(JAR_FILTER);
if (libs != null) { if (libs != null) {
for (File jar : libs) for (File jar : libs)
paths.add(jar.toURL()); paths.add(jar.toURI().toURL());
} }
baseResourceURL = expandDir.toURL(); baseResourceURL = expandDir.toURI().toURL();
} }
File disableFile = new File(archive.getPath() + ".disabled"); File disableFile = new File(archive.getPath() + ".disabled");
if (disableFile.exists()) { if (disableFile.exists()) {
...@@ -259,12 +259,12 @@ public class ClassicPluginStrategy implements PluginStrategy { ...@@ -259,12 +259,12 @@ public class ClassicPluginStrategy implements PluginStrategy {
fs.setDir(dir); fs.setDir(dir);
fs.setIncludes(file.getName()); fs.setIncludes(file.getName());
for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) { for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) {
paths.add(new File(dir,included).toURL()); paths.add(new File(dir,included).toURI().toURL());
} }
} else { } else {
if(!file.exists()) if(!file.exists())
throw new IOException("No such file: "+file); throw new IOException("No such file: "+file);
paths.add(file.toURL()); paths.add(file.toURI().toURL());
} }
} }
} }
......
...@@ -121,7 +121,7 @@ public class WindowsInstallerLink extends ManagementLink { ...@@ -121,7 +121,7 @@ public class WindowsInstallerLink extends ManagementLink {
copy(req, rsp, dir, getClass().getResource("/windows-service/hudson.exe"), "hudson.exe"); copy(req, rsp, dir, getClass().getResource("/windows-service/hudson.exe"), "hudson.exe");
copy(req, rsp, dir, getClass().getResource("/windows-service/hudson.xml"), "hudson.xml"); copy(req, rsp, dir, getClass().getResource("/windows-service/hudson.xml"), "hudson.xml");
if(!hudsonWar.getCanonicalFile().equals(new File(dir,"hudson.war").getCanonicalFile())) if(!hudsonWar.getCanonicalFile().equals(new File(dir,"hudson.war").getCanonicalFile()))
copy(req, rsp, dir, hudsonWar.toURL(), "hudson.war"); copy(req, rsp, dir, hudsonWar.toURI().toURL(), "hudson.war");
// install as a service // install as a service
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
......
...@@ -356,7 +356,7 @@ public abstract class Slave extends Node implements Serializable { ...@@ -356,7 +356,7 @@ public abstract class Slave extends Node implements Serializable {
URL res = Hudson.getInstance().servletContext.getResource("/WEB-INF/" + fileName); URL res = Hudson.getInstance().servletContext.getResource("/WEB-INF/" + fileName);
if(res==null) { if(res==null) {
// during the development this path doesn't have the files. // during the development this path doesn't have the files.
res = new URL(new File(".").getAbsoluteFile().toURL(),"target/generated-resources/WEB-INF/"+fileName); res = new URL(new File(".").getAbsoluteFile().toURI().toURL(),"target/generated-resources/WEB-INF/"+fileName);
} }
return res; return res;
} }
......
...@@ -114,7 +114,7 @@ public class Main { ...@@ -114,7 +114,7 @@ public class Main {
// this needs to be able to see maven. // this needs to be able to see maven.
ClassRealm remoting = new DefaultClassRealm(launcher.getWorld(),"hudson-remoting", launcher.getSystemClassLoader()); ClassRealm remoting = new DefaultClassRealm(launcher.getWorld(),"hudson-remoting", launcher.getSystemClassLoader());
remoting.setParent(launcher.getWorld().getRealm("plexus.core.maven")); remoting.setParent(launcher.getWorld().getRealm("plexus.core.maven"));
remoting.addConstituent(remotingJar.toURL()); remoting.addConstituent(remotingJar.toURI().toURL());
final Socket s = new Socket((String)null,tcpPort); final Socket s = new Socket((String)null,tcpPort);
......
...@@ -137,7 +137,7 @@ final class RemoteClassLoader extends URLClassLoader { ...@@ -137,7 +137,7 @@ final class RemoteClassLoader extends URLClassLoader {
if(f.exists()) if(f.exists())
// be defensive against external factors that might have deleted this file, since we use /tmp // be defensive against external factors that might have deleted this file, since we use /tmp
// see http://www.nabble.com/Surefire-reports-tt17554215.html // see http://www.nabble.com/Surefire-reports-tt17554215.html
return f.toURL(); return f.toURI().toURL();
} }
long startTime = System.nanoTime(); long startTime = System.nanoTime();
...@@ -151,7 +151,7 @@ final class RemoteClassLoader extends URLClassLoader { ...@@ -151,7 +151,7 @@ final class RemoteClassLoader extends URLClassLoader {
File res = makeResource(name, image); File res = makeResource(name, image);
resourceMap.put(name,res); resourceMap.put(name,res);
return res.toURL(); return res.toURI().toURL();
} catch (IOException e) { } catch (IOException e) {
throw new Error("Unable to load resource "+name,e); throw new Error("Unable to load resource "+name,e);
} }
...@@ -161,7 +161,7 @@ final class RemoteClassLoader extends URLClassLoader { ...@@ -161,7 +161,7 @@ final class RemoteClassLoader extends URLClassLoader {
Vector<URL> r = new Vector<URL>(files.size()); Vector<URL> r = new Vector<URL>(files.size());
for (File f : files) { for (File f : files) {
if(!f.exists()) return null; // abort if(!f.exists()) return null; // abort
r.add(f.toURL()); r.add(f.toURI().toURL());
} }
return r; return r;
} }
......
...@@ -83,7 +83,7 @@ class DummyClassLoader extends ClassLoader { ...@@ -83,7 +83,7 @@ class DummyClassLoader extends ClassLoader {
os.write(loadTransformedClassImage("hudson.remoting.test.TestCallable")); os.write(loadTransformedClassImage("hudson.remoting.test.TestCallable"));
os.close(); os.close();
f.deleteOnExit(); f.deleteOnExit();
return f.toURL(); return f.toURI().toURL();
} catch (IOException e) { } catch (IOException e) {
return null; return null;
} }
......
...@@ -65,7 +65,7 @@ public interface HudsonHomeLoader { ...@@ -65,7 +65,7 @@ public interface HudsonHomeLoader {
* Either a zip file or a directory that contains the home image. * Either a zip file or a directory that contains the home image.
*/ */
public CopyExisting(File source) throws MalformedURLException { public CopyExisting(File source) throws MalformedURLException {
this(source.toURL()); this(source.toURI().toURL());
} }
/** /**
......
...@@ -963,7 +963,7 @@ public abstract class HudsonTestCase extends TestCase { ...@@ -963,7 +963,7 @@ public abstract class HudsonTestCase extends TestCase {
if(dir.exists() && MetaClassLoader.debugLoader==null) if(dir.exists() && MetaClassLoader.debugLoader==null)
try { try {
MetaClassLoader.debugLoader = new MetaClassLoader( MetaClassLoader.debugLoader = new MetaClassLoader(
new URLClassLoader(new URL[]{dir.toURL()})); new URLClassLoader(new URL[]{dir.toURI().toURL()}));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
throw new AssertionError(e); throw new AssertionError(e);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册