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

Exception not throw when DataSet.remove(Object) is removing an not exist obj. from the list.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6
    • core-libs
    • None
    • generic
    • generic

      JDK : 1.6.0-b68
      DB : ORCL
      VM : default
      switch/Mode : default
      Platform[s] : Sol 9 and 10 sparc

      Test owner :
      Failing Test :
         java_sql_eod/dataset/DataSet005_009
         java_sql_eod/dataset/DataSet005_010

      TestBase Location:
      ==================

          /net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0

      Test source location:
      =====================
          /net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/src/java_sql_eod/dataset/DataSet005_009

      Share source location:
      ======================
         /net/cady/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/share
         /net/cady/export/sqa/tcheung/jdbc/SQE/6.0/share

      tlog file location:
      ==================
      /net/cady.sfbay/export/sqa/tcheung/jdbc/BUGS/[bug id]

      How to reproduce:
      ====================

         1. cd /net/cady.sfbay/export/sqa/tcheung/jdbc/BUGS/{this_bug_number}
         2. ksh DataSet005_009.tlog [your JDK]
          or

         1) Copy the setup and Run_Standalone.ksh from $TestBase/jdbc to your local dir.
             cp /net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/Run_Standalone.ksh .

         2) Craete a your testlist.
              echo "java_sql_eod/update/Update001_SQL_005 compile_and_execute" > mytestlist

         3) Overwrite the default environment variables.
             export PIT_HOME=/net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0
             export TESTLIST = `pwd`/mytestlist
             export JDK_PATH="your jdk"
           if needed.
             export VM_OPTS=""
             export DB_NAME=""
             export DB_DRIVER_NAME=""
             export DB_CONNECTION_NAME=""
             export DB_CONNECTION_STRING=""
             export DB_LOGIN_NAME=""
             export DB_LOGIN_PASSWORD=""

         4) Run_Standalone.ksh.

          Read $TestBase/jdbc/docs/Run_Standalone.README for more detail.

      --------Sample Test/Script START---------------------
      ******* Sample test will not run as standalone java program ******
      try {
                  rows = query.getPersonInfo();
              }catch (SQLRuntimeException ex) {
                  //free the resources
                  utils.closeConnection(con);
                  System.err.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught when executing @Select : "+ex.getMessage());
                  throw new TestFailureException
                          ("Un-Expected SQLRuntimeException when getting DataSet by executing @Select. [Message="+ex.getMessage()+"]", ex);
              }

              if (null == rows) {
                  //free the resources
                  utils.closeConnection(con);
                  System.out.println(this.getClass().getName()+".doTest() : DataSet returned by @Select is null. TEST FAILED");
                  throw new TestFailureException("DataSet returned by @Select is null. TEST FAILED");
              }
              
              int initial_row_size = rows.size();
              System.out.println(this.getClass().getName()+".doTest() : Initial DataSet.size="+initial_row_size);
                            
              //create a dummy PersonInfo obj which is not there in the DataSet
              PersonInfo info = new PersonInfo();
              info.setId(999);
              info.setFirstName("insertedFirstName");
              info.setLastName("insertedLastName");
              info.setAge(1000);
              
              System.out.println(this.getClass().getName()+".doTest() : Calling DataSet.remove(T) on connected DataSet w/ an invalid row as argument ");
              
              boolean row_deleted = false;
         
              try {
                  row_deleted = rows.remove(info);
                  
              }catch (SQLRuntimeException ex) {
                  System.err.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught when executing DataSet.remove(T) w/o positioning at any row in the DataSet. Expected behaviour. : "+ex.getMessage());
                  ex.printStackTrace();
                  System.out.println(this.getClass().getName()+".doTest() : TEST PASSED");
                  return;
              }
              catch (Exception ex) {
                  System.err.println(this.getClass().getName()+".doTest() : Exception caught when executing DataSet.remove(T) w/o positioning at any row in the DataSet. Expected behaviour. : "+ex.getMessage());
                  ex.printStackTrace();
                  System.out.println(this.getClass().getName()+".doTest() : TEST PASSED");
                  return;
              }



      --------Sample Test/Script END----------------------

      Test output:
      =============

      JDBCUtils.executeStmt : SQLException when executing statement. sql=delete from dataset005
       Calling doSetup()....
       Returned from doSetup()....
       Calling doTest()....
      DataSet005_009.doTest() : getting Connection object....
      DataSet005_009.doTest() : getting QueryObject handle(JDBC 3.0)....
      DataSet005_009.doTest() : got QueryObject handle(JDBC 3.0)
      DataSet005_009.doTest() : Executing @Select ....
      DataSet005_009.doTest() : Initial DataSet.size=3
      DataSet005_009.doTest() : Calling DataSet.remove(T) on connected DataSet w/ an invalid row as argument
      DataSet005_009.doTest() : TEST FAILED
      TEST FAILED : DataSet005_009.doTest() :No SQLException thrown when calling DataSet.remove(T) w/o positioning at any row in the DataSet
      com.sun.j2se_sqe.jdbc.utils.TestFailureException: No SQLException thrown when calling DataSet.remove(T) w/o positioning at any row in the DataSet
              at DataSet005_009.doTest(DataSet005_009.java:119)
              at DataSet005_009.main(DataSet005_009.java:177)


      Specific Machine Info:
      =====================
      For Solaris[sparc/x86] ->

      SunOS orthello 5.10 Generic sun4u sparc SUNW,Ultra-60

            ssharmasunw Sushmita Sharma (Inactive)
            tacheung Tak Wing Cheung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: