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

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
         LifespanPolicy : PERSISTENT
         LifespanPolicy : TRANSIENT

        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_lifespan_policy(LifespanPolicyValue.PERSISTENT);
         policylist[1]= rootPoa.
        create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
         testOut.println("Creating poa with PERSISTENT and TRANSIENT policy");
         tstcnt.incr_count();
         POA poa1 = rootPoa.create_POA("policytest3",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.

        CreatePoa003.java
        -------------------

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

        /*
        * : CreatePoa Method fails to throw InvalidPolicy Exception when
        * it is invoked with a Policy List which consists of
        * LifespanPolicyValue.PERSISTENT and
        * LifespanPolicyValue.TRANSIENT
        */

        public class CreatePoa003 {

        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_lifespan_policy(LifespanPolicyValue.PERSISTENT);
            policylist[1]=
        rootPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);

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

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

         clean:
          del CreatePoa003.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: