Program: 135909
Project: 135909
Buggy source:
/** 
 * Much of the stuff in this run() method was copied, without much understanding from Snippet245.java in the Eclipse examples.
 */
public void run(){
  String title=getGraphTitle(columnNumber,resultPage);
  Display display=UIHelper.getCurrentDisplay();
  boolean shellExists=false;
  Shell theShell=null;
  Shell[] shells=display.getShells();
  for (int i=0; i < shells.length; i++) {
    if (shells[i].getText().equals(title)) {
      theShell=shells[i];
      shellExists=true;
      break;
    }
  }
  if (!shellExists) {
    theShell=new Shell(display,SWT.SHELL_TRIM);
  }
  final Shell shell=theShell;
  shell.setText(title);
  shell.setActive();
  if (shellExists) {
    shell.redraw();
    shell.update();
  }
 else {
    shell.addPaintListener(new PaintListener(){
      public void paintControl(      PaintEvent event){
        StateSpaceInformationItem[] ssInfo=resultPage.getStateSpaceInformation();
        if (ssInfo.length < 2) {
          return;
        }
        long[] data=new long[ssInfo.length + 1];
        long[] times=new long[ssInfo.length + 1];
        data[0]=0;
        times[0]=0;
        long startTime=resultPage.startTime;
        System.out.println("String_Node_Str" + (ssInfo[0].getTime().getTime() - startTime));
        if (startTime > ssInfo[0].getTime().getTime() - 1000) {
          startTime=ssInfo[0].getTime().getTime() - 1000;
        }
        for (int i=1; i < data.length; i++) {
switch (columnNumber) {
case StateSpaceLabelProvider.COL_TIME:
            data[i]=i - 1;
          break;
case StateSpaceLabelProvider.COL_DIAMETER:
        data[i]=ssInfo[i - 1].getDiameter();
      break;
case StateSpaceLabelProvider.COL_FOUND:
    data[i]=ssInfo[i - 1].getFoundStates();
  break;
case StateSpaceLabelProvider.COL_DISTINCT:
data[i]=ssInfo[i - 1].getDistinctStates();
break;
case StateSpaceLabelProvider.COL_LEFT:
data[i]=ssInfo[i - 1].getLeftStates();
break;
default :
return;
}
times[i]=ssInfo[i - 1].getTime().getTime() - startTime;
}
if (data == null) {
return;
}
Rectangle rect=shell.getClientArea();
long maxData=0;
for (int i=0; i < data.length; i++) {
if (data[i] > maxData) {
maxData=data[i];
}
}
long maxTime=times[times.length - 1];
if (maxTime > 0) {
int[] pointArray=new int[2 * data.length];
for (int i=0; i < data.length; i++) {
pointArray[2 * i]=(int)((times[i] * rect.width) / maxTime);
pointArray[(2 * i) + 1]=(int)(rect.height - ((data[i] * rect.height) / maxData));
}
event.gc.drawPolyline(pointArray);
}
String stringTime="String_Node_Str";
long unreportedTime=maxTime;
long days=maxTime / (1000 * 60 * 60* 24);
if (days > 0) {
unreportedTime=unreportedTime - days * (1000 * 60 * 60* 24);
stringTime=stringTime + days + ((days == 1) ? ("String_Node_Str") : ("String_Node_Str"));
}
long hours=unreportedTime / (1000 * 60 * 60);
if (hours > 0) {
unreportedTime=unreportedTime - hours * (1000 * 60 * 60);
stringTime=stringTime + hours + ((hours == 1) ? ("String_Node_Str") : ("String_Node_Str"));
}
unreportedTime=(unreportedTime + (1000 * 26)) / (1000 * 60);
stringTime=stringTime + unreportedTime + ((unreportedTime == 1) ? ("String_Node_Str") : ("String_Node_Str"));
event.gc.drawString(stringTime,0,0);
event.gc.drawString("String_Node_Str" + data[data.length - 1],0,15);
if (maxData != data[data.length - 1]) {
event.gc.drawString("String_Node_Str" + maxData,0,30);
}
}
}
);
}
;
if (!shellExists) {
shell.setBounds(100 + 30 * columnNumber,100 + 30 * columnNumber,400,300);
}
shell.open();
}

Fixed version (ground truth):
/** 
 * Much of the stuff in this run() method was copied, without much understanding from Snippet245.java in the Eclipse examples.
 */
public void run(){
  String title=getGraphTitle(columnNumber,resultPage);
  Display display=UIHelper.getCurrentDisplay();
  boolean shellExists=false;
  Shell theShell=null;
  Shell[] shells=display.getShells();
  for (int i=0; i < shells.length; i++) {
    if (shells[i].getText().equals(title)) {
      theShell=shells[i];
      shellExists=true;
      break;
    }
  }
  if (!shellExists) {
    theShell=new Shell(display,SWT.SHELL_TRIM);
  }
  final Shell shell=theShell;
  shell.setText(title);
  shell.setActive();
  if (shellExists) {
    shell.redraw();
    shell.update();
  }
 else {
    shell.addPaintListener(new PaintListener(){
      public void paintControl(      PaintEvent event){
        StateSpaceInformationItem[] ssInfo=resultPage.getStateSpaceInformation();
        if (ssInfo.length < 2) {
          return;
        }
        long[] data=new long[ssInfo.length + 1];
        long[] times=new long[ssInfo.length + 1];
        data[0]=0;
        times[0]=0;
        long startTime=resultPage.startTime;
        System.out.println("String_Node_Str" + (ssInfo[0].getTime().getTime() - startTime));
        if (startTime > ssInfo[0].getTime().getTime() - 1000) {
          startTime=ssInfo[0].getTime().getTime() - 1000;
        }
        for (int i=1; i < data.length; i++) {
switch (columnNumber) {
case StateSpaceLabelProvider.COL_TIME:
            data[i]=i - 1;
          break;
case StateSpaceLabelProvider.COL_DIAMETER:
        data[i]=ssInfo[i - 1].getDiameter();
      break;
case StateSpaceLabelProvider.COL_FOUND:
    data[i]=ssInfo[i - 1].getFoundStates();
  break;
case StateSpaceLabelProvider.COL_DISTINCT:
data[i]=ssInfo[i - 1].getDistinctStates();
break;
case StateSpaceLabelProvider.COL_LEFT:
data[i]=ssInfo[i - 1].getLeftStates();
break;
default :
return;
}
times[i]=ssInfo[i - 1].getTime().getTime() - startTime;
}
if (data == null) {
return;
}
Rectangle rect=shell.getClientArea();
long maxData=0;
for (int i=0; i < data.length; i++) {
if (data[i] > maxData) {
maxData=data[i];
}
}
long maxTime=times[times.length - 1];
if (maxTime > 0) {
long maxDataVal=maxData;
if (maxDataVal == 0) {
maxDataVal=1;
}
int[] pointArray=new int[2 * data.length];
for (int i=0; i < data.length; i++) {
pointArray[2 * i]=(int)((times[i] * rect.width) / maxTime);
pointArray[(2 * i) + 1]=(int)(rect.height - ((data[i] * rect.height) / maxDataVal));
}
event.gc.drawPolyline(pointArray);
}
String stringTime="String_Node_Str";
long unreportedTime=maxTime;
long days=maxTime / (1000 * 60 * 60* 24);
if (days > 0) {
unreportedTime=unreportedTime - days * (1000 * 60 * 60* 24);
stringTime=stringTime + days + ((days == 1) ? ("String_Node_Str") : ("String_Node_Str"));
}
long hours=unreportedTime / (1000 * 60 * 60);
if (hours > 0) {
unreportedTime=unreportedTime - hours * (1000 * 60 * 60);
stringTime=stringTime + hours + ((hours == 1) ? ("String_Node_Str") : ("String_Node_Str"));
}
unreportedTime=(unreportedTime + (1000 * 26)) / (1000 * 60);
stringTime=stringTime + unreportedTime + ((unreportedTime == 1) ? ("String_Node_Str") : ("String_Node_Str"));
event.gc.drawString(stringTime,0,0);
event.gc.drawString("String_Node_Str" + data[data.length - 1],0,15);
if (maxData != data[data.length - 1]) {
event.gc.drawString("String_Node_Str" + maxData,0,30);
}
}
}
);
}
;
if (!shellExists) {
shell.setBounds(100 + 30 * columnNumber,100 + 30 * columnNumber,400,300);
}
shell.open();
}