< prev index next >
src/java.base/share/classes/java/net/URL.java
Print this page
*** 1196,1207 ****
private static String PREFIX = "sun.net.www.protocol";
public URLStreamHandler createURLStreamHandler(String protocol) {
String name = PREFIX + "." + protocol + ".Handler";
try {
! Class<?> c = Class.forName(name);
! return (URLStreamHandler)c.newInstance();
} catch (ClassNotFoundException x) {
// ignore
} catch (Exception e) {
// For compatibility, all Exceptions are ignored.
// any number of exceptions can get thrown here
--- 1196,1208 ----
private static String PREFIX = "sun.net.www.protocol";
public URLStreamHandler createURLStreamHandler(String protocol) {
String name = PREFIX + "." + protocol + ".Handler";
try {
! @SuppressWarnings("deprecation")
! Object o = Class.forName(name).newInstance();
! return (URLStreamHandler)o;
} catch (ClassNotFoundException x) {
// ignore
} catch (Exception e) {
// For compatibility, all Exceptions are ignored.
// any number of exceptions can get thrown here
*** 1232,1242 ****
if (cl != null) {
cls = cl.loadClass(clsName);
}
}
if (cls != null) {
! handler = (URLStreamHandler)cls.newInstance();
}
} catch (Exception e) {
// any number of exceptions can get thrown here
}
}
--- 1233,1245 ----
if (cl != null) {
cls = cl.loadClass(clsName);
}
}
if (cls != null) {
! @SuppressWarnings("deprecation")
! Object tmp = cls.newInstance();
! handler = (URLStreamHandler)tmp;
}
} catch (Exception e) {
// any number of exceptions can get thrown here
}
}
< prev index next >