Program: 12870
Project: 12870
Buggy source:
@Override public final void reconfigure(){
  boolean restart=pause();
  super.reconfigure();
  RAM128k currentMemory=(RAM128k)getMemory();
  if (currentMemory != null && !(currentMemory.getClass().equals(ramCard.getValue()))) {
    try {
      RAM128k newMemory=(RAM128k)ramCard.getValue().newInstance();
      newMemory.copyFrom(currentMemory);
      setMemory(newMemory);
    }
 catch (    InstantiationException|IllegalAccessException ex) {
    }
  }
  if (getMemory() == null) {
    try {
      currentMemory=(RAM128k)ramCard.getValue().newInstance();
    }
 catch (    InstantiationException|IllegalAccessException ex) {
      Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
    }
    try {
      setMemory(currentMemory);
      for (      SoftSwitches s : SoftSwitches.values()) {
        s.getSwitch().register(this);
      }
    }
 catch (    Throwable ex) {
    }
  }
  currentMemory.reconfigure();
  try {
    if (useConsoleProbe) {
      probe.init(this);
    }
 else {
      probe.shutdown();
    }
    if (useDebugRom) {
      loadRom("String_Node_Str");
    }
 else {
      loadRom("String_Node_Str");
    }
    if (getVideo() == null || getVideo().getClass() != videoRenderer.getValue()) {
      Graphics g=null;
      if (getVideo() != null) {
        getVideo().suspend();
        g=getVideo().getScreen();
      }
      try {
        setVideo((Video)videoRenderer.getValue().newInstance());
        getVideo().configureVideoMode();
        getVideo().reconfigure();
        getVideo().setScreen(g);
        Emulator.resizeVideo();
        getVideo().resume();
      }
 catch (      InstantiationException|IllegalAccessException ex) {
        Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    try {
      insertCard(card1.getValue(),1);
      insertCard(card2.getValue(),2);
      insertCard(card3.getValue(),3);
      insertCard(card4.getValue(),4);
      insertCard(card5.getValue(),5);
      insertCard(card6.getValue(),6);
      insertCard(card7.getValue(),7);
    }
 catch (    NoSuchMethodException|IllegalArgumentException|InvocationTargetException ex) {
      Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
    }
    if (enableHints) {
      enableHints();
    }
 else {
      disableHints();
    }
    getMemory().configureActiveMemory();
    if (cheatEngine.getValue() == null) {
      if (activeCheatEngine != null) {
        activeCheatEngine.detach();
      }
      activeCheatEngine=null;
    }
 else {
      boolean startCheats=true;
      if (activeCheatEngine != null) {
        if (activeCheatEngine.getClass().equals(cheatEngine.getValue())) {
          startCheats=false;
        }
 else {
          activeCheatEngine.detach();
          activeCheatEngine=null;
        }
      }
      if (startCheats) {
        try {
          activeCheatEngine=(Cheats)cheatEngine.getValue().newInstance();
        }
 catch (        InstantiationException|IllegalAccessException ex) {
          Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
        }
        activeCheatEngine.attach();
      }
    }
  }
 catch (  IOException ex) {
    Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
  }
  if (restart) {
    resume();
  }
}

Fixed version (ground truth):
@Override public final void reconfigure(){
  boolean restart=pause();
  super.reconfigure();
  RAM128k currentMemory=(RAM128k)getMemory();
  if (currentMemory != null && !(currentMemory.getClass().equals(ramCard.getValue()))) {
    try {
      RAM128k newMemory=(RAM128k)ramCard.getValue().getConstructor(Computer.class).newInstance(this);
      newMemory.copyFrom(currentMemory);
      setMemory(newMemory);
    }
 catch (    InstantiationException|IllegalAccessException|IllegalArgumentException|InvocationTargetException|NoSuchMethodException|SecurityException ex) {
      Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
    }
  }
  if (getMemory() == null) {
    try {
      currentMemory=(RAM128k)ramCard.getValue().getConstructor(Computer.class).newInstance(this);
    }
 catch (    InstantiationException|IllegalAccessException|NoSuchMethodException|SecurityException ex) {
      Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
    }
catch (    IllegalArgumentException|InvocationTargetException ex) {
      Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
    }
    try {
      setMemory(currentMemory);
      for (      SoftSwitches s : SoftSwitches.values()) {
        s.getSwitch().register(this);
      }
    }
 catch (    Throwable ex) {
    }
  }
  currentMemory.reconfigure();
  try {
    if (useConsoleProbe) {
      probe.init(this);
    }
 else {
      probe.shutdown();
    }
    if (useDebugRom) {
      loadRom("String_Node_Str");
    }
 else {
      loadRom("String_Node_Str");
    }
    if (getVideo() == null || getVideo().getClass() != videoRenderer.getValue()) {
      Graphics g=null;
      if (getVideo() != null) {
        getVideo().suspend();
        g=getVideo().getScreen();
      }
      try {
        setVideo((Video)videoRenderer.getValue().getConstructor(Computer.class).newInstance(this));
        getVideo().configureVideoMode();
        getVideo().reconfigure();
        getVideo().setScreen(g);
        Emulator.resizeVideo();
        getVideo().resume();
      }
 catch (      InstantiationException|IllegalAccessException ex) {
        Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
      }
catch (      NoSuchMethodException|SecurityException|IllegalArgumentException|InvocationTargetException ex) {
        Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    try {
      insertCard(card1.getValue(),1);
      insertCard(card2.getValue(),2);
      insertCard(card3.getValue(),3);
      insertCard(card4.getValue(),4);
      insertCard(card5.getValue(),5);
      insertCard(card6.getValue(),6);
      insertCard(card7.getValue(),7);
    }
 catch (    NoSuchMethodException|IllegalArgumentException|InvocationTargetException ex) {
      Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
    }
    if (enableHints) {
      enableHints();
    }
 else {
      disableHints();
    }
    getMemory().configureActiveMemory();
    if (cheatEngine.getValue() == null) {
      if (activeCheatEngine != null) {
        activeCheatEngine.detach();
      }
      activeCheatEngine=null;
    }
 else {
      boolean startCheats=true;
      if (activeCheatEngine != null) {
        if (activeCheatEngine.getClass().equals(cheatEngine.getValue())) {
          startCheats=false;
        }
 else {
          activeCheatEngine.detach();
          activeCheatEngine=null;
        }
      }
      if (startCheats) {
        try {
          activeCheatEngine=(Cheats)cheatEngine.getValue().newInstance();
        }
 catch (        InstantiationException|IllegalAccessException ex) {
          Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
        }
        activeCheatEngine.attach();
      }
    }
  }
 catch (  IOException ex) {
    Logger.getLogger(Apple2e.class.getName()).log(Level.SEVERE,null,ex);
  }
  if (restart) {
    resume();
  }
}