fix File.toURL deprecated api to get correct url for resources from classloader

This commit is contained in:
Dennis Ushakov
2010-05-08 01:28:53 +04:00
parent a82236e2ed
commit 306f5fd6df
@@ -181,7 +181,7 @@ public class ClassloaderUtil {
final StringTokenizer tokenizer = new StringTokenizer(classpath, File.separator, false);
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken();
aClasspathElements.add(new File(token).toURL());
aClasspathElements.add(new File(token).toURI().toURL());
}
}
else {
@@ -217,7 +217,7 @@ public class ClassloaderUtil {
final Class<ClassloaderUtil> aClass = ClassloaderUtil.class;
final String selfRoot = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
final URL selfRootUrl = new File(selfRoot).getAbsoluteFile().toURL();
final URL selfRootUrl = new File(selfRoot).getAbsoluteFile().toURI().toURL();
classPath.add(selfRootUrl);
final File libFolder = new File(aFolderPath + File.separator + "lib");
@@ -238,7 +238,7 @@ public class ClassloaderUtil {
if (!isJarOrZip(file)) {
continue;
}
final URL url = file.toURL();
final URL url = file.toURI().toURL();
if (selfRootUrl.equals(url)) {
continue;
}
@@ -262,7 +262,7 @@ public class ClassloaderUtil {
final StringTokenizer tokenizer = new StringTokenizer(System.getProperty("idea.additional.classpath", ""), File.pathSeparator, false);
while (tokenizer.hasMoreTokens()) {
String pathItem = tokenizer.nextToken();
classPath.add(new File(pathItem).toURL());
classPath.add(new File(pathItem).toURI().toURL());
}
}
catch (MalformedURLException e) {
@@ -274,4 +274,4 @@ public class ClassloaderUtil {
public static boolean isLoadingOfExternalPluginsDisabled() {
return !"true".equalsIgnoreCase(System.getProperty("idea.plugins.load", "true"));
}
}
}