Author: nickarls
Date: 2010-04-20 15:59:08 -0400 (Tue, 20 Apr 2010)
New Revision: 6129
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
Log:
warn instead of abort for problems loading services
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2010-04-20
18:39:00 UTC (rev 6128)
+++
core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2010-04-20
19:59:08 UTC (rev 6129)
@@ -63,7 +63,7 @@
{
private static LocLogger log = loggerFactory().getLogger(UTIL);
private static XLogger logX = loggerFactory().getXLogger(UTIL);
-
+
private static final String SERVICES = "META-INF/services";
/**
@@ -240,8 +240,15 @@
private void loadService(String serviceClassName)
{
Class<? extends S> serviceClass = loadClass(serviceClassName);
- S serviceInstance = prepareInstance(serviceClass);
- providers.add(serviceInstance);
+ S serviceInstance = null;
+ if (serviceClass != null)
+ {
+ serviceInstance = prepareInstance(serviceClass);
+ }
+ if (serviceInstance != null)
+ {
+ providers.add(serviceInstance);
+ }
}
private Class<? extends S> loadClass(String serviceClassName)
@@ -255,13 +262,11 @@
}
catch (ClassNotFoundException e)
{
- logX.throwing(Level.ERROR, e);
- throw new ForbiddenStateException(EXTENSION_CLASS_NOT_FOUND, serviceClassName);
+ log.warn(EXTENSION_CLASS_NOT_FOUND, serviceClassName);
}
catch (ClassCastException e)
{
- logX.throwing(Level.ERROR, e);
- throw new
ForbiddenStateException(DECLARED_EXTENSION_DOES_NOT_IMPLEMENT_EXTENSION,
serviceClassName);
+ log.warn(DECLARED_EXTENSION_DOES_NOT_IMPLEMENT_EXTENSION, serviceClassName);
}
return serviceClass;
}
@@ -275,9 +280,9 @@
}
catch (Exception e)
{
- logX.throwing(Level.ERROR, e);
- throw new ForbiddenStateException(SECURITY_EXCEPTION_SCANNING, serviceClass,
e);
+ log.warn(SECURITY_EXCEPTION_SCANNING, serviceClass.getName());
}
+ return null;
}
/**
Show replies by date