<?xml version="1.0" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.jacorb.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://www.jacorb.org/bugzilla/"
          
          maintainer="jacorb@goots.org"
>

    <bug>
          <bug_id>785</bug_id>
          
          <creation_ts>2007-06-06 04:14:27 +0000</creation_ts>
          <short_desc>SystemException returned from a DSI servant to DII client is not marshalled properly</short_desc>
          <delta_ts>2013-12-31 03:56:09 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>JacORB</product>
          <component>ORB</component>
          <version>2.3.0</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 2000</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Popovich">earthmabus</reporter>
          <assigned_to name="Nick Cross">jacorb</assigned_to>
          <cc>jacorb</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2170</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Popovich">earthmabus</who>
    <bug_when>2007-06-06 04:14:27 +0000</bug_when>
    <thetext>I&apos;m using a DII client to invoke a method against a co-located DSI servant.  
The DSI servant attempts to return a SystemException (in the form of an Any) 
to the client, however the client does not receive the SystemException.

Here&apos;s a snippet of the DSI code that is returning the SystemException...

public void invoke(org.omg.CORBA.ServerRequest request) {
...

// I&apos;ve received a systemException and must put it into an Any for request
SystemException sysExcep = ...; 
org.omg.CORBA.Any exceptionCopy = DUC.CorbaObjectRegistry.getInstance().getOrb
().create_any();
org.omg.CORBA.portable.OutputStream outputStreamForExceptionCopy = 
exceptionCopy.create_output_stream();
org.omg.CORBA.SystemExceptionHelper.insert(exceptionCopy, sysExcep);

// put the exceptionCopy into the request
request.set_exception(exceptionCopy);
...
}

Again, I have a CORBA object reference to an instance of the above DSI servant 
that invokes a method on the DSI servant (through the CORBA object 
reference).  The code for the DII client that makes this happen AND has a 
problem:

...
org.omg.CORBA.Request req = mObjRef._request(&quot;myoperation&quot;);
...
// code to specify and populate arguments removed for clarity
// code to specify return type removed for clarity
// code to specify exception list and types removed for clarity
...
// invoke a request against the DSI servant through it&apos;s CORBA object reference
req.invoke();
...
// the request has completed, we&apos;re going to get either a return value or 
exception
if (req.env().exception() != null) {
// this means req.env().exception() is non-null and an exception was raised
}
else {
// this means that no exception was raised and req.result().value() should be 
non-null
}

The problem that I&apos;m seeing is that after the req.invoke() request completes, 
both req.env().exception() AND req.result().value() are BOTH null!!!  Since I 
returned a SystemException (in the form of an Any in the DSI servant), the ORB 
should be providing the DII caller with a SystemException, but it&apos;s not.

Anyways, since the logic of my code above first checks to see if req.env
().exception() contains a non-null value (which it does not), the ORB executes 
my else statement and attempts to work with req.result().value() which craps 
out since that value is null.

I did some further investigation by putting JacORB into logging verbosity 
level 4 and noticed that the code responsible for handling the DII request is 
interpreting the exception as an ApplicationException within the ReplyReceiver 
class.  (I did not check to see if the ORB originally marshalled the 
SystemException within the Any from the invoke(request) method properly so 
this might be the problem.)

Anyways, attached is a stack trace from JacORB showing where it&apos;s having some 
problems while attempting to de-marshall the Any containing the 
SystemException in the DII:

[05-06-2007 21:48:48:655] jacorb.org.giop:DEBUG: ServerRequest: reply to 
myoperation
[05-06-2007 21:48:48:655] jacorb.dii.request:DEBUG: ApplicationException
org.omg.CORBA.portable.ApplicationException
        at org.jacorb.orb.ReplyReceiver.getApplicationException 
(ReplyReceiver.java:390)
        at org.jacorb.orb.ReplyReceiver.getReply(ReplyReceiver.java:315)
        at org.jacorb.orb.Delegate.invoke_internal(Delegate.java:1074)
        at org.jacorb.orb.Delegate.invoke(Delegate.java:939)
        at org.jacorb.orb.dii.Request._invoke(Request.java:268)
        at org.jacorb.orb.dii.Request.invoke(Request.java:364)

The problem is 100% reproducible for me.  If there&apos;s any assistance 
(additional code, more output from the ORB, etc.) that I can provide to help 
resolve the problem, please feel free to email me.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2174</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Popovich">earthmabus</who>
    <bug_when>2007-06-07 06:28:43 +0000</bug_when>
    <thetext>One more critical piece of information for clarification... If the DSI servant 
and the DII client are NOT co-located, the exception condition described above 
WILL occur.  If the DSI servant and the DII client reside within different 
processes, everything will execute normally with no exception.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2916</commentid>
    <comment_count>2</comment_count>
    <who name="Nick Cross">jacorb</who>
    <bug_when>2012-08-11 22:21:31 +0000</bug_when>
    <thetext>Can you provide a standalone, compilable test case? </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3096</commentid>
    <comment_count>3</comment_count>
    <who name="Nick Cross">jacorb</who>
    <bug_when>2013-12-23 07:04:21 +0000</bug_when>
    <thetext>Unable to reproduce. Added tests under SHA 7c0319b09b30ec2bd9a2fbddd96acf3a7de13066. Please modify one of the tests and reopen if its still a problem</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3098</commentid>
    <comment_count>4</comment_count>
    <who name="Nick Cross">jacorb</who>
    <bug_when>2013-12-31 03:56:09 +0000</bug_when>
    <thetext>Corrected commit message - sha : f6489a046c28508a30044b582a489d5bf760f545</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>