-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
only
-
generic, x86
-
solaris_7, windows_nt
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2030430 | 1.4.0 | Stefan Bauer | P4 | Resolved | Fixed | beta |
In the process of and reply service context interception hooks to the ORB
I discovered that DSI does not work with user exceptions.
Given the following IDL:
module ExM
{
exception ExampleException { string reason; };
interface ExI
{
void throwUserException() raises (ExampleException);
};
};
and the following DIR implementation:
} else if (r.op_name().equals("throwUserException") == true) {
org.omg.CORBA.NVList _list = orb.create_list(0);
r.params(_list);
Any any = orb.create_any();
ExampleException ex =
new ExampleException("from a dynamic servant");
ExampleExceptionHelper.insert(any, ex);
r.except(any);
return;
}
I get the following error on the server:
org.omg.CORBA.BAD_PARAM: minor code: 0 completed: No
at com.sun.corba.se.internal.corba.ServerRequestImpl.except(ServerRequestImpl.java:136)
at ExM.DynInvokeHelper.invoke(DynInvokeHelper.java:66)
at ExM.DynamicServant.invoke(DynamicServant.java:24)
at com.sun.corba.se.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:354)
at com.sun.corba.se.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:136)
at com.sun.corba.se.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:97)
at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:227)
at com.sun.corba.se.internal.iiop.CachedWorkerThread.doWork(IIOPConnection.java:262)
at com.sun.corba.se.internal.iiop.CachedWorkerThread.run(IIOPConnection.java:230)
Looking at ServerRequestImpl I see the code raising this exception:
public void except(Any exc)
{
// except can be called by the DIR at any time (CORBA 2.2 section 6.3).
if ( exc == null )
throw new BAD_PARAM();
// Ensure that the Any contains a SystemException or a
// UserException. If the UserException is not a declared exception,
// the client will get an UNKNOWN exception.
TCKind kind = exc.type().kind();
if ( kind != TCKind.tk_except )
throw new BAD_PARAM();
The comments seem to indicate that it is prepared to handle
a declared user exception. When I look at the values that are being
compared I see:
In the DIR:
ExampleExceptionHelper.type().kind(): org.omg.CORBA.TCKind@1b0c63ed
any.type().kind(): org.omg.CORBA.TCKind@1b0c63ed
In ServerRequestImpl:
TCKind.tk_except: org.omg.CORBA.TCKind@1b7863ed
They are not "=". It seems the equality test is wrong.
I am looking into this further before opening a bug. However,
if anyone has an immediate insight, please let me know to save
me time.
Thanks,
Harold
------
>This test for equality looks weak. It would be safer to compare the
>value of the TCKinds.
>
> int kind = exc.type().kind().value();
> if ( kind != TCKind._tk_except )
> throw new BAD_PARAM();
I assume you mean:
if ( kind != TCKind._tk_except.value() )
>Are they the same in this case?
The value of the user defined exception is:
ExampleExceptionHelper.type().kind().value(): 15
The value of the built-in is:
TCKind.tk_except.value(): 22
>There is no guarantee in our system that TCKinds are uniqued even though
>the proper way of getting a TCKind is to invoke the static method
>TCKind.from_int(int), not the protected constructor.
>
>If your server has two TCKinds with the same value() then we got a
>problem.
I am not sure if there are identical values, but I also do not think
that is what is going on here.
>How did they get created?
I ask for the type via the helper:
ExampleExceptionHelper.type().kind().value()
which is generated code:
private static org.omg.CORBA.TypeCode __typeCode = null;
private static boolean __active = false;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
synchronized (org.omg.CORBA.TypeCode.class)
{
if (__typeCode == null)
{
if (__active)
{
return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
}
__active = true;
org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1];
org.omg.CORBA.TypeCode _tcOf_members0 = null;
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[0] = new org.omg.CORBA.StructMember (
"reason",
_tcOf_members0,
null);
__typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (ExM.ExampleExceptionHelper.id (), "ExampleException", _members0);
__active = false;
}
}
}
return __typeCode;
}
>Is the TCKind object marshalled from the client?
No.
From the client I call ref.throwUserException();
The DSI servant creates an ExampleException with it puts
in an any (using the helper) then calls r.except(any) to
set the exception. But the type test seems to be incorrect so
it breaks.
=================================================================
This seems to be a problem with user exception code generation when using DSI based model. In the attachment, if you perform:
make run
It would throw a BAD_PARAM exception. However if examples/dsi_exceptionHelper.java is changed on line 59 from create_struct_tc to create_exception_tc, then the test passes fine.
arun.gupta@Eng 2000-08-04
========================================================================
I discovered that DSI does not work with user exceptions.
Given the following IDL:
module ExM
{
exception ExampleException { string reason; };
interface ExI
{
void throwUserException() raises (ExampleException);
};
};
and the following DIR implementation:
} else if (r.op_name().equals("throwUserException") == true) {
org.omg.CORBA.NVList _list = orb.create_list(0);
r.params(_list);
Any any = orb.create_any();
ExampleException ex =
new ExampleException("from a dynamic servant");
ExampleExceptionHelper.insert(any, ex);
r.except(any);
return;
}
I get the following error on the server:
org.omg.CORBA.BAD_PARAM: minor code: 0 completed: No
at com.sun.corba.se.internal.corba.ServerRequestImpl.except(ServerRequestImpl.java:136)
at ExM.DynInvokeHelper.invoke(DynInvokeHelper.java:66)
at ExM.DynamicServant.invoke(DynamicServant.java:24)
at com.sun.corba.se.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:354)
at com.sun.corba.se.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:136)
at com.sun.corba.se.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:97)
at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:227)
at com.sun.corba.se.internal.iiop.CachedWorkerThread.doWork(IIOPConnection.java:262)
at com.sun.corba.se.internal.iiop.CachedWorkerThread.run(IIOPConnection.java:230)
Looking at ServerRequestImpl I see the code raising this exception:
public void except(Any exc)
{
// except can be called by the DIR at any time (CORBA 2.2 section 6.3).
if ( exc == null )
throw new BAD_PARAM();
// Ensure that the Any contains a SystemException or a
// UserException. If the UserException is not a declared exception,
// the client will get an UNKNOWN exception.
TCKind kind = exc.type().kind();
if ( kind != TCKind.tk_except )
throw new BAD_PARAM();
The comments seem to indicate that it is prepared to handle
a declared user exception. When I look at the values that are being
compared I see:
In the DIR:
ExampleExceptionHelper.type().kind(): org.omg.CORBA.TCKind@1b0c63ed
any.type().kind(): org.omg.CORBA.TCKind@1b0c63ed
In ServerRequestImpl:
TCKind.tk_except: org.omg.CORBA.TCKind@1b7863ed
They are not "=". It seems the equality test is wrong.
I am looking into this further before opening a bug. However,
if anyone has an immediate insight, please let me know to save
me time.
Thanks,
Harold
------
>This test for equality looks weak. It would be safer to compare the
>value of the TCKinds.
>
> int kind = exc.type().kind().value();
> if ( kind != TCKind._tk_except )
> throw new BAD_PARAM();
I assume you mean:
if ( kind != TCKind._tk_except.value() )
>Are they the same in this case?
The value of the user defined exception is:
ExampleExceptionHelper.type().kind().value(): 15
The value of the built-in is:
TCKind.tk_except.value(): 22
>There is no guarantee in our system that TCKinds are uniqued even though
>the proper way of getting a TCKind is to invoke the static method
>TCKind.from_int(int), not the protected constructor.
>
>If your server has two TCKinds with the same value() then we got a
>problem.
I am not sure if there are identical values, but I also do not think
that is what is going on here.
>How did they get created?
I ask for the type via the helper:
ExampleExceptionHelper.type().kind().value()
which is generated code:
private static org.omg.CORBA.TypeCode __typeCode = null;
private static boolean __active = false;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
synchronized (org.omg.CORBA.TypeCode.class)
{
if (__typeCode == null)
{
if (__active)
{
return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
}
__active = true;
org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1];
org.omg.CORBA.TypeCode _tcOf_members0 = null;
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[0] = new org.omg.CORBA.StructMember (
"reason",
_tcOf_members0,
null);
__typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (ExM.ExampleExceptionHelper.id (), "ExampleException", _members0);
__active = false;
}
}
}
return __typeCode;
}
>Is the TCKind object marshalled from the client?
No.
From the client I call ref.throwUserException();
The DSI servant creates an ExampleException with it puts
in an any (using the helper) then calls r.except(any) to
set the exception. But the type test seems to be incorrect so
it breaks.
=================================================================
This seems to be a problem with user exception code generation when using DSI based model. In the attachment, if you perform:
make run
It would throw a BAD_PARAM exception. However if examples/dsi_exceptionHelper.java is changed on line 59 from create_struct_tc to create_exception_tc, then the test passes fine.
arun.gupta@Eng 2000-08-04
========================================================================
- backported by
-
JDK-2030430 DSI does not work with user exceptions.
-
- Resolved
-
- duplicates
-
JDK-4324471 org.omg.CORBA.ServerRequest.except(excep_any) implementation problem
-
- Closed
-