Program: 17718
Project: 17718
Buggy source:
/** 
 * Process the background thread. Cycle through training iterations. If the cancel flag is set, then exit.
 */
public void run(){
  try {
    startup();
    if (this.train instanceof ResilientPropagation) {
      ResilientPropagation rprop=(ResilientPropagation)this.train;
    }
    while (!this.cancel) {
      this.iteration++;
      this.lastError=this.train.getError();
      if (this.resetOption.get() != -1) {
        MLMethod method=null;
        if (getEncogObject() instanceof ProjectEGFile) {
          method=(MLMethod)((ProjectEGFile)getEncogObject()).getObject();
        }
        if (method == null) {
          EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
          return;
        }
switch (this.resetOption.get()) {
case 0:
          if (method instanceof MLResettable) {
            ((MLResettable)method).reset();
          }
 else {
            EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
          }
        break;
case 1:
      (new Distort(0.01)).randomize(method);
    break;
case 2:
  (new Distort(0.05)).randomize(method);
break;
case 3:
(new Distort(0.1)).randomize(method);
break;
case 4:
(new Distort(0.15)).randomize(method);
break;
case 5:
(new Distort(0.20)).randomize(method);
break;
case 6:
(new Distort(0.50)).randomize(method);
break;
}
this.resetOption.set(-1);
}
this.train.iteration();
this.currentError=this.train.getError();
if (this.currentError < this.maxError) {
this.status="String_Node_Str";
this.cancel=true;
}
if (this.train.isTrainingDone()) {
this.status="String_Node_Str";
this.cancel=true;
}
this.errorImprovement=(this.lastError - this.currentError) / this.lastError;
if (System.currentTimeMillis() - this.lastUpdate > 1000 || this.cancel) {
redraw();
}
final Date now=new Date();
if (now.getTime() - this.performanceLast.getTime() > 60000) {
this.performanceLast=now;
this.performanceCount=this.iteration - this.performanceLastIteration;
this.performanceLastIteration=this.iteration;
}
}
this.train.finishTraining();
shutdown();
stopped();
if (this.shouldExit) {
dispose();
}
}
 catch (Throwable t) {
this.error=true;
EncogWorkBench.displayError("String_Node_Str",t,this.getEncogObject(),this.trainingData);
shutdown();
stopped();
dispose();
}
}

Fixed version (ground truth):
/** 
 * Process the background thread. Cycle through training iterations. If the cancel flag is set, then exit.
 */
public void run(){
  try {
    startup();
    if (this.train instanceof ResilientPropagation) {
      ResilientPropagation rprop=(ResilientPropagation)this.train;
    }
    while (!this.cancel) {
      this.iteration++;
      this.lastError=this.train.getError();
      if (this.resetOption.get() != -1) {
        MLMethod method=null;
        if (getEncogObject() instanceof ProjectEGFile) {
          method=(MLMethod)((ProjectEGFile)getEncogObject()).getObject();
        }
        if (method == null) {
          EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
          return;
        }
switch (this.resetOption.get()) {
case 0:
          if (method instanceof MLResettable) {
            ((MLResettable)method).reset();
          }
 else {
            EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
          }
        break;
case 1:
      (new Distort(0.01)).randomize(method);
    break;
case 2:
  (new Distort(0.05)).randomize(method);
break;
case 3:
(new Distort(0.1)).randomize(method);
break;
case 4:
(new Distort(0.15)).randomize(method);
break;
case 5:
(new Distort(0.20)).randomize(method);
break;
case 6:
(new Distort(0.50)).randomize(method);
break;
}
this.resetOption.set(-1);
}
this.train.iteration();
this.currentError=this.train.getError();
if (this.currentError < this.maxError) {
this.status="String_Node_Str";
this.cancel=true;
}
if (this.train.isTrainingDone()) {
this.status="String_Node_Str";
this.cancel=true;
}
this.errorImprovement=(this.lastError - this.currentError) / this.lastError;
if (Double.isInfinite(this.errorImprovement) || Double.isNaN(this.errorImprovement)) {
this.errorImprovement=100.0;
}
if (System.currentTimeMillis() - this.lastUpdate > 1000 || this.cancel) {
redraw();
}
final Date now=new Date();
if (now.getTime() - this.performanceLast.getTime() > 60000) {
this.performanceLast=now;
this.performanceCount=this.iteration - this.performanceLastIteration;
this.performanceLastIteration=this.iteration;
}
}
this.train.finishTraining();
shutdown();
stopped();
if (this.shouldExit) {
dispose();
}
}
 catch (Throwable t) {
this.error=true;
EncogWorkBench.displayError("String_Node_Str",t,this.getEncogObject(),this.trainingData);
shutdown();
stopped();
dispose();
}
}