Program: 80123
Project: 80123
Buggy source:
/** 
 * See assertRowInResultSet(...) above.
 * @param BitSet colsToCheck If non-null then for every bit bthat is set in colsToCheck, we'll compare the (b+1)-th column of the received result set's current row to the i-th column of expectedRow, where 0 <= i < # bits set in colsToCheck. So if colsToCheck is { 0, 3 } then expectedRow should have two objects and we'll check that: expectedRow[0].equals(rs.getXXX(1)); expectedRow[1].equals(rs.getXXX(4)); If colsToCheck is null then the (i+1)-th column in the result set is compared to the i-th column in expectedRow, where 0 <= i < expectedRow.length.
 */
private static void assertRowInResultSet(ResultSet rs,int rowNum,Object[] expectedRow,boolean asTrimmedStrings,BitSet colsToCheck) throws SQLException {
  int cPos=0;
  ResultSetMetaData rsmd=rs.getMetaData();
  for (int i=0; i < expectedRow.length; i++) {
    cPos=(colsToCheck == null) ? (i + 1) : colsToCheck.nextSetBit(cPos) + 1;
    Object obj;
    if (asTrimmedStrings) {
      if (expectedRow[i] != null)       expectedRow[i]=((String)expectedRow[i]).trim();
      if ((expectedRow[i] != null) && (rsmd.getColumnType(cPos) == Types.SMALLINT)) {
        String s=expectedRow[i].toString();
        if (s.equals("String_Node_Str") || s.equals("String_Node_Str"))         obj=(rs.getShort(cPos) == 0) ? "String_Node_Str" : "String_Node_Str";
 else         obj=rs.getString(cPos);
      }
 else {
        obj=rs.getString(cPos);
      }
      if (obj != null)       obj=((String)obj).trim();
    }
 else     obj=rs.getObject(cPos);
    boolean ok=(rs.wasNull() && (expectedRow[i] == null)) || (!rs.wasNull() && (expectedRow[i] != null) && (expectedRow[i].equals(obj) || (obj instanceof byte[] && Arrays.equals((byte[])obj,(byte[])expectedRow[i]))));
    if (!ok) {
      Object expected=expectedRow[i];
      Object found=obj;
      if (obj instanceof byte[]) {
        expected=bytesToString((byte[])expectedRow[i]);
        found=bytesToString((byte[])obj);
      }
      Assert.fail("String_Node_Str" + rsmd.getColumnName(cPos) + "String_Node_Str"+ rowNum+ "String_Node_Str"+ expected+ "String_Node_Str"+ found+ "String_Node_Str");
    }
    if (rs.wasNull())     assertResultColumnNullable(rsmd,cPos);
  }
}

Fixed version (ground truth):
/** 
 * See assertRowInResultSet(...) above.
 * @param colsToCheck If non-null then for every bit bthat is set in colsToCheck, we'll compare the (b+1)-th column of the received result set's current row to the i-th column of expectedRow, where 0 <= i < # bits set in colsToCheck. So if colsToCheck is { 0, 3 } then expectedRow should have two objects and we'll check that: expectedRow[0].equals(rs.getXXX(1)); expectedRow[1].equals(rs.getXXX(4)); If colsToCheck is null then the (i+1)-th column in the result set is compared to the i-th column in expectedRow, where 0 <= i < expectedRow.length.
 */
private static void assertRowInResultSet(ResultSet rs,int rowNum,Object[] expectedRow,boolean asTrimmedStrings,BitSet colsToCheck) throws SQLException {
  int cPos=0;
  ResultSetMetaData rsmd=rs.getMetaData();
  for (int i=0; i < expectedRow.length; i++) {
    cPos=(colsToCheck == null) ? (i + 1) : colsToCheck.nextSetBit(cPos) + 1;
    Object obj;
    if (asTrimmedStrings) {
      if (expectedRow[i] != null)       expectedRow[i]=((String)expectedRow[i]).trim();
      if ((expectedRow[i] != null) && (rsmd.getColumnType(cPos) == Types.SMALLINT)) {
        String s=expectedRow[i].toString();
        if (s.equals("String_Node_Str") || s.equals("String_Node_Str"))         obj=(rs.getShort(cPos) == 0) ? "String_Node_Str" : "String_Node_Str";
 else         obj=rs.getString(cPos);
      }
 else {
        obj=rs.getString(cPos);
      }
      if (obj != null)       obj=((String)obj).trim();
    }
 else     obj=rs.getObject(cPos);
    boolean ok=(rs.wasNull() && (expectedRow[i] == null)) || (!rs.wasNull() && (expectedRow[i] != null) && (expectedRow[i].equals(obj) || (obj instanceof byte[] && Arrays.equals((byte[])obj,(byte[])expectedRow[i]))));
    if (!ok) {
      Object expected=expectedRow[i];
      Object found=obj;
      if (obj instanceof byte[]) {
        expected=bytesToString((byte[])expectedRow[i]);
        found=bytesToString((byte[])obj);
      }
      Assert.fail("String_Node_Str" + rsmd.getColumnName(cPos) + "String_Node_Str"+ rowNum+ "String_Node_Str"+ expected+ "String_Node_Str"+ found+ "String_Node_Str");
    }
    if (rs.wasNull())     assertResultColumnNullable(rsmd,cPos);
  }
}