-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
generic
-
solaris_7
There seems to be a problem with the implementation
of except() method in our ORB implementation. It is failing in one of the
checks where it is checking that the marshalled typecode is exception, but it is receiving a struct, which is what the Helper class is putting into the any. It is this comparison failure which is raising the BAD_PARAM exception.
The except method calls set_exception, and it is not implemented in this class.
Simple Example ::
ServerSideProgram ::
import org.omg.CORBA.*;
import org.omg.CORBA.Any;
import DSI.*;
import org.omg.CosNaming.*;
class DsiServant extends DynamicImplementation{
static String[] myIds = {"IDL:DSI/DsiTest:1.0"};
org.omg.CORBA.ORB orb;
NVList nvlist = null;
public DsiServant(org.omg.CORBA.ORB or)throws Exception{
super();
orb = or;
}
public void invoke(ServerRequest request) {
nvlist = orb.create_list(0);
try {
if (request.op_name().equalsIgnoreCase("in_out_simple") == true)
in_out_simple(request);
} catch ( org.omg.CORBA.MARSHAL ex ) {
System.out.println(" Invoke:"+ ex.toString());
} catch ( Exception ex ) {
System.out.println("Invoke :" +ex.toString());
}
}
public String[] _ids() {
return myIds;
}
/* In method in_out_simple we are sending wrong no of
arguments (three insted of two) and expecting "MarshalException" */
private void in_out_simple(ServerRequest request) {
Any excep_any = orb.create_any();
DSI.dsi_exception dsi_ex =
new DSI.dsi_exception();
try {
//get arguements
Any any1 = orb.create_any();
any1.insert_string("");
nvlist.add_value("arg1", any1, ARG_IN.value);
// should be IN parm
Any any2 = orb.create_any();
any2.insert_short((short)0);
nvlist.add_value("arg2", any2, ARG_OUT.value);
Any any3 = orb.create_any();
any3.insert_string("");
nvlist.add_value("arg3", any3, ARG_INOUT.value);
request.params(nvlist);
//Extract third of three expected args from NameValue
nvlist.item(2).value().insert_string("Out");
}catch ( org.omg.CORBA.MARSHAL exc ) {
System.out.println("in_out_simple: expected exception " + exc.toString());
dsi_ex.reason = "PASS";
DSI.dsi_exceptionHelper.insert(excep_any, dsi_ex);
// Commented out, see bugId#4070453
request.except(excep_any);/*** it should not
throw exception but throwing "BADPARAM EXCEPTION"***/
}catch ( Exception ex ) {
System.out.println(" From inout method in ser:" +ex.toString());
dsi_ex.reason = "FAIL";
DSI.dsi_exceptionHelper.insert(excep_any, dsi_ex);
request.except(excep_any);
throw new org.omg.CORBA.UNKNOWN();
}
}// in-out
}//dsiservant
Client program::
import org.omg.CosNaming.*;
import DSI.*;
import org.omg.CORBA.*;
public class DsiCli
{
static DsiTest dsiRef;
static void test_in_out_simple() {
try {
String arg1 = "DsiTest";
ShortHolder arg2 = new ShortHolder((short)0);
dsiRef.in_out_simple(arg1,arg2);
} catch (org.omg.CORBA.MARSHAL exc) {
System.out.println("DSIClient: in_out_simple: PASS");
} catch (dsi_exception exc) {
System.out.println("DSIClient: in_out_simple: got server execption "+exc.toString());
} catch (Exception ex) {
System.out.println("DSIClient: in_out_simple: got unexpected execption "+ex.toString());
}
}// test_..
public static void main(String args[])
{
System.out.println("ENTERING CLIENT:");
try{
// create and initialize the ORB
ORB orb = ORB.init(args, null);
// get the root naming context
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
// resolve the Object Reference in Naming
NameComponent nc = new NameComponent("Dsitest", "");
NameComponent path[] = {nc};
org.omg.CORBA.Object obj = DsiTestHelper.narrow(ncRef.resolve(path));
dsiRef = DsiTestHelper.narrow(obj);
test_in_out_simple();
} catch (Exception e) {
System.out.println("ERROR : " + e) ;
e.printStackTrace(System.out);
}
System.out.println("EXITING CLIENT:");
}//main
}// dsicli
Dsi Test cases are failing on both JDK and J2EE build due this implementation error.
of except() method in our ORB implementation. It is failing in one of the
checks where it is checking that the marshalled typecode is exception, but it is receiving a struct, which is what the Helper class is putting into the any. It is this comparison failure which is raising the BAD_PARAM exception.
The except method calls set_exception, and it is not implemented in this class.
Simple Example ::
ServerSideProgram ::
import org.omg.CORBA.*;
import org.omg.CORBA.Any;
import DSI.*;
import org.omg.CosNaming.*;
class DsiServant extends DynamicImplementation{
static String[] myIds = {"IDL:DSI/DsiTest:1.0"};
org.omg.CORBA.ORB orb;
NVList nvlist = null;
public DsiServant(org.omg.CORBA.ORB or)throws Exception{
super();
orb = or;
}
public void invoke(ServerRequest request) {
nvlist = orb.create_list(0);
try {
if (request.op_name().equalsIgnoreCase("in_out_simple") == true)
in_out_simple(request);
} catch ( org.omg.CORBA.MARSHAL ex ) {
System.out.println(" Invoke:"+ ex.toString());
} catch ( Exception ex ) {
System.out.println("Invoke :" +ex.toString());
}
}
public String[] _ids() {
return myIds;
}
/* In method in_out_simple we are sending wrong no of
arguments (three insted of two) and expecting "MarshalException" */
private void in_out_simple(ServerRequest request) {
Any excep_any = orb.create_any();
DSI.dsi_exception dsi_ex =
new DSI.dsi_exception();
try {
//get arguements
Any any1 = orb.create_any();
any1.insert_string("");
nvlist.add_value("arg1", any1, ARG_IN.value);
// should be IN parm
Any any2 = orb.create_any();
any2.insert_short((short)0);
nvlist.add_value("arg2", any2, ARG_OUT.value);
Any any3 = orb.create_any();
any3.insert_string("");
nvlist.add_value("arg3", any3, ARG_INOUT.value);
request.params(nvlist);
//Extract third of three expected args from NameValue
nvlist.item(2).value().insert_string("Out");
}catch ( org.omg.CORBA.MARSHAL exc ) {
System.out.println("in_out_simple: expected exception " + exc.toString());
dsi_ex.reason = "PASS";
DSI.dsi_exceptionHelper.insert(excep_any, dsi_ex);
// Commented out, see bugId#4070453
request.except(excep_any);/*** it should not
throw exception but throwing "BADPARAM EXCEPTION"***/
}catch ( Exception ex ) {
System.out.println(" From inout method in ser:" +ex.toString());
dsi_ex.reason = "FAIL";
DSI.dsi_exceptionHelper.insert(excep_any, dsi_ex);
request.except(excep_any);
throw new org.omg.CORBA.UNKNOWN();
}
}// in-out
}//dsiservant
Client program::
import org.omg.CosNaming.*;
import DSI.*;
import org.omg.CORBA.*;
public class DsiCli
{
static DsiTest dsiRef;
static void test_in_out_simple() {
try {
String arg1 = "DsiTest";
ShortHolder arg2 = new ShortHolder((short)0);
dsiRef.in_out_simple(arg1,arg2);
} catch (org.omg.CORBA.MARSHAL exc) {
System.out.println("DSIClient: in_out_simple: PASS");
} catch (dsi_exception exc) {
System.out.println("DSIClient: in_out_simple: got server execption "+exc.toString());
} catch (Exception ex) {
System.out.println("DSIClient: in_out_simple: got unexpected execption "+ex.toString());
}
}// test_..
public static void main(String args[])
{
System.out.println("ENTERING CLIENT:");
try{
// create and initialize the ORB
ORB orb = ORB.init(args, null);
// get the root naming context
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
// resolve the Object Reference in Naming
NameComponent nc = new NameComponent("Dsitest", "");
NameComponent path[] = {nc};
org.omg.CORBA.Object obj = DsiTestHelper.narrow(ncRef.resolve(path));
dsiRef = DsiTestHelper.narrow(obj);
test_in_out_simple();
} catch (Exception e) {
System.out.println("ERROR : " + e) ;
e.printStackTrace(System.out);
}
System.out.println("EXITING CLIENT:");
}//main
}// dsicli
Dsi Test cases are failing on both JDK and J2EE build due this implementation error.
- duplicates
-
JDK-4294494 DSI does not work with user exceptions.
-
- Resolved
-