Kaydet (Commit) 5d1c5d55 authored tarafından rbuj's avatar rbuj Kaydeden (comit) Caolán McNamara

beanshell: [deprecation] toURL() in File has been deprecated

http://docs.oracle.com/javase/6/docs/api/java/io/File.html#toURL()

Change-Id: I7f5ee6ad89ce73fa3b217396669fa42ea6e75c8a
Reviewed-on: https://gerrit.libreoffice.org/10473Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 5a51968c
...@@ -42,3 +42,44 @@ ...@@ -42,3 +42,44 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
--- misc/BeanShell/src/bsh/classpath/BshClassPath.java 2003-12-19 17:14:28.000000000 +0100
+++ misc/build/BeanShell/src/bsh/classpath/BshClassPath.java 2014-07-22 21:02:52.000000000 +0200
@@ -42,6 +42,7 @@
import bsh.StringUtil;
import bsh.ClassPathException;
import java.lang.ref.WeakReference;
+import java.lang.SecurityException;
import bsh.NameSource;
/**
@@ -569,7 +570,7 @@
// Java deals with relative paths for it's bootstrap loader
// but JARClassLoader doesn't.
urls[i] = new File(
- new File(paths[i]).getCanonicalPath() ).toURL();
+ new File(paths[i]).getCanonicalPath() ).toURI().toURL();
} catch ( IOException e ) {
throw new ClassPathException("can't parse class path: "+e);
}
@@ -641,9 +642,11 @@
{
//String rtjar = System.getProperty("java.home")+"/lib/rt.jar";
String rtjar = getRTJarPath();
- URL url = new File( rtjar ).toURL();
+ URL url = new File( rtjar ).toURI().toURL();
bootClassPath = new BshClassPath(
"Boot Class Path", new URL[] { url } );
+ } catch ( SecurityException e ) {
+ throw new ClassPathException(" can't access to boot jar: "+e);
} catch ( MalformedURLException e ) {
throw new ClassPathException(" can't find boot jar: "+e);
}
@@ -686,7 +689,7 @@
public static void main( String [] args ) throws Exception {
URL [] urls = new URL [ args.length ];
for(int i=0; i< args.length; i++)
- urls[i] = new File(args[i]).toURL();
+ urls[i] = new File(args[i]).toURI().toURL();
BshClassPath bcp = new BshClassPath( "Test", urls );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment