Program: 8893
Project: 8893
Buggy source:
@Override public void setEnabled(boolean enabled){
  super.setEnabled(enabled);
  if (enabled) {
    final GameState gameState=stateManager.getState(GameState.class);
    if (!gameState.getLevelData().getGameLevel().getLvlFlags().contains(GameLevel.LevFlag.IS_SKIRMISH_LEVEL)) {
      String levelResource="String_Node_Str" + gameState.getLevel().toUpperCase();
      this.app.getNifty().getNifty().getResourceBundles().put("String_Node_Str",Main.getResourceBundle(levelResource));
    }
    int triggerId=gameState.getLevelData().getPlayer(playerId).getTriggerId();
    if (triggerId != 0) {
      triggerControl=new PlayerTriggerControl(stateManager,triggerId);
      triggerControl.setPlayerState(this);
    }
    nifty=app.getNifty().getNifty();
    nifty.gotoScreen(HUD_SCREEN_ID);
    initHudItems();
    app.getInputManager().setCursorVisible(true);
    Element middle=app.getNifty().getNifty().getScreen(HUD_SCREEN_ID).findElementByName("String_Node_Str");
    Rectangle guiConstraint=new Rectangle(middle.getX(),middle.getY(),middle.getWidth(),middle.getHeight());
    if (nifty != null) {
      paused=false;
      nifty.getScreen(HUD_SCREEN_ID).findElementByName("String_Node_Str").setVisible(paused);
    }
    Player player=gameState.getLevelData().getPlayer(playerId);
    possessionState=new PossessionInteractionState(true){
      @Override protected void onExit(){
        super.onExit();
        for (        AbstractAppState state : storedAppStates) {
          stateManager.detach(state);
        }
        for (        AbstractAppState state : appStates) {
          state.setEnabled(true);
        }
        nifty.gotoScreen(HUD_SCREEN_ID);
      }
      @Override protected void onActionChange(      PossessionInteractionState.Action action){
        PlayerState.this.updatePossessionSelectedItem(action);
      }
    }
;
    cameraState=new PlayerCameraState(player);
    interactionState=new PlayerInteractionState(player,gameState,guiConstraint,tooltip){
      @Override protected void onInteractionStateChange(      InteractionState interactionState,      int id){
        PlayerState.this.updateSelectedItem(interactionState,id);
      }
      @Override protected void onPossession(      Thing.KeeperCreature creature){
        for (        AbstractAppState state : appStates) {
          state.setEnabled(false);
        }
        storedAppStates=new ArrayList<>();
        storedAppStates.add(possessionState);
        possessionState.setTarget(creature);
        possessionCameraState=new PossessionCameraState(creature,gameState.getLevelData());
        storedAppStates.add(possessionCameraState);
        for (        AbstractAppState state : storedAppStates) {
          stateManager.attach(state);
        }
        nifty.gotoScreen(POSSESSION_SCREEN_ID);
      }
    }
;
    appStates.add(interactionState);
    appStates.add(cameraState);
    for (    AbstractAppState state : appStates) {
      stateManager.attach(state);
    }
  }
 else {
    for (    AbstractAppState state : appStates) {
      stateManager.detach(state);
    }
    appStates.clear();
    if (nifty != null) {
      nifty.gotoScreen("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void setEnabled(boolean enabled){
  super.setEnabled(enabled);
  if (enabled) {
    final GameState gameState=stateManager.getState(GameState.class);
    if (!gameState.getLevelData().getGameLevel().getLvlFlags().contains(GameLevel.LevFlag.IS_SKIRMISH_LEVEL)) {
      String levelResource="String_Node_Str" + gameState.getLevel().toUpperCase();
      try {
        this.app.getNifty().getNifty().getResourceBundles().put("String_Node_Str",Main.getResourceBundle(levelResource));
      }
 catch (      Exception ex) {
        logger.warning(ex.toString());
      }
    }
    int triggerId=gameState.getLevelData().getPlayer(playerId).getTriggerId();
    if (triggerId != 0) {
      triggerControl=new PlayerTriggerControl(stateManager,triggerId);
      triggerControl.setPlayerState(this);
    }
    nifty=app.getNifty().getNifty();
    nifty.gotoScreen(HUD_SCREEN_ID);
    initHudItems();
    app.getInputManager().setCursorVisible(true);
    Element middle=app.getNifty().getNifty().getScreen(HUD_SCREEN_ID).findElementByName("String_Node_Str");
    Rectangle guiConstraint=new Rectangle(middle.getX(),middle.getY(),middle.getWidth(),middle.getHeight());
    if (nifty != null) {
      paused=false;
      nifty.getScreen(HUD_SCREEN_ID).findElementByName("String_Node_Str").setVisible(paused);
    }
    Player player=gameState.getLevelData().getPlayer(playerId);
    possessionState=new PossessionInteractionState(true){
      @Override protected void onExit(){
        super.onExit();
        for (        AbstractAppState state : storedAppStates) {
          stateManager.detach(state);
        }
        for (        AbstractAppState state : appStates) {
          state.setEnabled(true);
        }
        nifty.gotoScreen(HUD_SCREEN_ID);
      }
      @Override protected void onActionChange(      PossessionInteractionState.Action action){
        PlayerState.this.updatePossessionSelectedItem(action);
      }
    }
;
    cameraState=new PlayerCameraState(player);
    interactionState=new PlayerInteractionState(player,gameState,guiConstraint,tooltip){
      @Override protected void onInteractionStateChange(      InteractionState interactionState,      int id){
        PlayerState.this.updateSelectedItem(interactionState,id);
      }
      @Override protected void onPossession(      Thing.KeeperCreature creature){
        for (        AbstractAppState state : appStates) {
          state.setEnabled(false);
        }
        storedAppStates=new ArrayList<>();
        storedAppStates.add(possessionState);
        possessionState.setTarget(creature);
        possessionCameraState=new PossessionCameraState(creature,gameState.getLevelData());
        storedAppStates.add(possessionCameraState);
        for (        AbstractAppState state : storedAppStates) {
          stateManager.attach(state);
        }
        nifty.gotoScreen(POSSESSION_SCREEN_ID);
      }
    }
;
    appStates.add(interactionState);
    appStates.add(cameraState);
    for (    AbstractAppState state : appStates) {
      stateManager.attach(state);
    }
  }
 else {
    for (    AbstractAppState state : appStates) {
      stateManager.detach(state);
    }
    appStates.clear();
    if (nifty != null) {
      nifty.gotoScreen("String_Node_Str");
    }
  }
}