Program: 3236
Project: 3236
Buggy source:
/** 
 * Convert the current row in a ResultSet into a TableRow object.
 * @param results A ResultSet to process
 * @param table The name of the table
 * @return A TableRow object with the data from the ResultSet
 * @exception SQLException If a database error occurs
 */
static TableRow process(ResultSet results,String table) throws SQLException {
  ResultSetMetaData meta=results.getMetaData();
  int columns=meta.getColumnCount() + 1;
  List<String> columnNames=(table == null) ? getColumnNames(meta) : getColumnNames(table);
  TableRow row=new TableRow(canonicalize(table),columnNames);
  for (int i=1; i < columns; i++) {
    String name=meta.getColumnName(i);
    int jdbctype=meta.getColumnType(i);
    if (results.wasNull()) {
      row.setColumnNull(name);
    }
 else {
switch (jdbctype) {
case Types.BIT:
        row.setColumn(name,results.getBoolean(i));
      break;
case Types.INTEGER:
    if (isOracle) {
      long longValue=results.getLong(i);
      if (longValue <= (long)Integer.MAX_VALUE) {
        row.setColumn(name,(int)longValue);
      }
 else {
        row.setColumn(name,longValue);
      }
    }
 else {
      row.setColumn(name,results.getInt(i));
    }
  break;
case Types.NUMERIC:
case Types.DECIMAL:
case Types.BIGINT:
row.setColumn(name,results.getLong(i));
break;
case Types.DOUBLE:
row.setColumn(name,results.getDouble(i));
break;
case Types.CLOB:
if (isOracle) {
row.setColumn(name,results.getString(i));
}
 else {
throw new IllegalArgumentException("String_Node_Str" + jdbctype);
}
break;
case Types.VARCHAR:
try {
byte[] bytes=results.getBytes(i);
if (bytes != null) {
String mystring=new String(results.getBytes(i),"String_Node_Str");
row.setColumn(name,mystring);
}
 else {
row.setColumn(name,results.getString(i));
}
}
 catch (UnsupportedEncodingException e) {
log.error("String_Node_Str",e);
}
break;
case Types.DATE:
row.setColumn(name,results.getDate(i));
break;
case Types.TIME:
row.setColumn(name,results.getTime(i));
break;
case Types.TIMESTAMP:
row.setColumn(name,results.getTimestamp(i));
break;
default :
throw new IllegalArgumentException("String_Node_Str" + jdbctype);
}
}
}
row.resetChanged();
return row;
}

Fixed version (ground truth):
/** 
 * Convert the current row in a ResultSet into a TableRow object.
 * @param results A ResultSet to process
 * @param table The name of the table
 * @return A TableRow object with the data from the ResultSet
 * @exception SQLException If a database error occurs
 */
static TableRow process(ResultSet results,String table) throws SQLException {
  ResultSetMetaData meta=results.getMetaData();
  int columns=meta.getColumnCount() + 1;
  List<String> columnNames=(table == null) ? getColumnNames(meta) : getColumnNames(table);
  TableRow row=new TableRow(canonicalize(table),columnNames);
  for (int i=1; i < columns; i++) {
    String name=meta.getColumnName(i);
    int jdbctype=meta.getColumnType(i);
switch (jdbctype) {
case Types.BIT:
      row.setColumn(name,results.getBoolean(i));
    break;
case Types.INTEGER:
  if (isOracle) {
    long longValue=results.getLong(i);
    if (longValue <= (long)Integer.MAX_VALUE) {
      row.setColumn(name,(int)longValue);
    }
 else {
      row.setColumn(name,longValue);
    }
  }
 else {
    row.setColumn(name,results.getInt(i));
  }
break;
case Types.NUMERIC:
case Types.DECIMAL:
case Types.BIGINT:
row.setColumn(name,results.getLong(i));
break;
case Types.DOUBLE:
row.setColumn(name,results.getDouble(i));
break;
case Types.CLOB:
if (isOracle) {
row.setColumn(name,results.getString(i));
}
 else {
throw new IllegalArgumentException("String_Node_Str" + jdbctype);
}
break;
case Types.VARCHAR:
try {
byte[] bytes=results.getBytes(i);
if (bytes != null) {
String mystring=new String(results.getBytes(i),"String_Node_Str");
row.setColumn(name,mystring);
}
 else {
row.setColumn(name,results.getString(i));
}
}
 catch (UnsupportedEncodingException e) {
log.error("String_Node_Str",e);
}
break;
case Types.DATE:
row.setColumn(name,results.getDate(i));
break;
case Types.TIME:
row.setColumn(name,results.getTime(i));
break;
case Types.TIMESTAMP:
row.setColumn(name,results.getTimestamp(i));
break;
default :
throw new IllegalArgumentException("String_Node_Str" + jdbctype);
}
if (results.wasNull()) {
row.setColumnNull(name);
}
}
row.resetChanged();
return row;
}