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

create_POA fails to throw InvalidPolicy Exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.0
    • other-libs
    • sparc
    • solaris_2.4



      Name: tk6033 Date: 12/03/98


       POA is created with
       ServerRetentionPolicy : NON_RETAIN
       RequestProcessingPolicy : USE_ACTIVE_OBJECT_MAP_ONLY

       Expected Result:
       Should throw InvalidPolicy Exception

       Obtained:
       Fails to throw InvalidPolicy exception

      How to reproduce the bug.
      -------------------------
          //rootPoa - POA Object
       org.omg.CORBA.Policy policylist[] = new org.omg.CORBA.Policy[2];
       policylist[0]= rootPoa.create_servant_retention_policy(
           ServantRetentionPolicyValue.NON_RETAIN);
       policylist[1]= rootPoa.create_request_processing_policy(
           RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
       POA poa1 = rootPoa.create_POA("policytest1",null,policylist);


      This is a test.
      ======================================================================

      Name: tk6033 Date: 02/04/99



      Please ignore the previous code snippet, instead use the following which
      is the complete code to reproduce the problem.

      CreatePoa001.java
      -----------------

      import org.omg.CORBA.ORB;
      import org.omg.PortableServer.POA;
      import org.omg.CORBA.Policy;
      import org.omg.PortableServer.ServantRetentionPolicyValue;
      import org.omg.PortableServer.RequestProcessingPolicyValue;

      /*
      * CreatePoa Method fails to throw InvalidPolicy Exception when
      * it is invoked with a Policy List which consists of
      * ServantRetentionPolicyValue.NON_RETAIN and
      * RequestProcessingPolicy.USE_ACTIVE_OBJECT_MAP_ONLY
      */

      public class CreatePoa001 {

      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;
        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
         org.omg.CORBA.Policy policylist[] = new org.omg.CORBA.Policy[2];
          policylist[0]= rootPOA.create_servant_retention_policy(
             ServantRetentionPolicyValue.NON_RETAIN);
          policylist[1]= rootPOA.create_request_processing_policy(
             RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);

         // create a poa under root poa
         POA poa1 = rootPOA.create_POA("policytest1",null,policylist);
        }
        catch(org.omg.PortableServer.POAPackage.InvalidPolicy ex) {
         System.out.println("CreatePoa001 : Expected Invalid Policy Exception
      on Creating Poa with"+
          "NON_RETAIN and USE_ACTIVE_OBJECT_MAP_ONLY policies, thrown
      sucessfully" );
         errFlag = false;
        }
        catch(Exception e){
         System.out.println("Unexpected Exception " + e.toString());
        }
        finally {
         if (errFlag) {
          System.out.println("CreatePoa001 : CreatePoa Failed to throw
      InvalidPolicy Exception when \n" +
          "invoked with NON_RETAIN and USE_ACTIVE_OBJECT_MAP_ONLY policies");
         }
        }
       }
       }

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


      makefile
      --------


      IDLX_HOME=d:\javaidlx-2.1
      IDLTOJAVA=$(IDLX_HOME)\bin\win32\idltojava

      JAVAHOME=d:\jdk1.1.6
      JAVAC=$(JAVAHOME)\bin\javac
      JAVA=$(JAVAHOME)\bin\java
      CLASSPATH = .;$(JAVAHOME)\lib\classes.zip;$(IDLX_HOME)\lib\classes.zip;

      all: server

      server: CreatePoa001.java
       $(JAVAC) -classpath $(CLASSPATH) CreatePoa001.java

      runserver: CreatePoa001.class
       $(JAVA) -classpath $(CLASSPATH) CreatePoa001 -ORBInitialHost localhost
      -ORBInitialPort 900

      clean:
       del CreatePoa001.class

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

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

            mmortazasunw Masood Mortazavi (Inactive)
            tkincaidsunw Tom Kincaid (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: