提交 da3cf22c 编写于 作者: M michaelm

8057936: java.net.URLClassLoader.findClass uses exceptions in control flow

Reviewed-by: alanb, chegar, dholmes, mr
Contributed-by: claes.redestad@oracle.com
上级 5178643e
......@@ -354,10 +354,11 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* @exception NullPointerException if {@code name} is {@code null}.
*/
protected Class<?> findClass(final String name)
throws ClassNotFoundException
throws ClassNotFoundException
{
final Class<?> result;
try {
return AccessController.doPrivileged(
result = AccessController.doPrivileged(
new PrivilegedExceptionAction<Class<?>>() {
public Class<?> run() throws ClassNotFoundException {
String path = name.replace('.', '/').concat(".class");
......@@ -369,13 +370,17 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
throw new ClassNotFoundException(name, e);
}
} else {
throw new ClassNotFoundException(name);
return null;
}
}
}, acc);
} catch (java.security.PrivilegedActionException pae) {
throw (ClassNotFoundException) pae.getException();
}
if (result == null) {
throw new ClassNotFoundException(name);
}
return result;
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册