I'd like to raise the following as an urgent issue for the Java to IDL
RTF:
RuntimeExceptions/Errors are broken in RMI-IIOP when interoperating
between J2SE 1.3 and 1.4 (or "class evolution in service contexts is
broken").
When an unchecked exception (RuntimeException, Error) occurs in
RMI-IIOP, it is translated into a CORBA UNKNOWN system exception, and
the real Java exception is marshaled as a CDR encapsulation in the
UnknownExceptionInfo service context. (Java to IDL formal 01-06-07
1.4.7, 1.4.8.1)
In J2SE 1.4, java.lang.Throwable has evolved to add several new
non-transient fields including
private Throwable cause;
private StackTraceElement[] stackTrace;
This means that when J2SE 1.3.x talks to 1.4 and an unchecked
exception occurs, there is a class evolution scenario occurring inside
of the UnknownExceptionInfo service context. Normally, class
evolution is handled by using the SendingContextRunTime CodeBase to
find out what the sender put on the wire. This service context is
sent by the client on the first request on a connection and by the
server on the first reply on a connection. (Java to IDL formal
01-06-07 1.5.1)
This presents two problems:
1. Since the UnknownExceptionInfo service context has the Throwable
in an encapsulation, technically it has no connection information.
2. Even if we assumed that we use the connection on which this
encapsulation is transmitted, we would need to make sure that the
SendingContextRunTime service context is unmarshaled BEFORE the
UnknownExceptionInfo service context so that the connection has the
CodeBase to use to unmarshal the evolved Throwable class.
Here are two possible solutions:
1. Service context ordering proposal (strawman):
Require that service context encapsulations use the connection on
which they are sent if they need the CodeBase, and that the
UnknownExceptionInfo service context must be unmarshaled after the
SendingContextRunTime service context. Specifically, add this
language to the Java to IDL spec in section 1.4.8.1.
Note: We may need to be careful not to generalize to all service
contexts. For instance, code sets for wstring/wchar inside of service
context encapsulations should probably be explicitly stated when
defining the service context at the spec level.
2. New service context & backwards compatibility proposal:
Add a new UnknownExceptionInfo service context called something like
UnknownExceptionInfoPlusCodeBase service context. It contains the
CodeBase IOR followed by the java.lang.Throwable. Thus, all necessary
information is contained, and we can support evolution going forward
in this particular service context. Older receivers would just
disregard it.
For backwards compatibility with J2SE 1.3 and before, we must still
also send the original UnknownExceptionInfo service context containing
something that looks like the J2SE 1.3 java.lang.Throwable class.
Thus, we must define the format of this new structure and how to
translate from J2SE 1.4 or later Throwables to it.