mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +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.ExtensionBinder;
|
||||||
import sonia.scm.plugin.ext.ExtensionProcessor;
|
import sonia.scm.plugin.ext.ExtensionProcessor;
|
||||||
import sonia.scm.plugin.ext.Extensions;
|
import sonia.scm.plugin.ext.Extensions;
|
||||||
|
import sonia.scm.util.ClassLoaders;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.web.security.DefaultAuthenticationHandler;
|
import sonia.scm.web.security.DefaultAuthenticationHandler;
|
||||||
|
|
||||||
@@ -123,7 +124,8 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
this.servletContext = servletContext;
|
this.servletContext = servletContext;
|
||||||
this.annotationScannerFactory = new DefaultAnnotationScannerFactory();
|
this.annotationScannerFactory = new DefaultAnnotationScannerFactory();
|
||||||
|
|
||||||
ClassLoader classLoader = getClassLoader();
|
ClassLoader classLoader =
|
||||||
|
ClassLoaders.getContextClassLoader(DefaultPluginLoader.class);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -502,7 +504,8 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
*/
|
*/
|
||||||
private void scanForAnnotations()
|
private void scanForAnnotations()
|
||||||
{
|
{
|
||||||
ClassLoader classLoader = getClassLoader();
|
ClassLoader classLoader =
|
||||||
|
ClassLoaders.getContextClassLoader(DefaultPluginLoader.class);
|
||||||
|
|
||||||
AnnotationCollector<ExtensionPoint> extensionPointCollector =
|
AnnotationCollector<ExtensionPoint> extensionPointCollector =
|
||||||
new AnnotationCollector<ExtensionPoint>();
|
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 ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
|
|||||||
Reference in New Issue
Block a user