Program: 104313
Project: 104313
Buggy source:
public void handleStateChange(StateEvent event){
  State newState=event.getNewState();
  State oldState=event.getOldState();
  AimConnection conn=event.getAimConnection();
  logger.debug("String_Node_Str" + getProtocolName() + "String_Node_Str"+ oldState+ "String_Node_Str"+ newState);
  int reasonCode=RegistrationStateChangeEvent.REASON_NOT_SPECIFIED;
  String reasonStr=null;
  if (newState == State.ONLINE) {
    icbmService=conn.getIcbmService();
    icbmService.addIcbmListener(aimIcbmListener);
    conn.getInfoService().getOscarConnection().getSnacProcessor().getFlapProcessor().addPacketListener(new ConnectionClosedListener(conn));
  }
 else   if (newState == State.DISCONNECTED) {
    Service service=aimConnection.getBosService();
    if (service != null) {
      int discconectCode=service.getOscarConnection().getLastCloseCode();
      reasonCode=ConnectionClosedListener.convertCodeToRegistrationStateChangeEvent(discconectCode);
      reasonStr=ConnectionClosedListener.convertCodeToStringReason(discconectCode);
      logger.debug("String_Node_Str" + reasonStr);
    }
 else     logger.debug("String_Node_Str");
  }
 else   if (newState == State.FAILED) {
    logger.debug("String_Node_Str" + event.getNewStateInfo());
  }
  if (event.getNewStateInfo() instanceof LoginFailureStateInfo) {
    LoginFailureInfo loginFailure=((LoginFailureStateInfo)event.getNewStateInfo()).getLoginFailureInfo();
    if (loginFailure instanceof AuthFailureInfo) {
      AuthFailureInfo afi=(AuthFailureInfo)loginFailure;
      logger.debug("String_Node_Str" + afi.getErrorCode());
      int code=ConnectionClosedListener.convertAuthCodeToReasonCode(afi);
      reasonCode=ConnectionClosedListener.convertCodeToRegistrationStateChangeEvent(code);
      reasonStr=ConnectionClosedListener.convertCodeToStringReason(code);
    }
  }
  if (reasonCode == RegistrationStateChangeEvent.REASON_AUTHENTICATION_FAILED) {
    if (USING_ICQ)     IcqActivator.getIcqProtocolProviderFactory().storePassword(getAccountID(),null);
 else     IcqActivator.getAimProtocolProviderFactory().storePassword(getAccountID(),null);
    reconnect(SecurityAuthority.WRONG_PASSWORD);
  }
  fireRegistrationStateChanged(oldState,event.getOldStateInfo(),newState,event.getNewStateInfo(),reasonCode,reasonStr);
}

Fixed version (ground truth):
public void handleStateChange(StateEvent event){
  State newState=event.getNewState();
  State oldState=event.getOldState();
  AimConnection conn=event.getAimConnection();
  logger.debug("String_Node_Str" + getProtocolName() + "String_Node_Str"+ oldState+ "String_Node_Str"+ newState);
  int reasonCode=RegistrationStateChangeEvent.REASON_NOT_SPECIFIED;
  String reasonStr=null;
  if (newState == State.ONLINE) {
    icbmService=conn.getIcbmService();
    icbmService.addIcbmListener(aimIcbmListener);
    conn.getInfoService().getOscarConnection().getSnacProcessor().getFlapProcessor().addPacketListener(new ConnectionClosedListener(conn));
  }
 else   if (newState == State.DISCONNECTED) {
    Service service=aimConnection.getBosService();
    if (service != null) {
      int discconectCode=service.getOscarConnection().getLastCloseCode();
      reasonCode=ConnectionClosedListener.convertCodeToRegistrationStateChangeEvent(discconectCode);
      reasonStr=ConnectionClosedListener.convertCodeToStringReason(discconectCode);
      logger.debug("String_Node_Str" + reasonStr);
    }
 else     logger.debug("String_Node_Str");
  }
 else   if (newState == State.FAILED) {
    logger.debug("String_Node_Str" + event.getNewStateInfo());
  }
  if (event.getNewStateInfo() instanceof LoginFailureStateInfo) {
    LoginFailureInfo loginFailure=((LoginFailureStateInfo)event.getNewStateInfo()).getLoginFailureInfo();
    if (loginFailure instanceof AuthFailureInfo) {
      AuthFailureInfo afi=(AuthFailureInfo)loginFailure;
      logger.debug("String_Node_Str" + afi.getErrorCode());
      int code=ConnectionClosedListener.convertAuthCodeToReasonCode(afi);
      reasonCode=ConnectionClosedListener.convertCodeToRegistrationStateChangeEvent(code);
      reasonStr=ConnectionClosedListener.convertCodeToStringReason(code);
    }
  }
  if (reasonCode == RegistrationStateChangeEvent.REASON_AUTHENTICATION_FAILED) {
    if (USING_ICQ)     IcqActivator.getIcqProtocolProviderFactory().storePassword(getAccountID(),null);
 else     IcqActivator.getAimProtocolProviderFactory().storePassword(getAccountID(),null);
    reconnect(SecurityAuthority.WRONG_PASSWORD);
  }
  if (newState == State.ONLINE) {
    new RegisteredEventThread().start();
  }
 else {
    fireRegistrationStateChanged(oldState,event.getOldStateInfo(),newState,event.getNewStateInfo(),reasonCode,reasonStr);
  }
}