You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/02/19 16:48:09 UTC
svn commit: r1569795 [15/35] - in
/tomee/tomee/trunk/container/openejb-core/src/main: config/pmd/
java/javax/xml/ws/ java/javax/xml/ws/wsaddressing/ java/org/apache/openejb/
java/org/apache/openejb/assembler/
java/org/apache/openejb/assembler/classic/ ...
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAsynchronous.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAsynchronous.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAsynchronous.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAsynchronous.java Wed Feb 19 15:47:58 2014
@@ -39,22 +39,22 @@ import java.util.concurrent.Future;
*/
public class CheckAsynchronous extends ValidationBase {
- public void validate(EjbModule module) {
- Set<String> applicationExceptions = new HashSet<String>();
- for (ApplicationException applicationException : module.getEjbJar().getAssemblyDescriptor().getApplicationException()) {
+ public void validate(final EjbModule module) {
+ final Set<String> applicationExceptions = new HashSet<String>();
+ for (final ApplicationException applicationException : module.getEjbJar().getAssemblyDescriptor().getApplicationException()) {
applicationExceptions.add(applicationException.getExceptionClass());
}
- for (EnterpriseBean bean : module.getEjbJar().getEnterpriseBeans()) {
+ for (final EnterpriseBean bean : module.getEjbJar().getEnterpriseBeans()) {
Class<?> ejbClass = null;
try {
ejbClass = loadClass(bean.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
continue;
}
if (bean instanceof SessionBean) {
- SessionBean session = (SessionBean) bean;
- for (AsyncMethod asyncMethod : session.getAsyncMethod()) {
- Method method = getMethod(ejbClass, asyncMethod);
+ final SessionBean session = (SessionBean) bean;
+ for (final AsyncMethod asyncMethod : session.getAsyncMethod()) {
+ final Method method = getMethod(ejbClass, asyncMethod);
if (method == null) {
fail(bean, "asynchronous.missing", asyncMethod.getMethodName(), ejbClass.getName(), getParameters(asyncMethod.getMethodParams()));
} else {
@@ -62,21 +62,21 @@ public class CheckAsynchronous extends V
}
}
- for (String className : session.getAsynchronousClasses()) {
+ for (final String className : session.getAsynchronousClasses()) {
try {
- Class<?> cls = loadClass(className);
- for (Method method : cls.getDeclaredMethods()) {
+ final Class<?> cls = loadClass(className);
+ for (final Method method : cls.getDeclaredMethods()) {
if (Modifier.isPublic(method.getModifiers()) && !method.isSynthetic()) {
checkAsynchronousMethod(session, ejbClass, method, applicationExceptions);
}
}
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
//ignore ?
}
}
} else {
- ClassFinder classFinder = new ClassFinder(ejbClass);
- for (Method method : classFinder.findAnnotatedMethods(Asynchronous.class)) {
+ final ClassFinder classFinder = new ClassFinder(ejbClass);
+ for (final Method method : classFinder.findAnnotatedMethods(Asynchronous.class)) {
ignoredMethodAnnotation("Asynchronous", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
if (ejbClass.getAnnotation(Asynchronous.class) != null) {
@@ -86,13 +86,13 @@ public class CheckAsynchronous extends V
}
}
- private void checkAsynchronousMethod(SessionBean bean, Class<?> ejbClass, Method method, Set<String> applicationExceptions) {
- Class<?> retType = method.getReturnType();
+ private void checkAsynchronousMethod(final SessionBean bean, final Class<?> ejbClass, final Method method, final Set<String> applicationExceptions) {
+ final Class<?> retType = method.getReturnType();
if (retType != void.class && retType != Future.class) {
fail(bean, "asynchronous.badReturnType", method.getName(), retType.getName(), ejbClass.getName());
}
if (retType == void.class) {
- String invalidThrowCauses = checkThrowCauses(method.getExceptionTypes(), applicationExceptions);
+ final String invalidThrowCauses = checkThrowCauses(method.getExceptionTypes(), applicationExceptions);
if (invalidThrowCauses != null) {
fail(bean, "asynchronous.badExceptionType", method.getName(), ejbClass.getName(), invalidThrowCauses);
}
@@ -105,9 +105,9 @@ public class CheckAsynchronous extends V
* @param applicationExceptions
* @return
*/
- private String checkThrowCauses(Class<?>[] exceptionTypes, Set<String> applicationExceptions) {
+ private String checkThrowCauses(final Class<?>[] exceptionTypes, final Set<String> applicationExceptions) {
StringBuilder buffer = null;
- for (Class<?> exceptionType : exceptionTypes) {
+ for (final Class<?> exceptionType : exceptionTypes) {
if (applicationExceptions.contains(exceptionType.getName()) || !Exception.class.isAssignableFrom(exceptionType) || RuntimeException.class.isAssignableFrom(exceptionType)) {
continue;
}
@@ -120,23 +120,23 @@ public class CheckAsynchronous extends V
return buffer == null ? null : buffer.toString();
}
- private Method getMethod(Class<?> clazz, AsyncMethod asyncMethod) {
+ private Method getMethod(final Class<?> clazz, final AsyncMethod asyncMethod) {
try {
- MethodParams methodParams = asyncMethod.getMethodParams();
- Class<?>[] parameterTypes;
+ final MethodParams methodParams = asyncMethod.getMethodParams();
+ final Class<?>[] parameterTypes;
if (methodParams != null) {
parameterTypes = new Class[methodParams.getMethodParam().size()];
int arrayIndex = 0;
- for (String parameterType : methodParams.getMethodParam()) {
+ for (final String parameterType : methodParams.getMethodParam()) {
parameterTypes[arrayIndex++] = loadClass(parameterType);
}
} else {
parameterTypes = new Class[0];
}
return clazz.getMethod(asyncMethod.getMethodName(), parameterTypes);
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
return null;
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
throw new OpenEJBRuntimeException(e);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCallbacks.java Wed Feb 19 15:47:58 2014
@@ -52,132 +52,132 @@ import java.util.List;
*/
public class CheckCallbacks extends ValidationBase {
- public void validate(EjbModule module) {
- for (EnterpriseBean bean : module.getEjbJar().getEnterpriseBeans()) {
+ public void validate(final EjbModule module) {
+ for (final EnterpriseBean bean : module.getEjbJar().getEnterpriseBeans()) {
Class ejbClass = null;
try {
ejbClass = loadClass(bean.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
continue;
}
if (bean instanceof Invokable) {
- Invokable invokable = (Invokable) bean;
+ final Invokable invokable = (Invokable) bean;
- for (AroundInvoke aroundInvoke : invokable.getAroundInvoke()) {
+ for (final AroundInvoke aroundInvoke : invokable.getAroundInvoke()) {
checkAroundInvoke(ejbClass, aroundInvoke, bean.getEjbName());
}
- for (AroundTimeout aroundTimeout : invokable.getAroundTimeout()) {
+ for (final AroundTimeout aroundTimeout : invokable.getAroundTimeout()) {
checkAroundTimeout(ejbClass, aroundTimeout, bean.getEjbName());
}
}
- for (LifecycleCallback callback : bean.getPostConstruct()) {
+ for (final LifecycleCallback callback : bean.getPostConstruct()) {
checkCallback(ejbClass, "PostConstruct", callback, bean);
}
- for (LifecycleCallback callback : bean.getPreDestroy()) {
+ for (final LifecycleCallback callback : bean.getPreDestroy()) {
checkCallback(ejbClass, "PreDestroy", callback, bean);
}
- ClassFinder finder = new ClassFinder(ejbClass);
+ final ClassFinder finder = new ClassFinder(ejbClass);
if (bean instanceof Session ) {
- SessionBean session = (SessionBean) bean;
+ final SessionBean session = (SessionBean) bean;
if (session.getSessionType() == SessionType.STATEFUL ) {
- for (LifecycleCallback callback : session.getPrePassivate()) {
+ for (final LifecycleCallback callback : session.getPrePassivate()) {
checkCallback(ejbClass, "PrePassivate", callback, bean);
}
- for (LifecycleCallback callback : session.getPostActivate()) {
+ for (final LifecycleCallback callback : session.getPostActivate()) {
checkCallback(ejbClass, "PostActivate", callback, bean);
}
checkSessionSynchronization(ejbClass, session);
- for (LifecycleCallback callback : session.getAfterBegin()) {
+ for (final LifecycleCallback callback : session.getAfterBegin()) {
checkCallback(ejbClass, "AfterBegin", callback, bean);
}
- for (LifecycleCallback callback : session.getBeforeCompletion()) {
+ for (final LifecycleCallback callback : session.getBeforeCompletion()) {
checkCallback(ejbClass, "BeforeCompletion", callback, bean);
}
- for (LifecycleCallback callback : session.getAfterCompletion()) {
+ for (final LifecycleCallback callback : session.getAfterCompletion()) {
checkCallback(ejbClass, "AfterCompletion", callback, bean, boolean.class);
}
// for (LifecycleCallback callback : session.getAfterCompletion()) {
// checkCallback(ejbClass, "Init", callback, bean, boolean.class);
// }
- for (AroundTimeout aroundTimeout : session.getAroundTimeout()) {
+ for (final AroundTimeout aroundTimeout : session.getAroundTimeout()) {
ignoredMethodAnnotation("AroundTimeout", bean, bean.getEjbClass(), aroundTimeout.getMethodName(), SessionType.STATEFUL.getName());
}
- for (Timer timer : session.getTimer()) {
+ for (final Timer timer : session.getTimer()) {
ignoredMethodAnnotation("Schedule/Schedules", bean, bean.getEjbClass(), timer.getTimeoutMethod().getMethodName(), SessionType.STATEFUL.getName());
}
} else {
- for (LifecycleCallback callback : session.getAfterBegin()) {
+ for (final LifecycleCallback callback : session.getAfterBegin()) {
ignoredMethodAnnotation("AfterBegin", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
}
- for (LifecycleCallback callback : session.getBeforeCompletion()) {
+ for (final LifecycleCallback callback : session.getBeforeCompletion()) {
ignoredMethodAnnotation("BeforeCompletion", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
}
- for (LifecycleCallback callback : session.getAfterCompletion()) {
+ for (final LifecycleCallback callback : session.getAfterCompletion()) {
ignoredMethodAnnotation("AfterCompletion", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
}
- for (LifecycleCallback callback : session.getPrePassivate()) {
+ for (final LifecycleCallback callback : session.getPrePassivate()) {
ignoredMethodAnnotation("PrePassivate", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
}
- for (LifecycleCallback callback : session.getPostActivate()) {
+ for (final LifecycleCallback callback : session.getPostActivate()) {
ignoredMethodAnnotation("PostActivate", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
}
- for (RemoveMethod method : session.getRemoveMethod()) {
+ for (final RemoveMethod method : session.getRemoveMethod()) {
ignoredMethodAnnotation("Remove", bean, bean.getEjbClass(), method.getBeanMethod().getMethodName(), session.getSessionType().getName());
}
- for (InitMethod method : session.getInitMethod()) {
+ for (final InitMethod method : session.getInitMethod()) {
ignoredMethodAnnotation("Init", bean, bean.getEjbClass(), method.getBeanMethod().getMethodName(), session.getSessionType().getName());
}
}
} else {
- for (Method method : finder.findAnnotatedMethods(PrePassivate.class)) {
+ for (final Method method : finder.findAnnotatedMethods(PrePassivate.class)) {
ignoredMethodAnnotation("PrePassivate", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
- for (Method method : finder.findAnnotatedMethods(PostActivate.class)) {
+ for (final Method method : finder.findAnnotatedMethods(PostActivate.class)) {
ignoredMethodAnnotation("PostActivate", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
- for (Method method : finder.findAnnotatedMethods(Remove.class)) {
+ for (final Method method : finder.findAnnotatedMethods(Remove.class)) {
ignoredMethodAnnotation("Remove", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
- for (Method method : finder.findAnnotatedMethods(Init.class)) {
+ for (final Method method : finder.findAnnotatedMethods(Init.class)) {
ignoredMethodAnnotation("Init", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
- for (Method method : finder.findAnnotatedMethods(AfterBegin.class)) {
+ for (final Method method : finder.findAnnotatedMethods(AfterBegin.class)) {
ignoredMethodAnnotation("AfterBegin", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
- for (Method method : finder.findAnnotatedMethods(BeforeCompletion.class)) {
+ for (final Method method : finder.findAnnotatedMethods(BeforeCompletion.class)) {
ignoredMethodAnnotation("BeforeCompletion", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
- for (Method method : finder.findAnnotatedMethods(AfterCompletion.class)) {
+ for (final Method method : finder.findAnnotatedMethods(AfterCompletion.class)) {
ignoredMethodAnnotation("AfterCompletion", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
}
}
@@ -197,71 +197,71 @@ public class CheckCallbacks extends Vali
// }
}
- for (Interceptor interceptor : module.getEjbJar().getInterceptors()) {
+ for (final Interceptor interceptor : module.getEjbJar().getInterceptors()) {
Class interceptorClass = null;
try {
interceptorClass = loadClass(interceptor.getInterceptorClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
continue;
}
- for (AroundInvoke aroundInvoke : interceptor.getAroundInvoke()) {
+ for (final AroundInvoke aroundInvoke : interceptor.getAroundInvoke()) {
checkAroundInvoke(interceptorClass, aroundInvoke, "Interceptor");
}
- for (AroundTimeout aroundTimeout : interceptor.getAroundTimeout()) {
+ for (final AroundTimeout aroundTimeout : interceptor.getAroundTimeout()) {
checkAroundTimeout(interceptorClass, aroundTimeout, "Interceptor");
}
- for (LifecycleCallback callback : interceptor.getPostConstruct()) {
+ for (final LifecycleCallback callback : interceptor.getPostConstruct()) {
checkCallback(interceptorClass, "PostConstruct", callback, interceptor);
}
- for (LifecycleCallback callback : interceptor.getPreDestroy()) {
+ for (final LifecycleCallback callback : interceptor.getPreDestroy()) {
checkCallback(interceptorClass, "PreDestroy", callback, interceptor);
}
- for (LifecycleCallback callback : interceptor.getPrePassivate()) {
+ for (final LifecycleCallback callback : interceptor.getPrePassivate()) {
checkCallback(interceptorClass, "PrePassivate", callback, interceptor);
}
- for (LifecycleCallback callback : interceptor.getPostActivate()) {
+ for (final LifecycleCallback callback : interceptor.getPostActivate()) {
checkCallback(interceptorClass, "PostActivate", callback, interceptor);
}
- for (LifecycleCallback callback : interceptor.getAfterBegin()) {
+ for (final LifecycleCallback callback : interceptor.getAfterBegin()) {
checkCallback(interceptorClass, "AfterBegin", callback, interceptor);
}
- for (LifecycleCallback callback : interceptor.getBeforeCompletion()) {
+ for (final LifecycleCallback callback : interceptor.getBeforeCompletion()) {
checkCallback(interceptorClass, "BeforeCompletion", callback, interceptor);
}
- for (LifecycleCallback callback : interceptor.getAfterCompletion()) {
+ for (final LifecycleCallback callback : interceptor.getAfterCompletion()) {
checkCallback(interceptorClass, "AfterCompletion", callback, interceptor);
}
}
}
- private void checkAroundTypeInvoke(String aroundType, Class ejbClass, String declaringClassName, String declaringMethodName, String componentName) {
+ private void checkAroundTypeInvoke(final String aroundType, final Class ejbClass, final String declaringClassName, final String declaringMethodName, final String componentName) {
try {
Class<?> declaringClass = null;
try {
declaringClass = declaringClassName == null ? ejbClass : loadClass(declaringClassName);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
fail(componentName, "missing.class", declaringClassName, aroundType, ejbClass.getName());
return;
}
- Method method = getMethod(declaringClass, declaringMethodName, InvocationContext.class);
+ final Method method = getMethod(declaringClass, declaringMethodName, InvocationContext.class);
- Class<?> returnType = method.getReturnType();
+ final Class<?> returnType = method.getReturnType();
if (!returnType.equals(Object.class)) {
fail(componentName, "aroundInvoke.badReturnType", aroundType, declaringMethodName, returnType.getName(), declaringClassName);
}
boolean throwsException = false;
- for (Class<?> exceptionType : method.getExceptionTypes()) {
+ for (final Class<?> exceptionType : method.getExceptionTypes()) {
if (exceptionType.getName().equals(Exception.class.getName())) {
throwsException = true;
}
@@ -271,14 +271,14 @@ public class CheckCallbacks extends Vali
fail(componentName, "aroundInvoke.mustThrowException", aroundType, declaringMethodName, declaringClassName);
}
- } catch (NoSuchMethodException e) {
- List<Method> possibleMethods = getMethods(ejbClass, declaringMethodName);
+ } catch (final NoSuchMethodException e) {
+ final List<Method> possibleMethods = getMethods(ejbClass, declaringMethodName);
if (possibleMethods.size() == 0) {
fail(componentName, "aroundInvoke.missing", aroundType, declaringMethodName, declaringClassName);
} else if (possibleMethods.size() == 1) {
fail(componentName, "aroundInvoke.invalidArguments", aroundType, declaringMethodName, getParameters(possibleMethods.get(0)), declaringClassName);
- Class<?> returnType = possibleMethods.get(0).getReturnType();
+ final Class<?> returnType = possibleMethods.get(0).getReturnType();
if (!returnType.equals(Object.class)) {
fail(componentName, "aroundInvoke.badReturnType", aroundType, declaringMethodName, returnType.getName(), declaringClassName);
}
@@ -288,24 +288,24 @@ public class CheckCallbacks extends Vali
}
}
- private void checkAroundInvoke(Class<?> ejbClass, AroundInvoke aroundInvoke, String componentName) {
+ private void checkAroundInvoke(final Class<?> ejbClass, final AroundInvoke aroundInvoke, final String componentName) {
checkAroundTypeInvoke("AroundInvoke", ejbClass, aroundInvoke.getClassName(), aroundInvoke.getMethodName(), componentName);
}
- private void checkAroundTimeout(Class<?> ejbClass, AroundTimeout aroundTimeout, String componentName) {
+ private void checkAroundTimeout(final Class<?> ejbClass, final AroundTimeout aroundTimeout, final String componentName) {
checkAroundTypeInvoke("AroundTimeout", ejbClass, aroundTimeout.getClassName(), aroundTimeout.getMethodName(), componentName);
}
- private void checkCallback(Class<?> ejbClass, String type, CallbackMethod callback, EnterpriseBean bean, Class... parameterTypes) {
+ private void checkCallback(final Class<?> ejbClass, final String type, final CallbackMethod callback, final EnterpriseBean bean, final Class... parameterTypes) {
try {
Class<?> delcaringClass = null;
try {
delcaringClass = callback.getClassName() == null ? ejbClass : loadClass(callback.getClassName());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
fail(type, "missing.class", callback.getClassName(), type, bean.getEjbName());
return;
}
- Method method = getMethod(delcaringClass, callback.getMethodName(), parameterTypes);
+ final Method method = getMethod(delcaringClass, callback.getMethodName(), parameterTypes);
if (implementsSessionBean(delcaringClass)) {
if ("PreDestroy".equals(type)) {
if (!callback.getMethodName().equals("ejbRemove"))
@@ -325,23 +325,23 @@ public class CheckCallbacks extends Vali
}
// @AfterCompletion, @BeforeCompletion and @AfterBegin are assumed to be allowed to be used on Stateful bean implementing javax.ejb.SessionBean
}
- Class<?> returnType = method.getReturnType();
+ final Class<?> returnType = method.getReturnType();
if (!returnType.equals(Void.TYPE)) {
fail(bean, "callback.badReturnType", type, callback.getMethodName(), returnType.getName(), callback.getClassName());
}
- int methodModifiers = method.getModifiers();
+ final int methodModifiers = method.getModifiers();
if (Modifier.isFinal(methodModifiers) || Modifier.isStatic(methodModifiers)) {
fail(bean, "callback.badModifier", type, callback.getMethodName(), callback.getClassName());
}
- } catch (NoSuchMethodException e) {
- List<Method> possibleMethods = getMethods(ejbClass, callback.getMethodName());
+ } catch (final NoSuchMethodException e) {
+ final List<Method> possibleMethods = getMethods(ejbClass, callback.getMethodName());
if (possibleMethods.size() == 0) {
fail(bean, "callback.missing", type, callback.getMethodName(), callback.getClassName());
} else if (possibleMethods.size() == 1) {
- Class<?>[] parameters = possibleMethods.get(0).getParameterTypes();
+ final Class<?>[] parameters = possibleMethods.get(0).getParameterTypes();
if (parameters.length == 1 && parameters[0].equals(InvocationContext.class)) {
fail(bean.getEjbName(), "callback.invocationcontext.notallowed", type,
callback.getMethodName());
@@ -354,39 +354,39 @@ public class CheckCallbacks extends Vali
}
}
- private boolean implementsSessionBean(Class<?> ejbClass) {
- Class<?>[] interfaces = ejbClass.getInterfaces();
- for (Class<?> interfce : interfaces) {
+ private boolean implementsSessionBean(final Class<?> ejbClass) {
+ final Class<?>[] interfaces = ejbClass.getInterfaces();
+ for (final Class<?> interfce : interfaces) {
if(interfce.equals(javax.ejb.SessionBean.class))
return true;
}
return false;
}
- private void checkCallback(Class interceptorClass, String type, CallbackMethod callback, Interceptor interceptor) {
+ private void checkCallback(final Class interceptorClass, final String type, final CallbackMethod callback, final Interceptor interceptor) {
try {
Class<?> delcaringClass = null;
try {
delcaringClass = callback.getClassName() == null ? interceptorClass : loadClass(callback.getClassName());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
fail(type, "missing.class", callback.getClassName(), type, interceptor.getInterceptorClass());
return;
}
- Method method = getMethod(delcaringClass, callback.getMethodName(), InvocationContext.class);
+ final Method method = getMethod(delcaringClass, callback.getMethodName(), InvocationContext.class);
- Class<?> returnType = method.getReturnType();
+ final Class<?> returnType = method.getReturnType();
if (!returnType.equals(Void.TYPE)) {
fail("Interceptor", "interceptor.callback.badReturnType", interceptorClass, type, callback.getMethodName(), returnType.getName());
}
- } catch (NoSuchMethodException e) {
- List<Method> possibleMethods = getMethods(interceptorClass, callback.getMethodName());
+ } catch (final NoSuchMethodException e) {
+ final List<Method> possibleMethods = getMethods(interceptorClass, callback.getMethodName());
if (possibleMethods.size() == 0) {
fail("Interceptor", "interceptor.callback.missing", type, callback.getMethodName(), interceptorClass.getName());
} else if (possibleMethods.size() == 1) {
fail("Interceptor", "interceptor.callback.invalidArguments", type, callback.getMethodName(), getParameters(possibleMethods.get(0)), interceptorClass.getName());
- Class<?> returnType = possibleMethods.get(0).getReturnType();
+ final Class<?> returnType = possibleMethods.get(0).getReturnType();
if (!returnType.equals(Void.TYPE)) {
fail("Interceptor", "interceptor.callback.badReturnType", interceptorClass, type, callback.getMethodName(), returnType.getName());
@@ -397,12 +397,12 @@ public class CheckCallbacks extends Vali
}
}
- private void checkSessionSynchronization(Class ejbClass, SessionBean bean) {
+ private void checkSessionSynchronization(final Class ejbClass, final SessionBean bean) {
if (SessionSynchronization.class.isAssignableFrom(ejbClass)) {
if (bean.getAfterBeginMethod() != null || bean.getBeforeCompletionMethod() != null || bean.getAfterCompletionMethod() != null) {
fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName());
} else {
- ClassFinder classFinder = new ClassFinder(ejbClass);
+ final ClassFinder classFinder = new ClassFinder(ejbClass);
if (classFinder.findAnnotatedMethods(AfterBegin.class).size() > 0 || classFinder.findAnnotatedMethods(BeforeCompletion.class).size() > 0
|| classFinder.findAnnotatedMethods(AfterCompletion.class).size() > 0) {
fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName());
@@ -411,12 +411,12 @@ public class CheckCallbacks extends Vali
}
}
- private Method getMethod(Class clazz, String methodName, Class... parameterTypes) throws NoSuchMethodException {
+ private Method getMethod(Class clazz, final String methodName, final Class... parameterTypes) throws NoSuchMethodException {
NoSuchMethodException original = null;
while (clazz != null){
try {
return clazz.getDeclaredMethod(methodName, parameterTypes);
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
if (original == null) original = e;
}
clazz = clazz.getSuperclass();
@@ -424,10 +424,10 @@ public class CheckCallbacks extends Vali
throw original;
}
- private List<Method> getMethods(Class clazz, String methodName) {
- List<Method> methods = new ArrayList<Method>();
+ private List<Method> getMethods(Class clazz, final String methodName) {
+ final List<Method> methods = new ArrayList<Method>();
while (clazz != null){
- for (Method method : clazz.getDeclaredMethods()) {
+ for (final Method method : clazz.getDeclaredMethods()) {
if (method.getName().equals(methodName)){
methods.add(method);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCdiEnabled.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCdiEnabled.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCdiEnabled.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckCdiEnabled.java Wed Feb 19 15:47:58 2014
@@ -22,7 +22,7 @@ import org.apache.xbean.finder.IAnnotati
import javax.inject.Inject;
public class CheckCdiEnabled extends ValidationBase {
- public void validate(EjbModule ejbModule) {
+ public void validate(final EjbModule ejbModule) {
if (ejbModule.getFinder() == null) {
return;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClassLoading.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClassLoading.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClassLoading.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClassLoading.java Wed Feb 19 15:47:58 2014
@@ -48,12 +48,12 @@ public class CheckClassLoading extends V
protected AppModule appModule;
@Override
- public void validate(AppModule appModule) {
+ public void validate(final AppModule appModule) {
this.appModule = appModule;
module = appModule;
check(appModule.getClassLoader());
- for (WebModule webModule : appModule.getWebModules()) {
+ for (final WebModule webModule : appModule.getWebModules()) {
module = webModule;
validate(webModule);
}
@@ -62,12 +62,12 @@ public class CheckClassLoading extends V
private void check(final ClassLoader classLoader) {
UrlSet set;
- UrlSet openejbSet;
+ final UrlSet openejbSet;
try {
openejbSet = new UrlSet(OpenEJB.class.getClassLoader());
set = new UrlSet(classLoader);
set = set.exclude(openejbSet);
- } catch (IOException e) {
+ } catch (final IOException e) {
warn(module.getModuleId() + " application", e.getMessage());
return;
}
@@ -78,22 +78,22 @@ public class CheckClassLoading extends V
final Classes fcl = new Classes(currentUrls.toArray(new URL[currentUrls.size()]));
final Classes scl = new Classes(parentUrls.toArray(new URL[parentUrls.size()]));
final Collection<DiffItem> diffs = intersection(fcl, scl);
- for (DiffItem diff : diffs) {
+ for (final DiffItem diff : diffs) {
warn(module.getModuleId() + " application", diff.toScreen());
}
}
- private void validate(WebModule webModule) {
+ private void validate(final WebModule webModule) {
check(webModule.getClassLoader());
}
@Override
- public void validate(ClientModule clientModule) {
+ public void validate(final ClientModule clientModule) {
check(clientModule.getClassLoader());
}
@Override
- public void validate(EjbModule ejbModule) {
+ public void validate(final EjbModule ejbModule) {
check(ejbModule.getClassLoader());
}
@@ -111,26 +111,26 @@ public class CheckClassLoading extends V
// for all archives list all files
// all is sorted by the natural String order
- for (URL archive : urls) {
+ for (final URL archive : urls) {
try {
final File file = URLs.toFile(archive);
final List<String> files = JarUtil.listFiles(file, CLASS_EXTENSION);
Collections.sort(files);
fileByArchive.put(file.getName(), files);
- } catch (Exception e) {
+ } catch (final Exception e) {
// ignored
}
}
}
}
- public static Collection<DiffItem> intersection(Classes cl1, Classes cl2) {
+ public static Collection<DiffItem> intersection(final Classes cl1, final Classes cl2) {
final List<DiffItem> diff = new ArrayList<DiffItem>();
- for (Map.Entry<String, Collection<String>> entry1 : cl1.fileByArchive.entrySet()) {
- for (Map.Entry<String, Collection<String>> entry2 : cl2.fileByArchive.entrySet()) {
- Collection<String> v1 = entry1.getValue();
- Collection<String> v2 = entry2.getValue();
- Collection<String> inter = CollectionUtils.intersection(v1, v2);
+ for (final Map.Entry<String, Collection<String>> entry1 : cl1.fileByArchive.entrySet()) {
+ for (final Map.Entry<String, Collection<String>> entry2 : cl2.fileByArchive.entrySet()) {
+ final Collection<String> v1 = entry1.getValue();
+ final Collection<String> v2 = entry2.getValue();
+ final Collection<String> inter = CollectionUtils.intersection(v1, v2);
if (inter.size() == 0) {
continue;
@@ -160,19 +160,19 @@ public class CheckClassLoading extends V
// no-op
}
- public static List<String> listFiles(File archive, String[] extensions) throws IOException {
+ public static List<String> listFiles(final File archive, final String[] extensions) throws IOException {
if (!archive.exists() || !archive.isFile()) {
throw new IllegalArgumentException(archive.getPath() + " is not a file");
}
- List<String> files = new ArrayList<String>();
+ final List<String> files = new ArrayList<String>();
- JarFile file = new JarFile(archive);
- Enumeration<JarEntry> entries = file.entries();
+ final JarFile file = new JarFile(archive);
+ final Enumeration<JarEntry> entries = file.entries();
while (entries.hasMoreElements()) {
- JarEntry entry = entries.nextElement();
- String name = entry.getName();
- for (String ext : extensions) {
+ final JarEntry entry = entries.nextElement();
+ final String name = entry.getName();
+ for (final String ext : extensions) {
if (name.endsWith(ext)) {
if (CLASS_EXT.equals(ext)) {
files.add(name.replace("/", "."));
@@ -193,7 +193,7 @@ public class CheckClassLoading extends V
private String file1;
private String file2;
- public DiffItem(Collection<String> files, String file1, String file2) {
+ public DiffItem(final Collection<String> files, final String file1, final String file2) {
this.files = files;
this.file1 = file1;
this.file2 = file2;
@@ -218,7 +218,7 @@ public class CheckClassLoading extends V
}
public static class ContainingItem extends DiffItem {
- public ContainingItem(Collection<String> inter, String dir1, String dir2) {
+ public ContainingItem(final Collection<String> inter, final String dir1, final String dir2) {
super(inter, dir1, dir2);
}
@@ -229,7 +229,7 @@ public class CheckClassLoading extends V
}
public static class IncludedItem extends DiffItem {
- public IncludedItem(Collection<String> files, String file1, String file2) {
+ public IncludedItem(final Collection<String> files, final String file1, final String file2) {
super(files, file1, file2);
}
@@ -240,7 +240,7 @@ public class CheckClassLoading extends V
}
public static class SameItem extends DiffItem {
- public SameItem(Collection<String> files, String file1, String file2) {
+ public SameItem(final Collection<String> files, final String file1, final String file2) {
super(files, file1, file2);
}
@@ -267,9 +267,9 @@ public class CheckClassLoading extends V
}
@Override
- public int compare(DiffItem o1, DiffItem o2) {
- int index1 = ORDER.get(o1.getClass());
- int index2 = ORDER.get(o2.getClass());
+ public int compare(final DiffItem o1, final DiffItem o2) {
+ final int index1 = ORDER.get(o1.getClass());
+ final int index2 = ORDER.get(o2.getClass());
if (index1 == index2) {
return o1.getFile1().compareTo(o1.getFile1());
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckClasses.java Wed Feb 19 15:47:58 2014
@@ -91,10 +91,10 @@ public class CheckClasses extends Valida
beanOnlyAnnotations.add(TransactionManagement.class);
}
- public void validate(EjbModule ejbModule) {
- for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+ public void validate(final EjbModule ejbModule) {
+ for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
try {
- Class<?> beanClass = check_hasEjbClass(bean);
+ final Class<?> beanClass = check_hasEjbClass(bean);
// All the subsequent checks require the bean class
if (beanClass == null) continue;
@@ -105,7 +105,7 @@ public class CheckClasses extends Valida
continue;
}
- RemoteBean b = (RemoteBean) bean;
+ final RemoteBean b = (RemoteBean) bean;
check_isEjbClass(b);
check_hasDependentClasses(b, b.getEjbClass(), "ejb-class");
@@ -128,28 +128,28 @@ public class CheckClasses extends Valida
}
if (b instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) b;
+ final SessionBean sessionBean = (SessionBean) b;
- for (String interfce : sessionBean.getBusinessLocal()) {
+ for (final String interfce : sessionBean.getBusinessLocal()) {
checkInterface(b, beanClass, "business-local", interfce);
}
- for (String interfce : sessionBean.getBusinessRemote()) {
+ for (final String interfce : sessionBean.getBusinessRemote()) {
checkInterface(b, beanClass, "business-remote", interfce);
}
}
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
throw new OpenEJBRuntimeException(bean.getEjbName(), e);
}
}
- for (Interceptor interceptor : ejbModule.getEjbJar().getInterceptors()) {
+ for (final Interceptor interceptor : ejbModule.getEjbJar().getInterceptors()) {
check_hasInterceptorClass(interceptor);
}
}
- private void checkInterface(RemoteBean b, Class<?> beanClass, String tag, String className) {
- Class<?> interfce = lookForClass(className, tag, b.getEjbName());
+ private void checkInterface(final RemoteBean b, final Class<?> beanClass, String tag, final String className) {
+ final Class<?> interfce = lookForClass(className, tag, b.getEjbName());
if (interfce == null) return;
@@ -159,29 +159,29 @@ public class CheckClasses extends Valida
isValidInterface(b, interfce, beanClass, tag);
- ClassFinder finder = new ClassFinder(interfce);
+ final ClassFinder finder = new ClassFinder(interfce);
- for (Class<? extends Annotation> annotation : beanOnlyAnnotations) {
+ for (final Class<? extends Annotation> annotation : beanOnlyAnnotations) {
if (interfce.isAnnotationPresent(annotation)){
warn(b, "interface.beanOnlyAnnotation", annotation.getSimpleName(), interfce.getName(), b.getEjbClass());
}
- for (Method method : finder.findAnnotatedMethods(annotation)) {
+ for (final Method method : finder.findAnnotatedMethods(annotation)) {
warn(b, "interfaceMethod.beanOnlyAnnotation", annotation.getSimpleName(), interfce.getName(), method.getName(), b.getEjbClass());
}
}
}
- private void check_hasInterface(RemoteBean b) {
+ private void check_hasInterface(final RemoteBean b) {
if (b.getRemote() != null) return;
if (b.getLocal() != null) return;
Class<?> beanClass = null;
try {
beanClass = loadClass(b.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
// no-op
}
@@ -200,47 +200,47 @@ public class CheckClasses extends Valida
//fail(b, "noInterfaceDeclared.session");
}
- private void check_hasDependentClasses(RemoteBean b, String className, String type) {
+ private void check_hasDependentClasses(final RemoteBean b, final String className, final String type) {
try {
- ClassLoader cl = module.getClassLoader();
- Class<?> clazz = cl.loadClass(className);
- for (Object item : clazz.getFields()) { item.toString(); }
- for (Object item : clazz.getMethods()) { item.toString(); }
- for (Object item : clazz.getConstructors()) { item.toString(); }
- for (Object item : clazz.getAnnotations()) { item.toString(); }
+ final ClassLoader cl = module.getClassLoader();
+ final Class<?> clazz = cl.loadClass(className);
+ for (final Object item : clazz.getFields()) { item.toString(); }
+ for (final Object item : clazz.getMethods()) { item.toString(); }
+ for (final Object item : clazz.getConstructors()) { item.toString(); }
+ for (final Object item : clazz.getAnnotations()) { item.toString(); }
// checking for any declared enum constants
- for(Class klass: clazz.getClasses()){
+ for(final Class klass: clazz.getClasses()){
if(klass.isEnum()){
klass.toString();
}
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
/*
# 0 - Referring Class name
# 1 - Dependent Class name
# 2 - Element (home, ejb-class, remote)
# 3 - Bean name
*/
- String missingClass = e.getMessage();
+ final String missingClass = e.getMessage();
fail(b, "missing.dependent.class", className, missingClass, type, b.getEjbName());
- } catch (NoClassDefFoundError e) {
+ } catch (final NoClassDefFoundError e) {
/*
# 0 - Referring Class name
# 1 - Dependent Class name
# 2 - Element (home, ejb-class, remote)
# 3 - Bean name
*/
- String missingClass = e.getMessage();
+ final String missingClass = e.getMessage();
fail(b, "missing.dependent.class", className, missingClass, type, b.getEjbName());
}
}
- public Class<?> check_hasEjbClass(EnterpriseBean b) {
+ public Class<?> check_hasEjbClass(final EnterpriseBean b) {
- String ejbName = b.getEjbName();
+ final String ejbName = b.getEjbName();
- Class<?> beanClass = lookForClass(b.getEjbClass(), "ejb-class", ejbName);
- boolean isDynamicProxyImpl = DynamicProxyImplFactory.isKnownDynamicallyImplemented(beanClass);
+ final Class<?> beanClass = lookForClass(b.getEjbClass(), "ejb-class", ejbName);
+ final boolean isDynamicProxyImpl = DynamicProxyImplFactory.isKnownDynamicallyImplemented(beanClass);
if (beanClass == null) return null;
@@ -257,19 +257,19 @@ public class CheckClasses extends Valida
return beanClass;
}
- public static boolean isAbstractAllowed(Class clazz) {
+ public static boolean isAbstractAllowed(final Class clazz) {
if (DynamicProxyImplFactory.isKnownDynamicallyImplemented(clazz)) return true;
if (DynamicSubclass.isDynamic(clazz)) return true;
return false;
}
- private void check_hasInterceptorClass(Interceptor i) {
+ private void check_hasInterceptorClass(final Interceptor i) {
lookForClass(i.getInterceptorClass(), "interceptor-class", "Interceptor");
}
- private void check_isEjbClass(RemoteBean b) {
+ private void check_isEjbClass(final RemoteBean b) {
if (b instanceof SessionBean) { //NOPMD
// DMB: Beans in ejb 3 are not required to implement javax.ejb.SessionBean
// but it would still be nice to think of some sort of check to do here.
@@ -280,10 +280,10 @@ public class CheckClasses extends Valida
}
}
- private Class<?> lookForClass(String clazz, String type, String ejbName) {
+ private Class<?> lookForClass(final String clazz, final String type, final String ejbName) {
try {
return loadClass(clazz);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
/*
# 0 - Class name
# 1 - Element (home, ejb-class, remote)
@@ -292,7 +292,7 @@ public class CheckClasses extends Valida
fail(ejbName, "missing.class", clazz, type, ejbName);
- } catch (NoClassDefFoundError e) {
+ } catch (final NoClassDefFoundError e) {
/*
# 0 - Class name
# 1 - Element (home, ejb-class, remote)
@@ -307,7 +307,7 @@ public class CheckClasses extends Valida
return null;
}
- private boolean isValidInterface(RemoteBean b, Class clazz, Class beanClass, String tag) {
+ private boolean isValidInterface(final RemoteBean b, final Class clazz, final Class beanClass, final String tag) {
if (clazz.equals(beanClass)) {
@@ -367,11 +367,11 @@ public class CheckClasses extends Valida
return false;
}
- private void compareTypes(RemoteBean b, String clazz1, Class<?> class2) {
+ private void compareTypes(final RemoteBean b, final String clazz1, final Class<?> class2) {
Class<?> class1 = null;
try {
class1 = loadClass(clazz1);
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
return;
}
@@ -380,11 +380,11 @@ public class CheckClasses extends Valida
}
}
- protected Class<?> loadClass(String clazz) throws OpenEJBException {
- ClassLoader cl = module.getClassLoader();
+ protected Class<?> loadClass(final String clazz) throws OpenEJBException {
+ final ClassLoader cl = module.getClassLoader();
try {
return Class.forName(clazz, false, cl);
- } catch (ClassNotFoundException cnfe) {
+ } catch (final ClassNotFoundException cnfe) {
throw new OpenEJBException(SafeToolkit.messages.format("cl0007", clazz, module.getJarLocation()), cnfe);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java Wed Feb 19 15:47:58 2014
@@ -37,17 +37,17 @@ import java.util.Set;
*/
public class CheckDependsOn extends ValidationBase {
- public void validate(AppModule appModule) {
+ public void validate(final AppModule appModule) {
module = appModule;
- LinkResolver<Bean> app = new LinkResolver<Bean>();
+ final LinkResolver<Bean> app = new LinkResolver<Bean>();
- for (EjbModule ejbModule : appModule.getEjbModules()) {
+ for (final EjbModule ejbModule : appModule.getEjbModules()) {
- Resolver<Bean> resolver = new Resolver(app, new LinkResolver<Bean>());
+ final Resolver<Bean> resolver = new Resolver(app, new LinkResolver<Bean>());
- for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
- Bean b = new Bean(bean, ejbModule, ejbModule.getModuleUri(), resolver);
+ for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+ final Bean b = new Bean(bean, ejbModule, ejbModule.getModuleUri(), resolver);
resolver.module.add(ejbModule.getModuleUri(), bean.getEjbName(), b);
@@ -57,17 +57,17 @@ public class CheckDependsOn extends Vali
}
- for (Bean bean : app.values()) {
- EnterpriseBean enterpriseBean = bean.bean;
+ for (final Bean bean : app.values()) {
+ final EnterpriseBean enterpriseBean = bean.bean;
if (!(enterpriseBean instanceof SessionBean)) continue;
- SessionBean sessionBean = (SessionBean) enterpriseBean;
+ final SessionBean sessionBean = (SessionBean) enterpriseBean;
if (sessionBean.getSessionType() != SessionType.SINGLETON) continue;
- for (String ejbName : sessionBean.getDependsOn()) {
- Bean referee = bean.resolveLink(ejbName);
+ for (final String ejbName : sessionBean.getDependsOn()) {
+ final Bean referee = bean.resolveLink(ejbName);
if (referee == null) {
bean.module.getValidation().fail(enterpriseBean.getEjbName(), "dependsOn.noSuchEjb", ejbName);
} else {
@@ -78,22 +78,22 @@ public class CheckDependsOn extends Vali
try {
References.sort(new ArrayList<Bean>(app.values()), new References.Visitor<Bean>() {
- public String getName(Bean t) {
+ public String getName(final Bean t) {
return t.getId();
}
- public Set<String> getReferences(Bean t) {
- LinkedHashSet<String> refs = new LinkedHashSet<String>();
- for (Bean bean : t.dependsOn) {
+ public Set<String> getReferences(final Bean t) {
+ final LinkedHashSet<String> refs = new LinkedHashSet<String>();
+ for (final Bean bean : t.dependsOn) {
refs.add(bean.getId());
}
return refs;
}
});
- } catch (CircularReferencesException e) {
- for (List<Bean> circuit : e.getCircuits()) {
- List<String> ejbNames = new ArrayList<String>(circuit.size());
- for (Bean bean : circuit) {
+ } catch (final CircularReferencesException e) {
+ for (final List<Bean> circuit : e.getCircuits()) {
+ final List<String> ejbNames = new ArrayList<String>(circuit.size());
+ for (final Bean bean : circuit) {
ejbNames.add(bean.bean.getEjbName());
}
fail("EAR", "dependsOn.circuit", Join.join(" -> ", ejbNames), ejbNames.get(0));
@@ -106,13 +106,13 @@ public class CheckDependsOn extends Vali
private final LinkResolver<T> module;
private final LinkResolver<T> app;
- public Resolver(LinkResolver<T> app, LinkResolver<T> module) {
+ public Resolver(final LinkResolver<T> app, final LinkResolver<T> module) {
this.app = app;
this.module = module;
}
- public T resolveLink(String link, URI moduleUri) {
- T value = module.resolveLink(link, moduleUri);
+ public T resolveLink(final String link, final URI moduleUri) {
+ final T value = module.resolveLink(link, moduleUri);
if (value != null) return value;
return app.resolveLink(link, moduleUri);
@@ -126,14 +126,14 @@ public class CheckDependsOn extends Vali
private final EjbModule module;
private final Resolver<Bean> resolver;
- public Bean(EnterpriseBean bean, EjbModule module, URI moduleUri, Resolver<Bean> resolver) {
+ public Bean(final EnterpriseBean bean, final EjbModule module, final URI moduleUri, final Resolver<Bean> resolver) {
this.bean = bean;
this.module = module;
this.moduleUri = moduleUri;
this.resolver = resolver;
}
- public Bean resolveLink(String ejbName) {
+ public Bean resolveLink(final String ejbName) {
return resolver.resolveLink(ejbName, moduleUri);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDescriptorLocation.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDescriptorLocation.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDescriptorLocation.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDescriptorLocation.java Wed Feb 19 15:47:58 2014
@@ -37,17 +37,17 @@ import static org.apache.openejb.util.Co
public class CheckDescriptorLocation extends ValidationBase {
@Override
- public void validate(AppModule appModule){
+ public void validate(final AppModule appModule){
- List<String> validated = new ArrayList<String>();
+ final List<String> validated = new ArrayList<String>();
- for(WebModule webModule: safe(appModule.getWebModules()))
+ for(final WebModule webModule: safe(appModule.getWebModules()))
{
validated.add(webModule.getModuleId());
validateWebModule(webModule);
}
- for(EjbModule ejbModule: safe(appModule.getEjbModules()))
+ for(final EjbModule ejbModule: safe(appModule.getEjbModules()))
{
//without this check, CheckDescriptorLocationTest#testWarWithDescriptorInRoot() would fail
if(!validated.contains(ejbModule.getModuleId()))
@@ -58,46 +58,46 @@ public class CheckDescriptorLocation ext
}
- private void validateWebModule(DeploymentModule webModule) {
+ private void validateWebModule(final DeploymentModule webModule) {
this.module= webModule;
- List<String> descriptorsToSearch = Arrays.asList("beans.xml","ejb-jar.xml","faces-config.xml");
- File file = webModule.getFile();
+ final List<String> descriptorsToSearch = Arrays.asList("beans.xml","ejb-jar.xml","faces-config.xml");
+ final File file = webModule.getFile();
if (file != null) {
try {
- URL rootOfArchive=file.toURI().toURL();
- URL metaInf=new URL(rootOfArchive.toExternalForm()+"META-INF/");
- Map<String, URL> incorrectlyLocatedDescriptors = retrieveDescriptors(descriptorsToSearch, rootOfArchive, metaInf);
+ final URL rootOfArchive=file.toURI().toURL();
+ final URL metaInf=new URL(rootOfArchive.toExternalForm()+"META-INF/");
+ final Map<String, URL> incorrectlyLocatedDescriptors = retrieveDescriptors(descriptorsToSearch, rootOfArchive, metaInf);
warnIncorrectLocationOfDescriptors(incorrectlyLocatedDescriptors,"WEB-INF");
- } catch (MalformedURLException ignored) {
+ } catch (final MalformedURLException ignored) {
//ignored
}
}
}
- public void validateEjbModule(DeploymentModule deploymentModule) {
+ public void validateEjbModule(final DeploymentModule deploymentModule) {
this.module= deploymentModule;
- List<String> descriptorsToSearch = Arrays.asList("beans.xml","ejb-jar.xml","openejb-jar.xml","env-entries.properties");
- File file = deploymentModule.getFile();
+ final List<String> descriptorsToSearch = Arrays.asList("beans.xml","ejb-jar.xml","openejb-jar.xml","env-entries.properties");
+ final File file = deploymentModule.getFile();
if (file != null) {
try {
- URL rootOfArchive=file.toURI().toURL();
- Map<String, URL> incorrectlyLocatedDescriptors
+ final URL rootOfArchive=file.toURI().toURL();
+ final Map<String, URL> incorrectlyLocatedDescriptors
= retrieveDescriptors(descriptorsToSearch, rootOfArchive);
warnIncorrectLocationOfDescriptors(incorrectlyLocatedDescriptors,"META-INF");
- } catch (MalformedURLException ignored) {
+ } catch (final MalformedURLException ignored) {
//ignored
}
}
}
- private static Map<String,URL> retrieveDescriptors(List<String> descriptorsToSearch, URL... locationsToSearch ){
+ private static Map<String,URL> retrieveDescriptors(final List<String> descriptorsToSearch, final URL... locationsToSearch ){
final Map<String,URL> descriptorAndWrongLocation = new HashMap<String,URL>();
- ResourceFinder finder = new ResourceFinder(locationsToSearch);
- for(String descriptor:descriptorsToSearch)
+ final ResourceFinder finder = new ResourceFinder(locationsToSearch);
+ for(final String descriptor:descriptorsToSearch)
{
- URL resource = finder.getResource(descriptor);
+ final URL resource = finder.getResource(descriptor);
if(resource!=null)
{
descriptorAndWrongLocation.put(descriptor,resource);
@@ -107,8 +107,8 @@ public class CheckDescriptorLocation ext
return descriptorAndWrongLocation;
}
- private void warnIncorrectLocationOfDescriptors(Map<String, URL> descriptorsPlacedInWrongLocation, String expectedLocation) {
- for (Map.Entry<String, URL> map : descriptorsPlacedInWrongLocation.entrySet()) {
+ private void warnIncorrectLocationOfDescriptors(final Map<String, URL> descriptorsPlacedInWrongLocation, final String expectedLocation) {
+ for (final Map.Entry<String, URL> map : descriptorsPlacedInWrongLocation.entrySet()) {
warn(this.module.toString(), "descriptor.incorrectLocation", map.getValue().toExternalForm(), expectedLocation);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java Wed Feb 19 15:47:58 2014
@@ -67,15 +67,15 @@ public class CheckIncorrectPropertyNames
}
@Override
- public void validate(AppModule appModule)
+ public void validate(final AppModule appModule)
{
this.module=appModule;
- Properties systemProperties=SystemInstance.get().getProperties();
+ final Properties systemProperties=SystemInstance.get().getProperties();
- Iterator iterator = incorrectAndCorrectPropNames.entrySet().iterator();
+ final Iterator iterator = incorrectAndCorrectPropNames.entrySet().iterator();
while(iterator.hasNext())
{
- Map.Entry<String,String> entry = (Map.Entry<String,String>)iterator.next();
+ final Map.Entry<String,String> entry = (Map.Entry<String,String>)iterator.next();
if(systemProperties.containsKey(entry.getKey()))
{
warn(appModule.toString(),"incorrect.property.name",entry.getKey(),entry.getValue());
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionPointUsage.java Wed Feb 19 15:47:58 2014
@@ -29,18 +29,18 @@ import java.lang.reflect.Field;
public class CheckInjectionPointUsage extends ValidationBase {
@Override
- public void validate(EjbModule ejbModule) {
+ public void validate(final EjbModule ejbModule) {
if (ejbModule.getBeans() == null) return;
try {
- for (Field field : ejbModule.getFinder().findAnnotatedFields(Inject.class)) {
+ for (final 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());
}
- } catch (NoClassDefFoundError noClassDefFoundError) {
+ } catch (final 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
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckInjectionTargets.java Wed Feb 19 15:47:58 2014
@@ -28,10 +28,10 @@ import java.util.List;
* @version $Rev$ $Date$
*/
public class CheckInjectionTargets extends ValidationBase {
- public void validate(EjbModule ejbModule) {
+ public void validate(final EjbModule ejbModule) {
- for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
- List<JndiReference> entries = new ArrayList<JndiReference>();
+ for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+ final List<JndiReference> entries = new ArrayList<JndiReference>();
entries.addAll(bean.getEjbLocalRef());
entries.addAll(bean.getEjbRef());
entries.addAll(bean.getEnvEntry());
@@ -42,9 +42,9 @@ public class CheckInjectionTargets exten
entries.addAll(bean.getResourceRef());
entries.addAll(bean.getServiceRef());
- for (JndiReference reference : entries) {
+ for (final JndiReference reference : entries) {
// check injection target
- for (InjectionTarget target : reference.getInjectionTarget()) {
+ for (final InjectionTarget target : reference.getInjectionTarget()) {
boolean classPrefix = false;
String name = target.getInjectionTargetName();
@@ -53,13 +53,13 @@ public class CheckInjectionTargets exten
name = name.substring(target.getInjectionTargetClass().length() + 1);
}
- String shortNameInvalid = name;
+ final String shortNameInvalid = name;
if (name.startsWith("set") && name.length() >= 4 && Character.isUpperCase(name.charAt(3))) {
- StringBuilder correctName = new StringBuilder(name);
+ final StringBuilder correctName = new StringBuilder(name);
correctName.delete(0, 3);
correctName.setCharAt(0, Character.toLowerCase(correctName.charAt(0)));
- String shortNameCorrect = correctName.toString();
+ final String shortNameCorrect = correctName.toString();
if (classPrefix) correctName.insert(0, target.getInjectionTargetClass() + "/");
warn(bean, "injectionTarget.nameContainsSet", target.getInjectionTargetName(), shortNameInvalid, shortNameCorrect, correctName, reference.getName(), reference.getClass().getSimpleName());
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckMethods.java Wed Feb 19 15:47:58 2014
@@ -34,11 +34,11 @@ import java.util.List;
public class CheckMethods extends ValidationBase {
- public void validate(EjbModule ejbModule) {
+ public void validate(final EjbModule ejbModule) {
- for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+ for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
if (!(bean instanceof RemoteBean)) continue;
- RemoteBean b = (RemoteBean) bean;
+ final RemoteBean b = (RemoteBean) bean;
if (b.getHome() != null) {
check_remoteInterfaceMethods(b);
@@ -55,13 +55,13 @@ public class CheckMethods extends Valida
}
}
- private void check_localHomeInterfaceMethods(RemoteBean b) {
+ private void check_localHomeInterfaceMethods(final RemoteBean b) {
Class home = null;
Class bean = null;
try {
home = loadClass(b.getLocalHome());
bean = loadClass(b.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
return;
}
@@ -75,13 +75,13 @@ public class CheckMethods extends Valida
}
}
- private void check_localInterfaceMethods(RemoteBean b) {
+ private void check_localInterfaceMethods(final RemoteBean b) {
Class intrface = null;
Class beanClass = null;
try {
intrface = loadClass(b.getLocal());
beanClass = loadClass(b.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
return;
}
@@ -89,19 +89,19 @@ public class CheckMethods extends Valida
return;
}
- Method[] interfaceMethods = intrface.getMethods();
+ final Method[] interfaceMethods = intrface.getMethods();
for (int i = 0; i < interfaceMethods.length; i++) {
if (interfaceMethods[i].getDeclaringClass() == EJBLocalObject.class) continue;
- String name = interfaceMethods[i].getName();
+ final String name = interfaceMethods[i].getName();
try {
- Class[] params = interfaceMethods[i].getParameterTypes();
+ final Class[] params = interfaceMethods[i].getParameterTypes();
beanClass.getMethod(name, params);
- } catch (NoSuchMethodException nsme) {
- List<Method> differentArgs = new ArrayList<Method>();
- List<Method> differentCase = new ArrayList<Method>();
+ } catch (final NoSuchMethodException nsme) {
+ final List<Method> differentArgs = new ArrayList<Method>();
+ final List<Method> differentCase = new ArrayList<Method>();
- for (Method method : beanClass.getMethods()) {
+ for (final Method method : beanClass.getMethods()) {
if (method.getName().equals(name)){
differentArgs.add(method);
} else if (method.getName().equalsIgnoreCase(name)){
@@ -123,14 +123,14 @@ public class CheckMethods extends Valida
}
- private void check_remoteInterfaceMethods(RemoteBean b) {
+ private void check_remoteInterfaceMethods(final RemoteBean b) {
Class intrface = null;
Class beanClass = null;
try {
intrface = loadClass(b.getRemote());
beanClass = loadClass(b.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
return;
}
@@ -138,19 +138,19 @@ public class CheckMethods extends Valida
return;
}
- Method[] interfaceMethods = intrface.getMethods();
+ final Method[] interfaceMethods = intrface.getMethods();
for (int i = 0; i < interfaceMethods.length; i++) {
if (interfaceMethods[i].getDeclaringClass() == EJBObject.class) continue;
- String name = interfaceMethods[i].getName();
+ final String name = interfaceMethods[i].getName();
try {
- Class[] params = interfaceMethods[i].getParameterTypes();
+ final Class[] params = interfaceMethods[i].getParameterTypes();
beanClass.getMethod(name, params);
- } catch (NoSuchMethodException nsme) {
- List<Method> differentArgs = new ArrayList<Method>();
- List<Method> differentCase = new ArrayList<Method>();
+ } catch (final NoSuchMethodException nsme) {
+ final List<Method> differentArgs = new ArrayList<Method>();
+ final List<Method> differentCase = new ArrayList<Method>();
- for (Method method : beanClass.getMethods()) {
+ for (final Method method : beanClass.getMethods()) {
if (method.getName().equals(name)){
differentArgs.add(method);
} else if (method.getName().equalsIgnoreCase(name)){
@@ -172,13 +172,13 @@ public class CheckMethods extends Valida
}
- private void check_homeInterfaceMethods(RemoteBean b) {
+ private void check_homeInterfaceMethods(final RemoteBean b) {
Class home = null;
Class bean = null;
try {
home = loadClass(b.getHome());
bean = loadClass(b.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
return;
}
@@ -193,14 +193,14 @@ public class CheckMethods extends Valida
}
}
- public boolean check_hasCreateMethod(RemoteBean b, Class bean, Class home) {
+ public boolean check_hasCreateMethod(final RemoteBean b, final Class bean, final Class home) {
if (b instanceof SessionBean && !javax.ejb.SessionBean.class.isAssignableFrom(bean)) {
// This is a pojo-style bean
return false;
}
- Method[] homeMethods = home.getMethods();
+ final Method[] homeMethods = home.getMethods();
boolean hasCreateMethod = false;
@@ -217,17 +217,17 @@ public class CheckMethods extends Valida
return hasCreateMethod;
}
- public boolean check_createMethodsAreImplemented(RemoteBean b, Class bean, Class home) {
+ public boolean check_createMethodsAreImplemented(final RemoteBean b, final Class bean, final Class home) {
boolean result = true;
- Method[] homeMethods = home.getMethods();
+ final Method[] homeMethods = home.getMethods();
for (int i = 0; i < homeMethods.length; i++) {
if (!homeMethods[i].getName().startsWith("create")) continue;
- Method create = homeMethods[i];
+ final Method create = homeMethods[i];
- StringBuilder ejbCreateName = new StringBuilder(create.getName());
+ final StringBuilder ejbCreateName = new StringBuilder(create.getName());
ejbCreateName.replace(0, 1, "ejbC");
try {
@@ -235,19 +235,19 @@ public class CheckMethods extends Valida
bean.getMethod(ejbCreateName.toString(), create.getParameterTypes());
}
// TODO: else { /* Check for Init method in pojo session bean class */ }
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
result = false;
- String paramString = getParameters(create);
+ final String paramString = getParameters(create);
if (b instanceof EntityBean) {
- EntityBean entity = (EntityBean) b;
+ final EntityBean entity = (EntityBean) b;
fail(b, "entity.no.ejb.create", b.getEjbClass(), entity.getPrimKeyClass(), ejbCreateName.toString(), paramString);
} else {
if (b instanceof SessionBean) {
- SessionBean sb = (SessionBean) b;
+ final SessionBean sb = (SessionBean) b;
// Under EJB 3.1, it is not required that a stateless session bean have an ejbCreate method, even when it has a home interface
if (!sb.getSessionType().equals(SessionType.STATELESS))
fail(b, "session.no.ejb.create", b.getEjbClass(), ejbCreateName.toString(), paramString);
@@ -259,25 +259,25 @@ public class CheckMethods extends Valida
return result;
}
- public boolean check_postCreateMethodsAreImplemented(RemoteBean b, Class bean, Class home) {
+ public boolean check_postCreateMethodsAreImplemented(final RemoteBean b, final Class bean, final Class home) {
boolean result = true;
if (b instanceof SessionBean) return true;
- Method[] homeMethods = home.getMethods();
- Method[] beanMethods = bean.getMethods();
+ final Method[] homeMethods = home.getMethods();
+ final Method[] beanMethods = bean.getMethods();
for (int i = 0; i < homeMethods.length; i++) {
if (!homeMethods[i].getName().startsWith("create")) continue;
- Method create = homeMethods[i];
- StringBuilder ejbPostCreateName = new StringBuilder(create.getName());
+ final Method create = homeMethods[i];
+ final StringBuilder ejbPostCreateName = new StringBuilder(create.getName());
ejbPostCreateName.replace(0, 1, "ejbPostC");
try {
bean.getMethod(ejbPostCreateName.toString(), create.getParameterTypes());
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
result = false;
- String paramString = getParameters(create);
+ final String paramString = getParameters(create);
fail(b, "no.ejb.post.create", b.getEjbClass(), ejbPostCreateName.toString(), paramString);
@@ -287,7 +287,7 @@ public class CheckMethods extends Valida
return result;
}
- public void check_unusedCreateMethods(RemoteBean b) {
+ public void check_unusedCreateMethods(final RemoteBean b) {
Class home = null;
Class localHome = null;
@@ -302,15 +302,15 @@ public class CheckMethods extends Valida
}
bean = loadClass(b.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
return;
}
- for (Method ejbCreate : bean.getMethods()) {
+ for (final Method ejbCreate : bean.getMethods()) {
if (!ejbCreate.getName().startsWith("ejbCreate")) continue;
- StringBuilder create = new StringBuilder(ejbCreate.getName());
+ final StringBuilder create = new StringBuilder(ejbCreate.getName());
create.replace(0, "ejbC".length(), "c");
@@ -322,7 +322,7 @@ public class CheckMethods extends Valida
localHome.getMethod(create.toString(), ejbCreate.getParameterTypes());
inLocalHome = true;
}
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
// no-op
}
@@ -331,39 +331,39 @@ public class CheckMethods extends Valida
home.getMethod(create.toString(), ejbCreate.getParameterTypes());
inHome = true;
}
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
// no-op
}
if (!inLocalHome && !inHome){
- String paramString = getParameters(ejbCreate);
+ final String paramString = getParameters(ejbCreate);
warn(b, "unused.ejb.create", b.getEjbClass(), ejbCreate.getName(), paramString, create.toString());
}
}
}
- public void check_unusedPostCreateMethods(RemoteBean b) {
+ public void check_unusedPostCreateMethods(final RemoteBean b) {
Class bean = null;
try {
bean = loadClass(b.getEjbClass());
- } catch (OpenEJBException e) {
+ } catch (final OpenEJBException e) {
return;
}
- for (Method postCreate : bean.getMethods()) {
+ for (final Method postCreate : bean.getMethods()) {
if (!postCreate.getName().startsWith("ejbPostCreate")) continue;
- StringBuilder ejbCreate = new StringBuilder(postCreate.getName());
+ final StringBuilder ejbCreate = new StringBuilder(postCreate.getName());
ejbCreate.replace(0, "ejbPostCreate".length(), "ejbCreate");
try {
bean.getMethod(ejbCreate.toString(), postCreate.getParameterTypes());
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
- String paramString = getParameters(postCreate);
+ final String paramString = getParameters(postCreate);
warn(b, "unused.ejbPostCreate", b.getEjbClass(), postCreate.getName(), paramString, ejbCreate.toString());
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckPersistenceRefs.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckPersistenceRefs.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckPersistenceRefs.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckPersistenceRefs.java Wed Feb 19 15:47:58 2014
@@ -28,25 +28,25 @@ import org.apache.openejb.jee.SessionBea
* @version $Rev$ $Date$
*/
public class CheckPersistenceRefs extends ValidationBase {
- public void validate(EjbModule ejbModule) {
+ public void validate(final EjbModule ejbModule) {
- for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+ for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
if (bean instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) bean;
+ final SessionBean sessionBean = (SessionBean) bean;
if (sessionBean.getSessionType() == null) {
continue; // skipping since we don't know here what is the type
}
}
- String beanType = getType(bean);
+ final String beanType = getType(bean);
if (beanType.equals("Stateful")) {
continue; // skip statefuls and Comp ManagedBean
}
- for (PersistenceContextRef ref : bean.getPersistenceContextRef()) {
+ for (final PersistenceContextRef ref : bean.getPersistenceContextRef()) {
if (isExtented(ref)) {
String refName = ref.getName();
- String prefix = bean.getEjbClass() + "/";
+ final String prefix = bean.getEjbClass() + "/";
if (refName.startsWith(prefix)) {
refName = refName.substring(prefix.length());
}
@@ -57,14 +57,14 @@ public class CheckPersistenceRefs extend
}
}
- private boolean isExtented(PersistenceContextRef ref) {
- PersistenceContextType type = ref.getPersistenceContextType();
+ private boolean isExtented(final PersistenceContextRef ref) {
+ final PersistenceContextType type = ref.getPersistenceContextType();
return type != null && type.equals(PersistenceContextType.EXTENDED);
}
- private String getType(EnterpriseBean bean) {
+ private String getType(final EnterpriseBean bean) {
if (bean instanceof SessionBean) {
- SessionBean sessionBean = (SessionBean) bean;
+ final SessionBean sessionBean = (SessionBean) bean;
switch(sessionBean.getSessionType()){
case STATEFUL: return "Stateful";
case STATELESS: return "Stateless";