Exceptions (C++ server and Java-Client)

Nalin Stefano 308885/IF tikki@dei.unipd.it
Fri, 10 Oct 1997 17:11:11 +0200 (MET DST)


Hi all,

I have the following interface:

interface SQLBroker {
  
  exception BadConnection { }

  void      openConnection(in string dbName) raises(BadConnection);
  ...// other methods
};

The implementation looks like this:

void PgrBroker::openConnection(const char * dbName) {
... // some code

if (PQstatus(connection) == CONNECTION_BAD) {
    PQfinish(connection);
    throw BadConnection();
  }
}

The client is a Java applet, with VisiBroker from Visigenic as the ORB.

This is the piece of code with the incriminated call:

try {
  sqlBroker.openConnection("wrong data");
} catch(SQLBrokerPackage.BadConnection ex) {
  System.out.println("Connection failed");
}

but I never get to the line with the println method. I've looked into the
file _st_SQLBroker.java generated by the idl2java compiler:

if(_exception_id.value != null) {
  if(_exception_id.value.equals
            (SQLBrokerPackage.BadConnectionHelper.id()))
  {
    throw SQLBrokerPackage.BadConnectionHelper.read(_input);
  }
  throw new org.omg.CORBA.MARSHAL
            ("Unexpected User Exception: " + _exception_id.value);
}

where both _exception_id.value and
SQLBrokerPackage.BadConnectionHelper.id() equal
"IDL:SQLBroker/BadConnection:1.0" !!!

Does anyone have any idea?

Best regards,
Stefano