# HG changeset patch
# User lancea
# Date 1354827104 18000
# Node ID b31f1eaee88ae5263db3ebbaf9567422930bb65e
# Parent d815de0ca6f0bfb75aaca6db9e5148c422c7c35f
8004374: CachedRowSetSwriter.writeData reports wrong number of conflicts in SyncProviderException
Reviewed-by: naoto
diff -r d815de0ca6f0 -r b31f1eaee88a jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java
--- a/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Wed Dec 05 21:08:14 2012 -0800
+++ b/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Thu Dec 06 15:51:44 2012 -0500
@@ -264,7 +264,7 @@
* false
otherwise
*/
public boolean writeData(RowSetInternal caller) throws SQLException {
- boolean conflict = false;
+ long conflicts = 0;
boolean showDel = false;
PreparedStatement pstmtIns = null;
iChangedValsInDbAndCRS = 0;
@@ -337,8 +337,9 @@
while (crs.next()) {
if (crs.rowDeleted()) {
// The row has been deleted.
- if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
+ if (deleteOriginalRow(crs, this.crsResolve)) {
status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
+ conflicts++;
} else {
// delete happened without any occurrence of conflicts
// so update status accordingly
@@ -349,8 +350,9 @@
// The row has been inserted.
pstmtIns = con.prepareStatement(insertCmd);
- if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
+ if (insertNewRow(crs, pstmtIns, this.crsResolve)) {
status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
+ conflicts++;
} else {
// insert happened without any occurrence of conflicts
// so update status accordingly
@@ -358,8 +360,9 @@
}
} else if (crs.rowUpdated()) {
// The row has been updated.
- if ( conflict = (updateOriginalRow(crs)) == true) {
+ if (updateOriginalRow(crs)) {
status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
+ conflicts++;
} else {
// update happened without any occurrence of conflicts
// so update status accordingly
@@ -395,21 +398,12 @@
// reset
crs.setShowDeleted(showDel);
- boolean boolConf = false;
- for (int j=1;j