Ricardo Cosme
2010-06-14 22:46:55 UTC
Hi,
When I invoke a method that gives me an IDL:omg.org/CORBA/COMM_FAILURE:1.0,
my receive_exception() implementation receives a ri->reply_status() with
an USER_EXCEPTION value, but COMM_FAILURE is a SYSTEM_EXCEPTION.
I noticed that receive_exception_ip(), in pi_impl.cc:2245, doesn't use
reply_status
argument. It defines the _reply_status in line 2254 with an USER_EXCEPTION:
//pi_impl.cc
2254: cri->reply_status(PortableInterceptor::USER_EXCEPTION);
Shouldn't this line be:
cri->reply_status(reply_status);
I'm using Mico 2.3.13.
My demo:
#include <CORBA.h>
using namespace std;
using namespace PortableInterceptor;
class ClientInterceptor : public ClientRequestInterceptor {
private:
IOP::Codec_ptr cdr_codec;
public:
ClientInterceptor(IOP::Codec_ptr pcdr_codec) {}
~ClientInterceptor() {}
void send_request(ClientRequestInfo_ptr ri)
throw(
CORBA::SystemException,
PortableInterceptor::ForwardRequest) {}
void send_poll(ClientRequestInfo_ptr ri)
throw(CORBA::SystemException) {}
void receive_reply(ClientRequestInfo_ptr ri)
throw(CORBA::SystemException) {}
void receive_exception(ClientRequestInfo_ptr ri)
throw(
CORBA::SystemException,
PortableInterceptor::ForwardRequest)
{
cout << "Reply Status: " << ri->reply_status() << endl;
}
void receive_other(ClientRequestInfo_ptr ri)
throw(
CORBA::SystemException,
PortableInterceptor::ForwardRequest) {}
char* name()
throw(CORBA::SystemException)
{
return CORBA::string_dup("MyInterceptor");
}
void destroy() {}
};
class ORBInitializerImpl : public ORBInitializer {
IOP::Codec_var codec;
ClientInterceptor* clientInterceptor;
public:
ORBInitializerImpl() {}
~ORBInitializerImpl() {}
void pre_init(ORBInitInfo_ptr info) {
IOP::CodecFactory_var codec_factory = info->codec_factory();
IOP::Encoding cdr_encoding = {IOP::ENCODING_CDR_ENCAPS, 1, 2};
codec = codec_factory->create_codec(cdr_encoding);
clientInterceptor = new ClientInterceptor(codec);
info->add_client_request_interceptor(clientInterceptor);
}
void post_init(ORBInitInfo_ptr info) {}
};
int main(int argc, char** argv) {
ORBInitializerImpl* ini = new ORBInitializerImpl();
PortableInterceptor::register_orb_initializer(ini);
CORBA::ORB* orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_obj);
PortableServer::POAManager_var poa_manager = poa->the_POAManager();
poa_manager->activate();
CORBA::Object_var obj = orb->string_to_object("corbaloc::localhost:9999");
CORBA::Request_var req;
req = obj->_request("foo");
req->invoke();
return 0;
};
Thanks,
Ricardo Cosme
When I invoke a method that gives me an IDL:omg.org/CORBA/COMM_FAILURE:1.0,
my receive_exception() implementation receives a ri->reply_status() with
an USER_EXCEPTION value, but COMM_FAILURE is a SYSTEM_EXCEPTION.
I noticed that receive_exception_ip(), in pi_impl.cc:2245, doesn't use
reply_status
argument. It defines the _reply_status in line 2254 with an USER_EXCEPTION:
//pi_impl.cc
2254: cri->reply_status(PortableInterceptor::USER_EXCEPTION);
Shouldn't this line be:
cri->reply_status(reply_status);
I'm using Mico 2.3.13.
My demo:
#include <CORBA.h>
using namespace std;
using namespace PortableInterceptor;
class ClientInterceptor : public ClientRequestInterceptor {
private:
IOP::Codec_ptr cdr_codec;
public:
ClientInterceptor(IOP::Codec_ptr pcdr_codec) {}
~ClientInterceptor() {}
void send_request(ClientRequestInfo_ptr ri)
throw(
CORBA::SystemException,
PortableInterceptor::ForwardRequest) {}
void send_poll(ClientRequestInfo_ptr ri)
throw(CORBA::SystemException) {}
void receive_reply(ClientRequestInfo_ptr ri)
throw(CORBA::SystemException) {}
void receive_exception(ClientRequestInfo_ptr ri)
throw(
CORBA::SystemException,
PortableInterceptor::ForwardRequest)
{
cout << "Reply Status: " << ri->reply_status() << endl;
}
void receive_other(ClientRequestInfo_ptr ri)
throw(
CORBA::SystemException,
PortableInterceptor::ForwardRequest) {}
char* name()
throw(CORBA::SystemException)
{
return CORBA::string_dup("MyInterceptor");
}
void destroy() {}
};
class ORBInitializerImpl : public ORBInitializer {
IOP::Codec_var codec;
ClientInterceptor* clientInterceptor;
public:
ORBInitializerImpl() {}
~ORBInitializerImpl() {}
void pre_init(ORBInitInfo_ptr info) {
IOP::CodecFactory_var codec_factory = info->codec_factory();
IOP::Encoding cdr_encoding = {IOP::ENCODING_CDR_ENCAPS, 1, 2};
codec = codec_factory->create_codec(cdr_encoding);
clientInterceptor = new ClientInterceptor(codec);
info->add_client_request_interceptor(clientInterceptor);
}
void post_init(ORBInitInfo_ptr info) {}
};
int main(int argc, char** argv) {
ORBInitializerImpl* ini = new ORBInitializerImpl();
PortableInterceptor::register_orb_initializer(ini);
CORBA::ORB* orb = CORBA::ORB_init(argc, argv);
CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_obj);
PortableServer::POAManager_var poa_manager = poa->the_POAManager();
poa_manager->activate();
CORBA::Object_var obj = orb->string_to_object("corbaloc::localhost:9999");
CORBA::Request_var req;
req = obj->_request("foo");
req->invoke();
return 0;
};
Thanks,
Ricardo Cosme