Program: 168418
Project: 168418
Buggy source:
@Override public void displayExercise(){
  final EVExercise exercise=getDocument().getExercise();
  tbSamples.setModel(new AbstractTableModel(){
    @Override public String getColumnName(    int col){
      return columnNames[col];
    }
    @Override public int getRowCount(){
      if (exercise.getSampleList() != null) {
        return exercise.getSampleList().length;
      }
      return 0;
    }
    @Override public int getColumnCount(){
      return columnNames.length;
    }
    /** 
 * Returns the class of the specified column (needes for sorting). 
 */
    @Override public Class<?> getColumnClass(    int col){
switch (col) {
case COLUMN_TIME:
case COLUMN_DISTANCE:
        return Integer.class;
case COLUMN_HEARTRATE:
case COLUMN_ALTITUDE:
case COLUMN_CADENCE:
case COLUMN_TEMPERATURE:
      return Short.class;
case COLUMN_SPEED:
    return Float.class;
default :
  return Object.class;
}
}
@Override public Object getValueAt(int row,int col){
ExerciseSample sample=exercise.getSampleList()[row];
switch (col) {
case COLUMN_TIME:
return Integer.valueOf((int)(sample.getTimestamp() / 1000));
case COLUMN_HEARTRATE:
return Short.valueOf(sample.getHeartRate());
case COLUMN_ALTITUDE:
if (exercise.getRecordingMode().isAltitude()) {
return Short.valueOf(sample.getAltitude());
}
break;
case COLUMN_SPEED:
if (exercise.getRecordingMode().isSpeed()) {
return new Float(sample.getSpeed());
}
break;
case COLUMN_DISTANCE:
if (exercise.getRecordingMode().isSpeed()) {
return Integer.valueOf(sample.getDistance());
}
break;
case COLUMN_CADENCE:
if (exercise.getRecordingMode().isCadence()) {
return Short.valueOf(sample.getCadence());
}
break;
case COLUMN_TEMPERATURE:
if (exercise.getRecordingMode().isTemperature()) {
return Short.valueOf(sample.getTemperature());
}
break;
}
return null;
}
@Override public boolean isCellEditable(int row,int col){
return false;
}
}
);
SampleCellRenderer cellRenderer=new SampleCellRenderer();
for (int i=0; i < COLUMN_COUNT; i++) {
tbSamples.getColumnModel().getColumn(i).setCellRenderer(cellRenderer);
}
}

Fixed version (ground truth):
@Override public void displayExercise(){
  final EVExercise exercise=getDocument().getExercise();
  tbSamples.setModel(new AbstractTableModel(){
    @Override public String getColumnName(    int col){
      return columnNames[col];
    }
    @Override public int getRowCount(){
      if (exercise.getSampleList() != null) {
        return exercise.getSampleList().length;
      }
      return 0;
    }
    @Override public int getColumnCount(){
      return columnNames.length;
    }
    /** 
 * Returns the class of the specified column (needes for sorting). 
 */
    @Override public Class<?> getColumnClass(    int col){
switch (col) {
case COLUMN_TIME:
case COLUMN_DISTANCE:
        return Integer.class;
case COLUMN_HEARTRATE:
case COLUMN_ALTITUDE:
case COLUMN_CADENCE:
case COLUMN_TEMPERATURE:
      return Short.class;
case COLUMN_SPEED:
    return Float.class;
default :
  return Object.class;
}
}
@Override public Object getValueAt(int row,int col){
ExerciseSample sample=exercise.getSampleList()[row];
switch (col) {
case COLUMN_TIME:
return Integer.valueOf((int)(sample.getTimestamp() / 1000));
case COLUMN_HEARTRATE:
return Short.valueOf(sample.getHeartRate());
case COLUMN_ALTITUDE:
if (exercise.getRecordingMode().isAltitude()) {
return Short.valueOf(sample.getAltitude());
}
break;
case COLUMN_SPEED:
if (exercise.getRecordingMode().isSpeed()) {
return Float.valueOf(sample.getSpeed());
}
break;
case COLUMN_DISTANCE:
if (exercise.getRecordingMode().isSpeed()) {
return Integer.valueOf(sample.getDistance());
}
break;
case COLUMN_CADENCE:
if (exercise.getRecordingMode().isCadence()) {
return Short.valueOf(sample.getCadence());
}
break;
case COLUMN_TEMPERATURE:
if (exercise.getRecordingMode().isTemperature()) {
return Short.valueOf(sample.getTemperature());
}
break;
}
return null;
}
@Override public boolean isCellEditable(int row,int col){
return false;
}
}
);
SampleCellRenderer cellRenderer=new SampleCellRenderer();
for (int i=0; i < COLUMN_COUNT; i++) {
tbSamples.getColumnModel().getColumn(i).setCellRenderer(cellRenderer);
}
}