Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4655385

POA.id_to_servant() method doesn't work with USE_DEFAULT_SERVANT policy

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      Name: aaR10142 Date: 03/20/2002



      PortableServer.POA.id_to_servant() method spec says:
      "
      11.3.8.24 id_to_servant
      This operation requires the RETAIN policy or the USE_DEFAULT_SERVANT policy. If neither policy is present, the WrongPolicy exception is raised.

      If the POA has the RETAIN policy and the specified ObjectId is in the Active Object Map, this operation returns the servant associated with that object in the Active Object Map. Otherwise, if the POA has the USE_DEFAULT_SERVANT policy and a default servant has been registered with the POA, this operation returns the default servant. Otherwise the ObjectNotActive exception is raised.
      "

      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 registrate default servant
      POADefaultServant test = new POADefaultServant(testPOA);

      testPOA.set_servant(test);

      String _id = "IDL:Test/POATest:1.0";

      org.omg.CORBA.Object ref = testPOA.create_reference (_id);
      POATest href = POATestHelper.narrow(ref);
      System.out.println("reference is " + href.getKey());

      byte oid[] = testPOA.reference_to_id(ref);

      // call the id_to_servant
      Servant res = testPOA.id_to_servant(oid);;
      System.out.println("OKAY");

      } 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(){
      return "ok";
      }
      }

      ------------------ Test.idl--------------------------
      module Test {
          interface POATest {
              string getKey();
          };
      };
      ------------------- start --------------------
      #>idlj -fall POATest.idl
      #>javac -classpath . -d . ORBTest.java
      #>java -classpath . ORBTest
      ----------------- 1.4 output -----------------
      reference is ok
      ERROR : org.omg.PortableServer.POAPackage.ObjectNotActive: IDL:omg.org/PortableServer/POA/ObjectNotActive:1.0
      org.omg.PortableServer.POAPackage.ObjectNotActive: IDL:omg.org/PortableServer/POA/ObjectNotActive:1.0
              at com.sun.corba.se.internal.POA.POAImpl.objectNotActive(POAImpl.java:1245)
              at com.sun.corba.se.internal.POA.POAImpl.id_to_servant(POAImpl.java:1167)
              at ORBTest.main(ORBTest.java:39)

      ---------------------------------------------------------

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            hputtaswsunw Hemanth Puttaswamy (Inactive)
            Reporter:
            alisunw Ali Ali (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: