Skip to content

Commit

Permalink
fix #589
Browse files Browse the repository at this point in the history
  • Loading branch information
skybber committed Sep 18, 2024
1 parent 24007fd commit 6fc6657
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ public String toString() {
}

public String getClassName() {
if (className == null && target != null)
className = target.getClass().getName();

if (className == null && target != null) {
return target.getClass().getName();
}
return className;
}

Expand All @@ -128,12 +128,11 @@ public List<Object> getParams() {

public ClassLoader getTargetClassLoader() {
if (targetClassLoader == null) {
if (target != null)
targetClassLoader = target.getClass().getClassLoader();
else
targetClassLoader = PluginManager.getInstance().getPluginRegistry().getAppClassLoader(plugin);
if (target != null) {
return target.getClass().getClassLoader();
}
return PluginManager.getInstance().getPluginRegistry().getAppClassLoader(plugin);
}

return targetClassLoader;
}

Expand All @@ -154,8 +153,9 @@ public void setCommandExecutionListener(CommandExecutionListener commandExecutio
*/
public void executeCommand() {
// replace context classloader with application classloader
if (getTargetClassLoader() != null)
if (getTargetClassLoader() != null) {
Thread.currentThread().setContextClassLoader(getTargetClassLoader());
}

ClassLoader targetClassLoader = Thread.currentThread().getContextClassLoader();

Expand Down

0 comments on commit 6fc6657

Please sign in to comment.