Program: 17673
Project: 17673
Buggy source:
private void restructureFeedforward(){
  CreateFeedforward dialog=new CreateFeedforward(EncogWorkBench.getInstance().getMainWindow());
  BasicNetwork network=(BasicNetwork)method;
  ActivationFunction oldActivationOutput=network.getActivation(network.getLayerCount() - 1);
  dialog.setActivationFunctionOutput(oldActivationOutput);
  dialog.getInputCount().setValue(network.getInputCount());
  dialog.getOutputCount().setValue(network.getOutputCount());
  int hiddenLayerCount=network.getLayerCount() - 2;
  ActivationFunction oldActivationHidden=new ActivationTANH();
  for (int i=0; i < hiddenLayerCount; i++) {
    int num=network.getLayerNeuronCount(i + 1);
    String str="String_Node_Str" + (i + 1) + "String_Node_Str"+ num+ "String_Node_Str";
    dialog.getHidden().getModel().addElement(str);
  }
  dialog.setActivationFunctionHidden(oldActivationHidden);
  if (dialog.process()) {
    if ((dialog.getActivationFunctionHidden() != oldActivationHidden) || (dialog.getActivationFunctionOutput() != oldActivationOutput) || dialog.getHidden().getModel().size() != (network.getLayerCount() - 2)) {
      FeedForwardPattern feedforward=new FeedForwardPattern();
      feedforward.setActivationFunction(dialog.getActivationFunctionHidden());
      feedforward.setInputNeurons(dialog.getInputCount().getValue());
      for (int i=0; i < dialog.getHidden().getModel().size(); i++) {
        String str=(String)dialog.getHidden().getModel().getElementAt(i);
        int i1=str.indexOf(':');
        int i2=str.indexOf("String_Node_Str");
        if (i1 != -1 && i2 != -1) {
          str=str.substring(i1 + 1,i2).trim();
          int neuronCount=Integer.parseInt(str);
          feedforward.addHiddenLayer(neuronCount);
        }
      }
      feedforward.setInputNeurons(dialog.getInputCount().getValue());
      feedforward.setOutputNeurons(dialog.getOutputCount().getValue());
      BasicNetwork obj=(BasicNetwork)feedforward.generate();
    }
 else {
      PruneSelective prune=new PruneSelective(network);
      int newInputCount=dialog.getInputCount().getValue();
      int newOutputCount=dialog.getOutputCount().getValue();
      if (newInputCount != network.getInputCount()) {
        prune.changeNeuronCount(0,newInputCount);
      }
      if (newOutputCount != network.getOutputCount()) {
        prune.changeNeuronCount(0,newOutputCount);
      }
      for (int i=0; i < network.getLayerCount() - 2; i++) {
        int newHiddenCount=1;
        String str=(String)dialog.getHidden().getModel().getElementAt(i);
        int i1=str.indexOf(':');
        int i2=str.indexOf("String_Node_Str");
        if (i1 != -1 && i2 != -1) {
          str=str.substring(i1 + 1,i2).trim();
          newHiddenCount=Integer.parseInt(str);
        }
        if (network.getLayerNeuronCount(i) != newHiddenCount) {
          prune.changeNeuronCount(i + 1,newHiddenCount);
        }
      }
    }
    setDirty(true);
    produceReport();
  }
}

Fixed version (ground truth):
private void restructureFeedforward(){
  CreateFeedforward dialog=new CreateFeedforward(EncogWorkBench.getInstance().getMainWindow());
  BasicNetwork network=(BasicNetwork)method;
  int hiddenLayerCount=network.getLayerCount() - 2;
  ActivationFunction oldActivationOutput=network.getActivation(network.getLayerCount() - 1);
  ActivationFunction oldActivationHidden;
  if (hiddenLayerCount > 0) {
    oldActivationHidden=network.getActivation(1);
  }
 else {
    oldActivationHidden=new ActivationTANH();
  }
  dialog.setActivationFunctionOutput(oldActivationOutput);
  dialog.setActivationFunctionHidden(oldActivationHidden);
  dialog.getInputCount().setValue(network.getInputCount());
  dialog.getOutputCount().setValue(network.getOutputCount());
  for (int i=0; i < hiddenLayerCount; i++) {
    int num=network.getLayerNeuronCount(i + 1);
    String str="String_Node_Str" + (i + 1) + "String_Node_Str"+ num+ "String_Node_Str";
    dialog.getHidden().getModel().addElement(str);
  }
  if (dialog.process()) {
    if ((dialog.getActivationFunctionHidden() != oldActivationHidden) || (dialog.getActivationFunctionOutput() != oldActivationOutput) || dialog.getHidden().getModel().size() != (network.getLayerCount() - 2)) {
      FeedForwardPattern feedforward=new FeedForwardPattern();
      feedforward.setActivationFunction(dialog.getActivationFunctionHidden());
      feedforward.setActivationOutput(dialog.getActivationFunctionOutput());
      feedforward.setInputNeurons(dialog.getInputCount().getValue());
      for (int i=0; i < dialog.getHidden().getModel().size(); i++) {
        String str=(String)dialog.getHidden().getModel().getElementAt(i);
        int i1=str.indexOf(':');
        int i2=str.indexOf("String_Node_Str");
        if (i1 != -1 && i2 != -1) {
          str=str.substring(i1 + 1,i2).trim();
          int neuronCount=Integer.parseInt(str);
          feedforward.addHiddenLayer(neuronCount);
        }
      }
      feedforward.setInputNeurons(dialog.getInputCount().getValue());
      feedforward.setOutputNeurons(dialog.getOutputCount().getValue());
      this.method=(BasicNetwork)feedforward.generate();
      ((ProjectEGFile)getEncogObject()).setObject(this.method);
      produceReport();
    }
 else {
      PruneSelective prune=new PruneSelective(network);
      int newInputCount=dialog.getInputCount().getValue();
      int newOutputCount=dialog.getOutputCount().getValue();
      if (newInputCount != network.getInputCount()) {
        prune.changeNeuronCount(0,newInputCount);
      }
      if (newOutputCount != network.getOutputCount()) {
        prune.changeNeuronCount(0,newOutputCount);
      }
      for (int i=0; i < network.getLayerCount() - 2; i++) {
        int newHiddenCount=1;
        String str=(String)dialog.getHidden().getModel().getElementAt(i);
        int i1=str.indexOf(':');
        int i2=str.indexOf("String_Node_Str");
        if (i1 != -1 && i2 != -1) {
          str=str.substring(i1 + 1,i2).trim();
          newHiddenCount=Integer.parseInt(str);
        }
        if (network.getLayerNeuronCount(i) != newHiddenCount) {
          prune.changeNeuronCount(i + 1,newHiddenCount);
        }
      }
    }
    setDirty(true);
    produceReport();
  }
}