-
Notifications
You must be signed in to change notification settings - Fork 980
Closed
Milestone
Description
Issue Type
- Bug Report
Summary
GoCD server classloader is being exposed to the plugin and it creates an issue in certain scenarios. One such scenario is when plugins dependencies are using current thread classloader to load the class.
public static Class loadClass(String className) throws ClassNotFoundException {
try {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
return contextClassLoader.loadClass(className);
} catch (Exception e) {
return Class.forName(className);
}
}Above code will load the specified class using GoCD server classloader and from GoCD server dependencies which cause plugins to not work.
Basic environment details
- Go Version:
Go Version: 18.7.0 (7118-8494e0df4236380e6b1260f21bea2df13703b64c)
Expected Results
It should load the class from dependencies defined in the plugin, not from the server.
Possible Fix
Lines 142 to 148 in 9e996b9
| try { | |
| return plugin.handle(apiRequest); | |
| } catch (UnhandledRequestTypeException e) { | |
| LOGGER.error(e.getMessage()); | |
| LOGGER.debug(e.getMessage(), e); | |
| throw new RuntimeException(e); | |
| } |
Before submitting a request to plugin set current threads classloader to plugins classloader and revert it back to original classloader at the end.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels