Program: 12844
Project: 12844
Buggy source:
@Override public final void reconfigure(){
  boolean restart=pause();
  super.reconfigure();
  RAM128k currentMemory=(RAM128k)getMemory();
  if (currentMemory != null && ramCard.getValue() != 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();
  if (motherboard != null) {
    if (joy1enabled) {
      if (joystick1 == null) {
        joystick1=new Joystick(0,this);
        motherboard.miscDevices.add(joystick1);
        joystick1.attach();
      }
    }
 else     if (joystick1 != null) {
      joystick1.detach();
      motherboard.miscDevices.remove(joystick1);
      joystick1=null;
    }
    if (joy2enabled) {
      if (joystick2 == null) {
        joystick2=new Joystick(1,this);
        motherboard.miscDevices.add(joystick2);
        joystick2.attach();
      }
    }
 else     if (joystick2 != null) {
      joystick2.detach();
      motherboard.miscDevices.remove(joystick2);
      joystick2=null;
    }
    if (clockEnabled) {
      if (clock == null) {
        clock=new NoSlotClock(this);
        motherboard.miscDevices.add(clock);
        clock.attach();
      }
    }
 else     if (clock != null) {
      motherboard.miscDevices.remove(clock);
      clock.detach();
      clock=null;
    }
  }
  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()) {
      if (getVideo() != null) {
        getVideo().suspend();
      }
      try {
        setVideo((Video)videoRenderer.getValue().getConstructor(Computer.class).newInstance(this));
        getVideo().configureVideoMode();
        getVideo().reconfigure();
        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();
  }
}

Fixed version (ground truth):
@Override public final void reconfigure(){
  boolean restart=pause();
  super.reconfigure();
  RAM128k currentMemory=(RAM128k)getMemory();
  if (currentMemory != null && ramCard.getValue() != 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();
  if (motherboard != null) {
    if (joy1enabled) {
      if (joystick1 == null) {
        joystick1=new Joystick(0,this);
        motherboard.miscDevices.add(joystick1);
        joystick1.attach();
      }
    }
 else     if (joystick1 != null) {
      joystick1.detach();
      motherboard.miscDevices.remove(joystick1);
      joystick1=null;
    }
    if (joy2enabled) {
      if (joystick2 == null) {
        joystick2=new Joystick(1,this);
        motherboard.miscDevices.add(joystick2);
        joystick2.attach();
      }
    }
 else     if (joystick2 != null) {
      joystick2.detach();
      motherboard.miscDevices.remove(joystick2);
      joystick2=null;
    }
    if (clockEnabled) {
      if (clock == null) {
        clock=new NoSlotClock(this);
        motherboard.miscDevices.add(clock);
        clock.attach();
      }
    }
 else     if (clock != null) {
      motherboard.miscDevices.remove(clock);
      clock.detach();
      clock=null;
    }
  }
  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()) {
      if (getVideo() != null) {
        getVideo().suspend();
      }
      try {
        setVideo((Video)videoRenderer.getValue().getConstructor(Computer.class).newInstance(this));
        getVideo().configureVideoMode();
        getVideo().reconfigure();
        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().getConstructor(Computer.class).newInstance(this);
        }
 catch (        InstantiationException|IllegalAccessException|NoSuchMethodException|SecurityException|IllegalArgumentException|InvocationTargetException 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();
  }
}