JDBC bug: Incorrect number of conflicts is reported by CachedRowSetWriter.writeData

Frank Ding dingxmin at linux.vnet.ibm.com
Tue Nov 13 02:25:42 UTC 2012

Hi Lance
   Thanks for your quick response.  Please find the bug info below.

   The problem:
   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.

   Test case:
   The bug can be easily manifested in all SQL server environment. Here 
take PostgreSQL for example.
   1. The sql script to create a table
CREATE TABLE ressystem.roomdescription
   roomdescription_id serial NOT NULL,
   roomdescription character varying NOT NULL,
   CONSTRAINT roomdescription_pkey PRIMARY KEY (roomdescription_id)

   2.  Manually insert 3 rows
(1, "Test 1")
(2, "Test 2")
(3, "Test 3")

   3. Create a Java class that connects the established database and 
then execute the following code snippet.
String query = "select roomdescription_id, roomdescription from 
Object[] values = {2, "Test2"};
for(int i=0; i<values.length; i++) {

   4. An exception occurs with following output.
javax.sql.rowset.spi.SyncProviderException: 4conflicts while synchronizing

  5. In fact, there is only one conflicting row but 4 were reported.

Best regards,

On 11/9/2012 7:41 PM, Lance Andersen - Oracle wrote:
> Frank,
> If you can please post the bug info here, I will take a look at your patch
> Best
> Lance
> On Nov 8, 2012, at 10:01 PM, Frank Ding wrote:
>> Hi guys,
>>   We discovered a bug in CachedRowSetWriter.writeData method where incorrect number of conflicts is reported.  I searched in Oracle bug database and no similar record was found.  So I submitted a new one whose internal review ID is 2376620.  A test case with code is illustrated in the bug submission that leverages PostgreSQL server but the issue is platform independent and easy to reproduce.
>>   I provided a patch review, available @
>>   http://cr.openjdk.java.net/~dingxmin/2376620/webrev.01/
>>   Is there anybody who is interested in patch and can also review bug 2376620?  Your reply is appreciated.
>> Best regards,
>> Frank
> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
> Oracle Java Engineering
> 1 Network Drive
> Burlington, MA 01803
> Lance.Andersen at oracle.com

More information about the core-libs-dev mailing list