You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/07/08 20:22:10 UTC
svn commit: r1358808 -
/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java
Author: rmannibucau
Date: Sun Jul 8 18:22:09 2012
New Revision: 1358808
URL: http://svn.apache.org/viewvc?rev=1358808&view=rev
Log:
TOMEE-270 validating @Inject shouldn't stop the startup because of a niclassdeffounderror
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java?rev=1358808&r1=1358807&r2=1358808&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java Sun Jul 8 18:22:09 2012
@@ -32,11 +32,18 @@ public class CheckInjectionPointUsage ex
public void validate(EjbModule ejbModule) {
if (ejbModule.getBeans() == null) return;
- for (Field field : ejbModule.getFinder().findAnnotatedFields(Inject.class)) {
- if (!field.getType().equals(InjectionPoint.class)) continue;
- if (!HttpServlet.class.isAssignableFrom(field.getDeclaringClass())) continue;
+ try {
+ for (Field field : ejbModule.getFinder().findAnnotatedFields(Inject.class)) {
+ if (!field.getType().equals(InjectionPoint.class) || !HttpServlet.class.isAssignableFrom(field.getDeclaringClass())) {
+ continue;
+ }
- fail(field.getDeclaringClass().getSimpleName(), "cdi.injectionPointOnNonBean", field.getDeclaringClass().getName(), field.getName());
+ fail(field.getDeclaringClass().getSimpleName(), "cdi.injectionPointOnNonBean", field.getDeclaringClass().getName(), field.getName());
+ }
+ } catch (NoClassDefFoundError noClassDefFoundError) {
+ // ignored: can't check but maybe it is because of an optional dep so ignore it
+ // not important to skip it since the failure will be reported elsewhere
+ // this validator doesn't check it
}
}
}