[jboss-cvs] JBossAS SVN: r68817 - branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 10 07:33:27 EST 2008


Author: thomas.diesler at jboss.com
Date: 2008-01-10 07:33:26 -0500 (Thu, 10 Jan 2008)
New Revision: 68817

Modified:
   branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java
   branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java
   branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB3.java
Log:
Fix NPE with HTTP access to JMS endpoints

Modified: branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java
===================================================================
--- branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java	2008-01-10 12:25:42 UTC (rev 68816)
+++ branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java	2008-01-10 12:33:26 UTC (rev 68817)
@@ -77,7 +77,7 @@
          }
          catch (Exception ex)
          {
-            throw new IllegalStateException("Canot get target bean instance", ex);
+            throw new IllegalStateException("Cannot get target bean instance", ex);
          }
       }
       return targetBean;

Modified: branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java
===================================================================
--- branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java	2008-01-10 12:25:42 UTC (rev 68816)
+++ branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB21.java	2008-01-10 12:33:26 UTC (rev 68817)
@@ -23,14 +23,13 @@
 
 // $Id: InvocationHandlerEJB21.java 3524 2007-06-09 17:28:37Z thomas.diesler at jboss.com $
 
+import java.lang.reflect.Method;
+
 import org.jboss.logging.Logger;
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.spi.invocation.Invocation;
 import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.invocation.InvocationHandler;
 
-import java.lang.reflect.Method;
-
 /**
  * Handles invocations on MDB EJB21 endpoints.
  *
@@ -58,8 +57,21 @@
 
       try
       {
-         InvocationContext invContext = epInv.getInvocationContext();
-         Object targetBean = invContext.getTargetBean();
+         InvocationContext invCtx = epInv.getInvocationContext();
+         Object targetBean = invCtx.getTargetBean();
+         if (targetBean == null)
+         {
+            try
+            {
+               Class epImpl = ep.getTargetBeanClass();
+               targetBean = epImpl.newInstance();
+               invCtx.setTargetBean(targetBean);
+            }
+            catch (Exception ex)
+            {
+               throw new IllegalStateException("Cannot get target bean instance", ex);
+            }
+         }
          Class implClass = targetBean.getClass();
          Method seiMethod = epInv.getJavaMethod();
          Method implMethod = getImplMethod(implClass, seiMethod);

Modified: branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB3.java
===================================================================
--- branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB3.java	2008-01-10 12:25:42 UTC (rev 68816)
+++ branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/InvocationHandlerMDB3.java	2008-01-10 12:33:26 UTC (rev 68817)
@@ -57,8 +57,21 @@
 
       try
       {
-         InvocationContext invContext = epInv.getInvocationContext();
-         Object targetBean = invContext.getTargetBean();
+         InvocationContext invCtx = epInv.getInvocationContext();
+         Object targetBean = invCtx.getTargetBean();
+         if (targetBean == null)
+         {
+            try
+            {
+               Class epImpl = ep.getTargetBeanClass();
+               targetBean = epImpl.newInstance();
+               invCtx.setTargetBean(targetBean);
+            }
+            catch (Exception ex)
+            {
+               throw new IllegalStateException("Cannot get target bean instance", ex);
+            }
+         }
          Class implClass = targetBean.getClass();
          Method seiMethod = epInv.getJavaMethod();
          Method implMethod = getImplMethod(implClass, seiMethod);




More information about the jboss-cvs-commits mailing list