-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_2.6
Name: aaR10142 Date: 03/20/2002
PortableServer.POA.servant_to_id() method spec says:
"
11.3.8.20 servant_to_id
...
3. If the POA has the USE_DEFAULT_SERVANT policy, the servant specified is the default servant, and the operation is being invoked in the context of executing a request on the default servant, then the ObjectId associated with the current invocation is returned.
"
But the method throws ServantNotActive exception with USE_DEFAULT_SERVANT
policy.
See example
------------- ORBTest.java ---------------------
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
import Test.*;
public class ORBTest {
public static void main(String argv[]) {
try {
ORB orb = ORB.init(argv, null);
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
Policy[] policies = {
rootPOA.create_request_processing_policy(
RequestProcessingPolicyValue.USE_DEFAULT_SERVANT),
};
POA testPOA = rootPOA.create_POA("TestPOA",
rootPOA.the_POAManager(), policies);
rootPOA.the_POAManager().activate();
// create and set default servant
POADefaultServant test = new POADefaultServant(testPOA);
testPOA.set_servant(test);
org.omg.CORBA.Object ref2 = test._this();
POATest href = POATestHelper.narrow(ref2);
// call the servant test method
// getKey () will try call servant_to_id() method
System.out.println(href.getKey());
} catch(Exception e) {
System.out.println("ERROR : " + e);
e.printStackTrace(System.out);
}
}
}
class POADefaultServant extends POATestPOA {
POA testPOA = null;
public POADefaultServant (POA poa) {
testPOA = poa;
}
synchronized public String getKey(){
try {
return "passed: " + testPOA.servant_to_id(this).toString();
} catch (Exception e) {
return "failed: " + e;
}
}
}
------------------ Test.idl--------------------------
module Test {
interface POATest {
string getKey();
};
};
------------------- start --------------------
#>idlj -fall POATest.idl
#>javac -classpath . -d . ORBTest.java
#>java -classpath . ORBTest
----------------- 1.4 output -----------------
failed: org.omg.PortableServer.POAPackage.ServantNotActive: IDL:omg.org/PortableServer/POA/ServantNotActive:1.0
---------------------------------------------------------
======================================================================