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

create_POA fails to throw

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • j2ee1.1-fcs
    • 1.2.0
    • other-libs
    • None
    • fcs
    • x86
    • windows_nt
    • Not verified



        Name: rrC76497 Date: 12/18/98


        Test Environment: JDK1.1.6, Win NT 4.0

        Test scenario:
        POA is created with
         ServerRetentionPolicy : RETAIN
         ServerRetentionPolicy : NON_RETAIN

        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.RETAIN);

         policylist[1]= rootPoa.
        create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN);

         testOut.println("Creating poa with RETAIN and NON_RETAIN policy ");
         tstcnt.incr_count();
         POA poa1 = rootPoa.create_POA("policytest4",null,policylist);

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

        Name: rrC76497 Date: 02/04/99



        Please ignore the previous code snippet, instead use the following which

        is the complete code to reproduce the problem.

        CreatePoa004.java
        -----------------

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

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

        public class CreatePoa004 {

        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_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);


           // create a poa under root poa
           POA poa1 = rootPOA.create_POA("policytest1",null,policylist);
          }
          catch(org.omg.PortableServer.POAPackage.InvalidPolicy ex) {
           System.out.println("CreatePoa004 : Expected Invalid Policy Exception
        on Creating Poa with both"+
            "NON_RETAIN and RETAIN policies, thrown sucessfully" );
           errFlag = false;
          }
          catch(Exception e){
           System.out.println("Unexpected Exception " + e.toString());
          }
          finally {
           if (errFlag) {
            System.out.println("CreatePoa004 : CreatePoa Failed to throw
        InvalidPolicy Exception when \n" +
            "invoked with both NON_RETAIN and RETAIN 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: CreatePoa004.java
          $(JAVAC) -classpath $(CLASSPATH) CreatePoa004.java

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

         clean:
          del CreatePoa004.class

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

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

              mmortazasunw Masood Mortazavi (Inactive)
              rramsunw Ranganathan Ram (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: