You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2009/01/07 22:10:15 UTC

svn commit: r732496 - in /openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client: EJBHomeHandler.java EJBInvocationHandler.java EJBObjectHandler.java ServerMetaData.java

Author: dblevins
Date: Wed Jan  7 13:10:15 2009
New Revision: 732496

URL: http://svn.apache.org/viewvc?rev=732496&view=rev
Log:
Fixed issue where sending a proxy from server to client then from client to server where it is then invoked results in a null pointer due to improper deserialization of the proxy on the return trip.
Improved error handling -- exception causes were getting lost in some places.

Modified:
    openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java
    openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java
    openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java
    openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java?rev=732496&r1=732495&r2=732496&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java Wed Jan  7 13:10:15 2009
@@ -149,13 +149,13 @@
 
         } catch (SystemException e) {
             invalidateReference();
-            throw convertException(e.getCause(), method);
+            throw convertException(getCause(e), method);
             /*
             * Application exceptions must be reported dirctly to the client. They
             * do not impact the viability of the proxy.
             */
         } catch (ApplicationException ae) {
-            throw convertException(ae.getCause(), method);
+            throw convertException(getCause(ae), method);
             /*
             * A system exception would be highly unusual and would indicate a sever
             * problem with the container system.
@@ -163,9 +163,9 @@
         } catch (SystemError se) {
             invalidateReference();
             if (remote) {
-                throw new RemoteException("Container has suffered a SystemException", se.getCause());
+                throw new RemoteException("Container has suffered a SystemException", getCause(se));
             } else {
-                throw new EJBException("Container has suffered a SystemException").initCause(se.getCause());
+                throw new EJBException("Container has suffered a SystemException").initCause(getCause(se));
             }
         } catch (Throwable oe) {
             if (remote) {

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java?rev=732496&r1=732495&r2=732496&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBInvocationHandler.java Wed Jan  7 13:10:15 2009
@@ -232,7 +232,7 @@
         return e;
     }
 
-    protected Throwable getCause(Throwable e) {
+    protected static Throwable getCause(Throwable e) {
         if (e != null && e.getCause() != null) {
             return e.getCause();
         }

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java?rev=732496&r1=732495&r2=732496&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java Wed Jan  7 13:10:15 2009
@@ -159,13 +159,13 @@
 
         } catch (SystemException e) {
             invalidateAllHandlers(getRegistryId());
-            throw convertException(e.getCause(), m);
+            throw convertException(getCause(e), m);
             /*
             * Application exceptions must be reported dirctly to the client. They
             * do not impact the viability of the proxy.
             */
         } catch (ApplicationException ae) {
-            throw convertException(ae.getCause(), m);
+            throw convertException(getCause(ae), m);
             /*
             * A system exception would be highly unusual and would indicate a sever
             * problem with the container system.
@@ -173,15 +173,15 @@
         } catch (SystemError se) {
             invalidateReference();
             if (remote) {
-                throw new RemoteException("Container has suffered a SystemException", se.getCause());
+                throw new RemoteException("Container has suffered a SystemException", getCause(se));
             } else {
-                throw new EJBException("Container has suffered a SystemException").initCause(se.getCause());
+                throw new EJBException("Container has suffered a SystemException").initCause(getCause(se));
             }
         } catch (Throwable oe) {
             if (remote) {
-                throw new RemoteException("Unknown Container Exception: " + oe.getClass().getName() + ": " + oe.getMessage(), oe.getCause());
+                throw new RemoteException("Unknown Container Exception: " + oe.getClass().getName() + ": " + oe.getMessage(), getCause(oe));
             } else {
-                throw new EJBException("Unknown Container Exception: " + oe.getClass().getName() + ": " + oe.getMessage()).initCause(oe.getCause());
+                throw new EJBException("Unknown Container Exception: " + oe.getClass().getName() + ": " + oe.getMessage()).initCause(getCause(oe));
             }
         }
         return retValue;

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java?rev=732496&r1=732495&r2=732496&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java Wed Jan  7 13:10:15 2009
@@ -60,6 +60,7 @@
         byte version = in.readByte();
 
         locations = (URI[]) in.readObject();
+        location = locations[0];
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {