mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
use ClassLoaders util class to get context classloader
This commit is contained in:
@@ -54,6 +54,7 @@ import sonia.scm.plugin.ext.Extension;
|
||||
import sonia.scm.plugin.ext.ExtensionBinder;
|
||||
import sonia.scm.plugin.ext.ExtensionProcessor;
|
||||
import sonia.scm.plugin.ext.Extensions;
|
||||
import sonia.scm.util.ClassLoaders;
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.web.security.DefaultAuthenticationHandler;
|
||||
|
||||
@@ -123,7 +124,8 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
this.servletContext = servletContext;
|
||||
this.annotationScannerFactory = new DefaultAnnotationScannerFactory();
|
||||
|
||||
ClassLoader classLoader = getClassLoader();
|
||||
ClassLoader classLoader =
|
||||
ClassLoaders.getContextClassLoader(DefaultPluginLoader.class);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -502,7 +504,8 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
*/
|
||||
private void scanForAnnotations()
|
||||
{
|
||||
ClassLoader classLoader = getClassLoader();
|
||||
ClassLoader classLoader =
|
||||
ClassLoaders.getContextClassLoader(DefaultPluginLoader.class);
|
||||
|
||||
AnnotationCollector<ExtensionPoint> extensionPointCollector =
|
||||
new AnnotationCollector<ExtensionPoint>();
|
||||
@@ -610,31 +613,6 @@ public class DefaultPluginLoader implements PluginLoader
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* TODO create util method
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private ClassLoader getClassLoader()
|
||||
{
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
if (classLoader == null)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("could not use context classloader, try to use default");
|
||||
}
|
||||
|
||||
classLoader = DefaultPluginManager.class.getClassLoader();
|
||||
}
|
||||
|
||||
return classLoader;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
|
||||
Reference in New Issue
Block a user