Program: 7961
Project: 7961
Buggy source:
@Override public void compareAndSwap(byte[] row,byte[] column,byte[] expectedValue,byte[] newValue,ReadPointer readPointer,long writeVersion) throws OperationException {
  PreparedStatement ps=null;
  try {
    ps=this.connection.prepareStatement("String_Node_Str" + "String_Node_Str" + this.quotedTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    ps.setBytes(1,row);
    ps.setBytes(2,column);
    ResultSet result=ps.executeQuery();
    ImmutablePair<Long,byte[]> latest=filteredLatest(result,readPointer);
    byte[] existingValue=latest == null ? null : latest.getSecond();
    ps.close();
    ps=null;
    if (existingValue == null && expectedValue != null)     throw new OperationException(StatusCode.WRITE_CONFLICT,"String_Node_Str");
    if (existingValue != null && expectedValue == null)     throw new OperationException(StatusCode.WRITE_CONFLICT,"String_Node_Str");
    if (expectedValue == null) {
      put(row,column,writeVersion,newValue);
      return;
    }
    if (!Bytes.equals(expectedValue,existingValue))     throw new OperationException(StatusCode.WRITE_CONFLICT,"String_Node_Str");
    if (newValue == null) {
      deleteAll(row,column,latest.getFirst());
      return;
    }
    ps=this.connection.prepareStatement("String_Node_Str" + this.quotedTableName + "String_Node_Str");
    ps.setBytes(1,row);
    ps.setBytes(2,column);
    ps.setLong(3,writeVersion);
    ps.setInt(4,Type.VALUE.i);
    ps.setBytes(5,newValue);
    ps.executeUpdate();
  }
 catch (  SQLException e) {
    throw createOperationException(e,"String_Node_Str");
  }
 finally {
    if (ps != null) {
      try {
        ps.close();
      }
 catch (      SQLException e) {
        throw createOperationException(e,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void compareAndSwap(byte[] row,byte[] column,byte[] expectedValue,byte[] newValue,ReadPointer readPointer,long writeVersion) throws OperationException {
  PreparedStatement ps=null;
  try {
    ps=this.connection.prepareStatement("String_Node_Str" + "String_Node_Str" + this.quotedTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    ps.setBytes(1,row);
    ps.setBytes(2,column);
    ResultSet result=ps.executeQuery();
    ImmutablePair<Long,byte[]> latest=filteredLatest(result,readPointer);
    byte[] existingValue=latest == null ? null : latest.getSecond();
    ps.close();
    ps=null;
    if (existingValue == null && expectedValue != null) {
      throw new OperationException(StatusCode.WRITE_CONFLICT,"String_Node_Str");
    }
    if (existingValue != null && expectedValue == null) {
      throw new OperationException(StatusCode.WRITE_CONFLICT,"String_Node_Str");
    }
    if (expectedValue == null) {
      put(row,column,writeVersion,newValue);
      return;
    }
    if (!Bytes.equals(expectedValue,existingValue)) {
      throw new OperationException(StatusCode.WRITE_CONFLICT,"String_Node_Str");
    }
    if (newValue == null) {
      deleteAll(row,column,latest.getFirst());
      return;
    }
    ps=this.connection.prepareStatement("String_Node_Str" + this.quotedTableName + "String_Node_Str");
    ps.setBytes(1,row);
    ps.setBytes(2,column);
    ps.setLong(3,writeVersion);
    ps.setInt(4,Type.VALUE.i);
    ps.setBytes(5,newValue);
    ps.executeUpdate();
  }
 catch (  SQLException e) {
    throw createOperationException(e,"String_Node_Str");
  }
 finally {
    if (ps != null) {
      try {
        ps.close();
      }
 catch (      SQLException e) {
        throw createOperationException(e,"String_Node_Str");
      }
    }
  }
}