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

create_POA fails to throw

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • j2ee1.0_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
       IdUniquenessPolicy : UNIQUE_ID
       IdUniquenessPolicy : MULTIPLE_ID

      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_id_uniqueness_policy(IdUniquenessPolicyValue.UNIQUE_ID);
       policylist[1]= rootPoa.
      create_id_uniqueness_policy(IdUniquenessPolicyValue.MULTIPLE_ID);
       testOut.println("Creating poa with UNIQUE_ID and MULTIPLE_ID Policy");
       tstcnt.incr_count();
       POA poa1 = rootPoa.create_POA("policytest5",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.

      CreatePoa005.java
      -----------------

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

      /*
      * Purpose : To reproduce the following Bug
      *
      * Bug : CreatePoa Method fails to throw InvalidPolicy Exception when
      * it is invoked with a Policy List which consists of
      * IdUniquenessPolicyValue.UNIQUE_ID and
      * IdUniquenessPolicyValue.MULTIPLE_ID
      */

      public class CreatePoa005 {

      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_id_uniqueness_policy(IdUniquenessPolicyValue.UNIQUE_ID);
          policylist[1]=
      rootPOA.create_id_uniqueness_policy(IdUniquenessPolicyValue.MULTIPLE_ID);


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

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

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