changeset 236:ff0f02a67881

6382377: incorrect Exception is given to interceptor 6828768: RMI-IIOP EJB clients do not fail over due to defect in JDK 1.6.0_12 Summary: Also reviewed by ken.cavanaugh@oracle.com Reviewed-by: skoppar
author vikram
date Mon, 29 Nov 2010 22:10:46 -0800
parents 34af2070439b
children d2049cfdf02b
files src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java
diffstat 2 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java	Thu Oct 07 01:03:51 2010 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java	Mon Nov 29 22:10:46 2010 -0800
@@ -30,12 +30,14 @@
 import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
 import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
 import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
 import com.sun.corba.se.impl.encoding.BufferManagerWrite;
 import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
 import com.sun.corba.se.impl.encoding.CDROutputObject;
 import com.sun.corba.se.spi.orb.ORB;
 import com.sun.corba.se.pept.transport.Connection;
 import com.sun.corba.se.pept.encoding.OutputObject;
+import org.omg.CORBA.SystemException;
 
 /**
  * Streaming buffer manager.
@@ -66,7 +68,13 @@
         // Set the fragment's moreFragments field to true
         MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);
 
-        sendFragment(false);
+        try {
+           sendFragment(false);
+        } catch(SystemException se){
+                orb.getPIHandler().invokeClientPIEndingPoint(
+                        ReplyMessage.SYSTEM_EXCEPTION, se);
+                throw se;
+        }
 
         // Reuse the old buffer
 
--- a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java	Thu Oct 07 01:03:51 2010 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java	Mon Nov 29 22:10:46 2010 -0800
@@ -385,11 +385,15 @@
             boolean retry  =
                 getContactInfoListIterator(orb)
                     .reportException(messageMediator.getContactInfo(), e);
+
+            //Bug 6382377: must not lose exception in PI
+
+            // Must run interceptor end point before retrying.
+            Exception newException =
+                    orb.getPIHandler().invokeClientPIEndingPoint(
+                    ReplyMessage.SYSTEM_EXCEPTION, e);
+
             if (retry) {
-                // Must run interceptor end point before retrying.
-                Exception newException =
-                    orb.getPIHandler().invokeClientPIEndingPoint(
-                        ReplyMessage.SYSTEM_EXCEPTION, e);
                 if (newException == e) {
                     continueOrThrowSystemOrRemarshal(messageMediator,
                                                      new RemarshalException());
@@ -398,6 +402,14 @@
                                                      newException);
                 }
             } else {
+                if (newException instanceof RuntimeException){
+                    throw (RuntimeException)newException;
+                }
+                else if (newException instanceof RemarshalException)
+                {
+                    throw (RemarshalException)newException;
+                }
+
                 // NOTE: Interceptor ending point will run in releaseReply.
                 throw e;
             }