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

Incorrect conflict count reported by CachedRowsetWriter.writeData()

    XMLWordPrintable

Details

    Description

      FULL PRODUCT VERSION :
      java version " 1.7.0_06 "
      Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
      Java HotSpot(TM) Client VM (build 23.2-b09, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      The issue is that when CachedRowSetImpl.acceptChanges() is called, incorrect number of conflicts, if any, is reported. The number of conflicts is the actual number of existing rows in database, which is the size of variable 'status' defined in CachedRowSetWriter.writeData(), . It's not the conflict number that is supposed to be.

      REGRESSION. Last worked in version 7

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Take PostgreSQL for example, (it can happen for any SQL database)

      Create a table with following cmd
      CREATE TABLE ressystem.roomdescription
      (
        roomdescription_id serial NOT NULL,
        roomdescription character varying NOT NULL,
        CONSTRAINT roomdescription_pkey PRIMARY KEY (roomdescription_id)
      )

      Insert 3 rows as
      1, " Test 1 "
      2, " Test 2 "
      3, " Test 3 "

      Execute following jdbc calls
      String query = " select roomdescription_id, roomdescription from ressystem.roomdescription " ;
      Object[] values = {2, " Test2 " };
      rs.setCommand(query);
      rs.execute(conn);
      rs.moveToInsertRow();
      for(int i=0; i<values.length; i++) {
      rs.updateObject(i+1,values[i]);
      }
      rs.insertRow();
      rs.moveToCurrentRow();
      rs.acceptChanges(conn);



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      javax.sql.rowset.spi.SyncProviderException: 1 conflicts while synchronizing
      at com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.java:398)
      at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:863)
      at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:922)
      ACTUAL -
      javax.sql.rowset.spi.SyncProviderException: 4 conflicts while synchronizing
      at com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.java:398)
      at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:863)
      at com.sun.rowset.CachedRowSetImpl.acceptChanges(CachedRowSetImpl.java:922)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Issue Links

          Activity

            People

              lancea Lance Andersen
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: