Author: covener
Date: Sun Sep 19 22:03:46 2010
New Revision: 998740
URL: http://svn.apache.org/viewvc?rev=998740&view=rev
Log:
[OWB-455] avoid IllegalArgumentException when calling our scanned-up-front
remove
methods from the impl class on the EJB proxy given out by the container.
Modified:
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
Modified:
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java?rev=998740&r1=998739&r2=998740&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
(original)
+++
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java
Sun Sep 19 22:03:46 2010
@@ -158,14 +158,25 @@ public abstract class BaseEjbBean<T> ext
protected void destroyStatefulSessionBeanInstance(T proxyInstance, Object
ejbInstance)
{
- List<Method> methods = getRemoveMethods();
- if (methods.size() > 0)
+ Method removeMeth = null;
+ for (Method m : getRemoveMethods())
{
// FIXME: This needs to call an API from the EJB
// container to remove the EJB instance directly,
// not via a remove method. For now, just call 1
// remove method directly on the EJB
- ClassUtil.callInstanceMethod(methods.get(0), ejbInstance,
ClassUtil.OBJECT_EMPTY);
+ try
+ {
+ removeMeth = proxyInstance.getClass().getMethod(m.getName(),
m.getParameterTypes());
+ ClassUtil.callInstanceMethod(removeMeth, proxyInstance,
ClassUtil.OBJECT_EMPTY);
+ }
+ catch (NoSuchMethodException e)
+ {
+ if (logger.wblWillLogDebug())
+ {
+ logger.debug("Error calling remove method: ", e);
+ }
+ }
}
}
/**