-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
None
-
beta
-
x86
-
windows_nt
-
Verified
Name: rrC76497 Date: 03/30/99
Test Environment: JDK1.1.6, Win NT 4.0, Solaris (With
RIP Binaries)
Test scenario:
1) POA is created with RequestProcessingPolicy : USE_SERVANT_MANAGER
2) Servant manager is registered with the POA using set_servant_manager
with ServantLocator Implementation.
3) get_servant_manager is called on POA
Expected Result:
Should return the registered servant manager(servantlocator
implementation)
Obtained:
throws BAD_OPERATION exception(The delegate has not been set).
How to reproduce the bug.
-------------------------
---------------------------------------------------------------------------
// poaidl.idl
module poaidl {
interface PoaTest {
};
};
---------------------------------------------------------------------------
// PoaTestImpl.java
import poaidl._PoaTestImplBase;
public class PoaTestImpl extends _PoaTestImplBase
implements org.omg.PortableServer.Servant {
}
---------------------------------------------------------------------------
// GetServantManagerTest.java
import org.omg.CORBA.ORB;
import org.omg.PortableServer.POA;
import org.omg.CORBA.Policy;
import org.omg.PortableServer.ServantManager;
import org.omg.PortableServer.RequestProcessingPolicyValue;
import org.omg.PortableServer.Servant;
import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
/*
* Purpose : To reproduce the following Bug
*
* Bug : The get_servant_manager throws a BAD_OPERATION exception
* (The delegate has not been set) when poa is created with
* USE_SERVANT_MANAGER policy and there is a ServantManager
* (ServantLocatorImpl) registered with it.
*/
public class GetServantManagerTest {
public static void main(String args[]) {
java.util.Properties p = new java.util.Properties();
p.put("org.omg.CORBA.ORBClass","com.sun.PortableServer.POAORB");
boolean errFlag = true;
ServantManager servManager=null;
TestImplLocator locator=null;
try{
// initialising the orb of this instance
ORB orb = ORB.init(args,p);
// getting reference to the default rootPOA
POA rootPOA = (POA)orb.resolve_initial_references("RootPOA");
//activate the POAManager
rootPOA.the_POAManager().activate();
// create policy list
Policy[] policy=new Policy[1];
policy[0]=rootPOA.create_request_processing_policy(
RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
System.out.println("Creating a POA with USE_SERVANT_MANAGER policy");
POA poa=rootPOA.create_POA("poa1",null,policy);
System.out.println("Registering the servant locator with the POA");
locator=new TestImplLocator();
poa.set_servant_manager(locator);
poa.the_POAManager().activate();
System.out.println("Getting the servant manager registered with
POA");
servManager=poa.get_servant_manager();
}
catch(Exception ex){
System.out.println("Unexpected Exception"+ex.toString());
}
finally {
if (servManager!=null && servManager.equals(locator) ){
System.out.println("Successful in getting the Servant Manager");
}
else {
System.out.println("Failed to return the servant manager"+
"for a poa created with USE_SERVANT_MANAGER policy "+
"and servantlocator is also registered");
}
} // finally
} // main()
} //GetServantManagerTest
class TestImplLocator extends
org.omg.PortableServer._ServantLocatorImplBase {
public Servant preinvoke(byte[] oid,POA adapter,String
operation,CookieHolder the_cookie)
throws org.omg.PortableServer.ForwardRequest {
Servant servant=null;
try {
servant=new PoaTestImpl();
}
catch(Exception ex) {
System.out.println(ex.toString() + "Unexpected Exception ");
}
return servant;
} // preinvoke()
public void postinvoke(byte[] oid,POA adapter, String operation,
java.lang.Object cookie, Servant servant){
return;
} // postinvoke()
} // class TestImplLocator
---------------------------------------------------------------------------
//Makefile
RMI_IIOP_HOME=c:\rmi-iiop-beta
IDLTOJAVA=c:\javaidlx-2.1\bin\win32\idltojava
JAVAHOME=c:\jdk1.1.6
JAVAC=$(JAVAHOME)\bin\javac
JAVA=$(JAVAHOME)\bin\java
CLASSPATH =
.;$(JAVAHOME)\lib\classes.zip;$(RMI_IIOP_HOME)\lib\rmiorb.jar;$(RMI_IIOP_HOME)\lib\iioprt.jar
all: idl test
test: GetServantManagerTest.java
$(JAVAC) -classpath $(CLASSPATH) GetServantManagerTest.java
idl: poaidl.idl
$(IDLTOJAVA) -fno-cpp -j . poaidl.idl
run: GetServantManagerTest.class
$(JAVA) -classpath $(CLASSPATH) GetServantManagerTest -ORBInitialHost
localhost -ORBInitialPort 900
clean:
del *.class
del poaidl\*.*
---------------------------------------------------------------------------
======================================================================