Program: 27432
Project: 27432
Buggy source:
@MQTTMessage(message=ConnectMessage.class) void processConnect(ServerChannel session,ConnectMessage msg){
  LOG.debug("String_Node_Str",msg.getClientID());
  if (msg.getProcotolVersion() != VERSION_3_1 && msg.getProcotolVersion() != VERSION_3_1_1) {
    ConnAckMessage badProto=new ConnAckMessage();
    badProto.setReturnCode(ConnAckMessage.UNNACEPTABLE_PROTOCOL_VERSION);
    LOG.warn("String_Node_Str");
    session.write(badProto);
    session.close(false);
    return;
  }
  if (msg.getClientID() == null || msg.getClientID().length() > 23 || msg.getClientID().length() == 0) {
    ConnAckMessage okResp=new ConnAckMessage();
    okResp.setReturnCode(ConnAckMessage.IDENTIFIER_REJECTED);
    session.write(okResp);
    return;
  }
  if (m_clientIDs.containsKey(msg.getClientID())) {
    ServerChannel oldSession=m_clientIDs.get(msg.getClientID()).getSession();
    boolean cleanSession=(Boolean)oldSession.getAttribute(Constants.CLEAN_SESSION);
    if (cleanSession) {
      cleanSession(msg.getClientID());
    }
    m_clientIDs.get(msg.getClientID()).getSession().close(false);
    LOG.info("String_Node_Str",msg.getClientID());
  }
  ConnectionDescriptor connDescr=new ConnectionDescriptor(msg.getClientID(),session,msg.isCleanSession());
  m_clientIDs.put(msg.getClientID(),connDescr);
  int keepAlive=msg.getKeepAlive();
  LOG.debug("String_Node_Str",keepAlive);
  session.setAttribute(Constants.KEEP_ALIVE,keepAlive);
  session.setAttribute(Constants.CLEAN_SESSION,msg.isCleanSession());
  session.setAttribute(Constants.ATTR_CLIENTID,msg.getClientID());
  session.setIdleTime(Math.round(keepAlive * 1.5f));
  if (msg.isWillFlag()) {
    AbstractMessage.QOSType willQos=AbstractMessage.QOSType.values()[msg.getWillQos()];
    byte[] willPayload=msg.getWillMessage().getBytes();
    ByteBuffer bb=(ByteBuffer)ByteBuffer.allocate(willPayload.length).put(willPayload).flip();
    WillMessage will=new WillMessage(msg.getWillTopic(),bb,msg.isWillRetain(),willQos);
    m_willStore.put(msg.getClientID(),will);
  }
  if (msg.isUserFlag()) {
    String pwd=null;
    if (msg.isPasswordFlag()) {
      pwd=msg.getPassword();
    }
    if (!m_authenticator.checkValid(msg.getUsername(),pwd)) {
      ConnAckMessage okResp=new ConnAckMessage();
      okResp.setReturnCode(ConnAckMessage.BAD_USERNAME_OR_PASSWORD);
      session.write(okResp);
      return;
    }
  }
  subscriptions.activate(msg.getClientID());
  if (msg.isCleanSession()) {
    cleanSession(msg.getClientID());
  }
  ConnAckMessage okResp=new ConnAckMessage();
  okResp.setReturnCode(ConnAckMessage.CONNECTION_ACCEPTED);
  if (!msg.isCleanSession() && m_sessionsStore.contains(msg.getClientID())) {
    okResp.setSessionPresent(true);
  }
  LOG.debug("String_Node_Str");
  session.write(okResp);
  LOG.info("String_Node_Str",msg.getClientID(),msg.isCleanSession());
  LOG.info("String_Node_Str",msg.getClientID());
  m_sessionsStore.addNewSubscription(Subscription.createEmptySubscription(msg.getClientID(),true),msg.getClientID());
  if (!msg.isCleanSession()) {
    republishStored(msg.getClientID());
  }
}

Fixed version (ground truth):
@MQTTMessage(message=ConnectMessage.class) void processConnect(ServerChannel session,ConnectMessage msg){
  LOG.debug("String_Node_Str",msg.getClientID());
  if (msg.getProcotolVersion() != VERSION_3_1 && msg.getProcotolVersion() != VERSION_3_1_1) {
    ConnAckMessage badProto=new ConnAckMessage();
    badProto.setReturnCode(ConnAckMessage.UNNACEPTABLE_PROTOCOL_VERSION);
    LOG.warn("String_Node_Str");
    session.write(badProto);
    session.close(false);
    return;
  }
  if (msg.getClientID() == null || msg.getClientID().length() > 23 || msg.getClientID().length() == 0) {
    ConnAckMessage okResp=new ConnAckMessage();
    okResp.setReturnCode(ConnAckMessage.IDENTIFIER_REJECTED);
    session.write(okResp);
    return;
  }
  if (m_clientIDs.containsKey(msg.getClientID())) {
    LOG.info("String_Node_Str",msg.getClientID());
    ServerChannel oldSession=m_clientIDs.get(msg.getClientID()).getSession();
    boolean cleanSession=(Boolean)oldSession.getAttribute(Constants.CLEAN_SESSION);
    if (cleanSession) {
      cleanSession(msg.getClientID());
    }
    oldSession.close(false);
    LOG.debug("String_Node_Str",msg.getClientID());
  }
  ConnectionDescriptor connDescr=new ConnectionDescriptor(msg.getClientID(),session,msg.isCleanSession());
  m_clientIDs.put(msg.getClientID(),connDescr);
  int keepAlive=msg.getKeepAlive();
  LOG.debug("String_Node_Str",keepAlive);
  session.setAttribute(Constants.KEEP_ALIVE,keepAlive);
  session.setAttribute(Constants.CLEAN_SESSION,msg.isCleanSession());
  session.setAttribute(Constants.ATTR_CLIENTID,msg.getClientID());
  session.setIdleTime(Math.round(keepAlive * 1.5f));
  if (msg.isWillFlag()) {
    AbstractMessage.QOSType willQos=AbstractMessage.QOSType.values()[msg.getWillQos()];
    byte[] willPayload=msg.getWillMessage().getBytes();
    ByteBuffer bb=(ByteBuffer)ByteBuffer.allocate(willPayload.length).put(willPayload).flip();
    WillMessage will=new WillMessage(msg.getWillTopic(),bb,msg.isWillRetain(),willQos);
    m_willStore.put(msg.getClientID(),will);
  }
  if (msg.isUserFlag()) {
    String pwd=null;
    if (msg.isPasswordFlag()) {
      pwd=msg.getPassword();
    }
    if (!m_authenticator.checkValid(msg.getUsername(),pwd)) {
      ConnAckMessage okResp=new ConnAckMessage();
      okResp.setReturnCode(ConnAckMessage.BAD_USERNAME_OR_PASSWORD);
      session.write(okResp);
      return;
    }
  }
  subscriptions.activate(msg.getClientID());
  if (msg.isCleanSession()) {
    cleanSession(msg.getClientID());
  }
  ConnAckMessage okResp=new ConnAckMessage();
  okResp.setReturnCode(ConnAckMessage.CONNECTION_ACCEPTED);
  if (!msg.isCleanSession() && m_sessionsStore.contains(msg.getClientID())) {
    okResp.setSessionPresent(true);
  }
  LOG.debug("String_Node_Str");
  session.write(okResp);
  LOG.info("String_Node_Str",msg.getClientID(),msg.isCleanSession());
  LOG.info("String_Node_Str",msg.getClientID());
  m_sessionsStore.addNewSubscription(Subscription.createEmptySubscription(msg.getClientID(),true),msg.getClientID());
  if (!msg.isCleanSession()) {
    republishStored(msg.getClientID());
  }
}