Program: 17774
Project: 17774
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) {
        if (!(getEncogObject() instanceof MLMethod)) {
          EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
          return;
        }
switch (this.resetOption.get()) {
case 0:
          if (this.getEncogObject() instanceof MLResettable) {
            ((MLResettable)this.getEncogObject()).reset();
          }
 else {
            EncogWorkBench.displayError("String_Node_Str","String_Node_Str");
          }
        break;
case 1:
      (new Distort(0.01)).randomize((MLMethod)getEncogObject());
    break;
case 2:
  (new Distort(0.05)).randomize((MLMethod)getEncogObject());
break;
case 3:
(new Distort(0.1)).randomize((MLMethod)getEncogObject());
break;
case 4:
(new Distort(0.15)).randomize((MLMethod)getEncogObject());
break;
case 5:
(new Distort(0.20)).randomize((MLMethod)getEncogObject());
break;
case 6:
(new Distort(0.50)).randomize((MLMethod)getEncogObject());
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) {
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 (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();
}
}