Created
May 20, 2012 05:12
-
-
Save sriki77/2749903 to your computer and use it in GitHub Desktop.
Jdk 6 load class differences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected synchronized Class<?> loadClass(String name, boolean resolve) | |
throws ClassNotFoundException | |
{ | |
if( name.contains("xxxx") ){ | |
return null; | |
} | |
return super.loadClass(name,resolve); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected synchronized Class<?> loadClass(String name, boolean resolve) | |
throws ClassNotFoundException | |
{ | |
// First, check if the class has already been loaded | |
Class c = findLoadedClass(name); | |
if (c == null) { | |
try { | |
if (parent != null) { | |
c = parent.loadClass(name, false); | |
} else { | |
c = findBootstrapClass0(name); | |
} | |
} catch (ClassNotFoundException e) { | |
// If still not found, then invoke findClass in order | |
// to find the class. | |
c = findClass(name); | |
} | |
} | |
if (resolve) { | |
resolveClass(c); | |
} | |
return c; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected synchronized Class<?> loadClass(String name, boolean resolve) | |
throws ClassNotFoundException | |
{ | |
// First, check if the class has already been loaded | |
Class c = findLoadedClass(name); | |
if (c == null) { | |
try { | |
if (parent != null) { | |
c = parent.loadClass(name, false); | |
} else { | |
c = findBootstrapClassOrNull(name); | |
} | |
} catch (ClassNotFoundException e) { | |
// ClassNotFoundException thrown if class not found | |
// from the non-null parent class loader | |
} | |
if (c == null) { | |
// If still not found, then invoke findClass in order | |
// to find the class. | |
c = findClass(name); | |
} | |
} | |
if (resolve) { | |
resolveClass(c); | |
} | |
return c; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment