Skip to content

Commit

Permalink
Merge pull request #42162 from gayaldassanayake/fix-custom-loader-8.5
Browse files Browse the repository at this point in the history
[2201.8.5-stage] Exclude cli and picocli from childfirst loading in CustomToolClassLoader
  • Loading branch information
gayaldassanayake committed Feb 15, 2024
2 parents 478a0ef + fdc9029 commit 220e9a1
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
Class<?> loadedClass = findLoadedClass(name);
if (loadedClass == null) {
try {
// First, try to load the class from the URLs
loadedClass = findClass(name);
// Load from parent if cli or picocli classes. This is to avoid SPI and class loading issues
if (name.startsWith("io.ballerina.cli") || name.startsWith("picocli")) {
loadedClass = super.loadClass(name, resolve);
} else {
// First, try to load the class from the URLs
loadedClass = findClass(name);
}
} catch (ClassNotFoundException e) {
try {
// If not found, delegate to the parent
Expand Down

0 comments on commit 220e9a1

Please sign in to comment.