Program: 121019
Project: 121019
Buggy source:
/** 
 * Initialize dataSet based on an existing ResultSet.
 * @param columnLabels String[] of column labels [mandatory]
 * @param resultSet ResultSet with values [mandatory]
 * @param relevantIndeces int[] of all columns to add to the dataSet, use null if all columns should be included.
 * @throws Exception if the dataset could not be created
 */
@SuppressWarnings("String_Node_Str") private void initialize(String[] columnLabels,ResultSet resultSet,int[] relevantIndeces) throws Exception {
  ResultSetMetaData metadata=resultSet.getMetaData();
  if (relevantIndeces == null || relevantIndeces.length == 0) {
    relevantIndeces=new int[metadata.getColumnCount()];
    for (int i=1; i <= metadata.getColumnCount(); i++) {
      relevantIndeces[i - 1]=i;
    }
  }
  if (columnLabels != null && columnLabels.length != 0) {
    pcolumnLabels=columnLabels;
  }
 else {
    pcolumnLabels=new String[relevantIndeces.length];
    for (int i=0; i < relevantIndeces.length; i++) {
      pcolumnLabels[i]=metadata.getColumnName(relevantIndeces[i]);
    }
  }
  pcolumnTypes=new int[relevantIndeces.length];
  for (int i=0; i < relevantIndeces.length; i++) {
switch (metadata.getColumnType(relevantIndeces[i])) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case -9:
      pcolumnTypes[i]=TYPE_STRING;
    break;
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
  pcolumnTypes[i]=TYPE_INTEGER;
break;
case Types.DECIMAL:
case Types.NUMERIC:
case Types.DOUBLE:
case Types.FLOAT:
case Types.REAL:
pcolumnTypes[i]=TYPE_DOUBLE;
break;
case Types.DATE:
case Types.TIMESTAMP:
pcolumnTypes[i]=TYPE_DATETIME;
break;
case Types.TIME:
pcolumnTypes[i]=TYPE_TIME;
break;
case Types.BIGINT:
pcolumnTypes[i]=TYPE_LONG;
break;
default :
pcolumnTypes[i]=TYPE_STRING;
}
}
ArrayList rows=new ArrayList(100);
while (resultSet.next()) {
DataSetRow row=new DataSetRow(relevantIndeces.length);
for (int i=0; i < relevantIndeces.length; i++) {
switch (pcolumnTypes[i]) {
case TYPE_STRING:
row.setValue(i,resultSet.getString(relevantIndeces[i]));
break;
case TYPE_INTEGER:
row.setValue(i,new Long(resultSet.getInt(relevantIndeces[i])));
break;
case TYPE_DOUBLE:
row.setValue(i,new Double(resultSet.getDouble(relevantIndeces[i])));
break;
case TYPE_DATE:
row.setValue(i,resultSet.getDate(relevantIndeces[i]));
break;
case TYPE_DATETIME:
try {
row.setValue(i,resultSet.getTimestamp(relevantIndeces[i]));
}
 catch (SQLException e) {
row.setValue(i,resultSet.getString(relevantIndeces[i]));
}
break;
case TYPE_TIME:
row.setValue(i,resultSet.getTime(relevantIndeces[i]));
break;
case TYPE_LONG:
row.setValue(i,new Long(resultSet.getLong(relevantIndeces[i])));
break;
default :
row.setValue(i,resultSet.getString(relevantIndeces[i]));
break;
}
if (resultSet.wasNull()) {
row.setValue(i,null);
}
}
rows.add(row);
}
prows=(DataSetRow[])rows.toArray(new DataSetRow[]{});
}

Fixed version (ground truth):
/** 
 * Initialize dataSet based on an existing ResultSet.
 * @param columnLabels String[] of column labels [mandatory]
 * @param resultSet ResultSet with values [mandatory]
 * @param relevantIndeces int[] of all columns to add to the dataSet, use null if all columns should be included.
 * @throws Exception if the dataset could not be created
 */
@SuppressWarnings("String_Node_Str") private void initialize(String[] columnLabels,ResultSet resultSet,int[] relevantIndeces) throws Exception {
  ResultSetMetaData metadata=resultSet.getMetaData();
  if (relevantIndeces == null || relevantIndeces.length == 0) {
    relevantIndeces=new int[metadata.getColumnCount()];
    for (int i=1; i <= metadata.getColumnCount(); i++) {
      relevantIndeces[i - 1]=i;
    }
  }
  if (columnLabels != null && columnLabels.length != 0) {
    pcolumnLabels=columnLabels;
  }
 else {
    pcolumnLabels=new String[relevantIndeces.length];
    for (int i=0; i < relevantIndeces.length; i++) {
      pcolumnLabels[i]=metadata.getColumnName(relevantIndeces[i]);
    }
  }
  pcolumnTypes=new int[relevantIndeces.length];
  for (int i=0; i < relevantIndeces.length; i++) {
switch (metadata.getColumnType(relevantIndeces[i])) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case -9:
      pcolumnTypes[i]=TYPE_STRING;
    break;
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
  pcolumnTypes[i]=TYPE_INTEGER;
break;
case Types.DECIMAL:
case Types.NUMERIC:
case Types.DOUBLE:
case Types.FLOAT:
case Types.REAL:
pcolumnTypes[i]=TYPE_DOUBLE;
break;
case Types.DATE:
case Types.TIMESTAMP:
pcolumnTypes[i]=TYPE_DATETIME;
break;
case Types.TIME:
pcolumnTypes[i]=TYPE_TIME;
break;
case Types.BIGINT:
pcolumnTypes[i]=TYPE_LONG;
break;
default :
pcolumnTypes[i]=TYPE_STRING;
}
}
ArrayList rows=new ArrayList(100);
while (resultSet.next()) {
DataSetRow row=new DataSetRow(relevantIndeces.length);
for (int i=0; i < relevantIndeces.length; i++) {
switch (pcolumnTypes[i]) {
case TYPE_STRING:
try {
row.setValue(i,resultSet.getString(relevantIndeces[i]));
}
 catch (SQLException e) {
if (e.getMessage().equals("String_Node_Str")) {
row.setValue(i,"String_Node_Str");
}
 else {
throw e;
}
}
break;
case TYPE_INTEGER:
row.setValue(i,new Long(resultSet.getInt(relevantIndeces[i])));
break;
case TYPE_DOUBLE:
row.setValue(i,new Double(resultSet.getDouble(relevantIndeces[i])));
break;
case TYPE_DATE:
row.setValue(i,resultSet.getDate(relevantIndeces[i]));
break;
case TYPE_DATETIME:
try {
row.setValue(i,resultSet.getTimestamp(relevantIndeces[i]));
}
 catch (SQLException e) {
row.setValue(i,resultSet.getString(relevantIndeces[i]));
}
break;
case TYPE_TIME:
row.setValue(i,resultSet.getTime(relevantIndeces[i]));
break;
case TYPE_LONG:
row.setValue(i,new Long(resultSet.getLong(relevantIndeces[i])));
break;
default :
row.setValue(i,resultSet.getString(relevantIndeces[i]));
break;
}
if (resultSet.wasNull()) {
row.setValue(i,null);
}
}
rows.add(row);
}
prows=(DataSetRow[])rows.toArray(new DataSetRow[]{});
}