The implementation how portable interceptors are used for local objects has changed in JacORB 3, as stated in the release notes: "Implemented portable interceptors correctly for local objects." It seems that this new implementation causes some issues; the easiest way to reproduce the problem is to modify the GssUpServer.java from the sas-demo (the one that comes with the jacorb):
public class GssUpServer extends SASDemoPOA {
private ORB orb;
private boolean calledPrintSAS = false; // added
public GssUpServer(ORB orb) {
this.orb = orb;
}
public void printSAS() {
try {
org.omg.PortableInterceptor.Current current = (org.omg.PortableInterceptor.Current) orb
.resolve_initial_references("PICurrent");
org.omg.CORBA.Any anyName = current
.get_slot(org.jacorb.security.sas.SASInitializer.sasPrincipalNamePIC);
if (anyName.type().kind().value() == org.omg.CORBA.TCKind._tk_null) {
System.out.println("Null Name");
} else {
String name = anyName.extract_string();
System.out.println("printSAS for user " + name);
}
// /* added
if (!calledPrintSAS) {
calledPrintSAS = true;
// local call, (JacORB 3.x: throws NPE from SASClientInterceptor)
_this().printSAS();
}
// */
} catch (Exception e) {
e.printStackTrace();
}
}
...
}
Stacktrace after the GssUpClient.bat:
2013-04-11 11:01:24.968 SEVERE unexpected exception during servant_preinvoke org.jacorb.security.sas.SASClientInterceptor.send_request(SASClientInterceptor.java:194)
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.invoke(ClientInterceptorIterator.java:129)
org.jacorb.orb.portableInterceptor.AbstractInterceptorIterator.iterate(AbstractInterceptorIterator.java:66)
org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.iterate(ClientInterceptorIterator.java:87)
org.jacorb.orb.DefaultClientInterceptorHandler.invokeInterceptors(DefaultClientInterceptorHandler.java:328)
org.jacorb.orb.DefaultClientInterceptorHandler.handle_send_request(DefaultClientInterceptorHandler.java:132)
org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2505)
org.omg.CORBA.portable.ObjectImpl._servant_preinvoke(ObjectImpl.java:135)
org.jacorb.demo.sas._SASDemoStub.printSAS(_SASDemoStub.java:73)
org.jacorb.demo.sas.GssUpServer.printSAS(GssUpServer.java:46)
org.jacorb.demo.sas.SASDemoPOA._invoke(SASDemoPOA.java:47)
org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:348)
org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:670)
org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:820)
java.lang.NullPointerException
at org.jacorb.security.sas.SASClientInterceptor.send_request(SASClientInterceptor.java:194)
at org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.invoke(ClientInterceptorIterator.java:129)
at org.jacorb.orb.portableInterceptor.AbstractInterceptorIterator.iterate(AbstractInterceptorIterator.java:66)
at org.jacorb.orb.portableInterceptor.ClientInterceptorIterator.iterate(ClientInterceptorIterator.java:87)
at org.jacorb.orb.DefaultClientInterceptorHandler.invokeInterceptors(DefaultClientInterceptorHandler.java:328)
at org.jacorb.orb.DefaultClientInterceptorHandler.handle_send_request(DefaultClientInterceptorHandler.java:132)
at org.jacorb.orb.Delegate.servant_preinvoke(Delegate.java:2505)
at org.omg.CORBA.portable.ObjectImpl._servant_preinvoke(ObjectImpl.java:135)
at org.jacorb.demo.sas._SASDemoStub.printSAS(_SASDemoStub.java:73)
at org.jacorb.demo.sas.GssUpServer.printSAS(GssUpServer.java:46)
at org.jacorb.demo.sas.SASDemoPOA._invoke(SASDemoPOA.java:47)
at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:348)
at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:670)
at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:820)
Above code works perfectly well in JacORB 2.3.1. Simple workaround for this problem would be setting the property jacorb.isLocalHistoricalInterceptors
to true;
however, certain "built-in" methods (e.g. _is_a()
) do not respect this flag (since those methods check the object locality directly using is_really_local()
). It seems
that these "built-in" method calls have never before been using the interceptors when the call is made locally.
So my observations are:
_is_a()
, _non_existent()
, _interface()
, _get_component()
First issue is solvable, since there is a property that makes the JacORB 3.x work as the older versions. Second one (combined with the first one) seems really troublesome.
Has anyone else noticed this kind of behaviour, and can verify my suspect that this is indeed a defect in JacORB 3.x, or have I missed something?
Built in portable interceptors with local calls should work correctly; this sounds like a bug. In fact it sounds like Using AMI+BiDir with jacorb. I have also entered http://www.jacorb.org/bugzilla/show_bug.cgi?id=957