nus-yam/ex-repair huggingface dataset:
Program: 27405
Project: 27405
Buggy source:
private void initializeSSLTCPTransport(IMessaging messaging,IConfig props,final SslHandler sslHandler) throws IOException {
  String sslPortProp=props.getProperty(Constants.SSL_PORT_PROPERTY_NAME);
  if (sslPortProp == null) {
    LOG.info("String_Node_Str");
    return;
  }
  int sslPort=Integer.parseInt(sslPortProp);
  LOG.info("String_Node_Str",sslPort);
  final NettyMQTTHandler handler=new NettyMQTTHandler();
  handler.setMessaging(messaging);
  String host=props.getProperty(Constants.HOST_PROPERTY_NAME);
  initFactory(host,sslPort,new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline) throws Exception {
      pipeline.addLast("String_Node_Str",sslHandler);
      pipeline.addFirst("String_Node_Str",new IdleStateHandler(0,0,Constants.DEFAULT_CONNECT_TIMEOUT));
      pipeline.addAfter("String_Node_Str","String_Node_Str",new MoquetteIdleTimoutHandler());
      pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
      pipeline.addLast("String_Node_Str",new MQTTDecoder());
      pipeline.addLast("String_Node_Str",new MQTTEncoder());
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}

Fixed version (ground truth):
private void initializeSSLTCPTransport(IMessaging messaging,IConfig props,final SslHandlerFactory sslHandlerFactory) throws IOException {
  String sslPortProp=props.getProperty(Constants.SSL_PORT_PROPERTY_NAME);
  if (sslPortProp == null) {
    LOG.info("String_Node_Str");
    return;
  }
  int sslPort=Integer.parseInt(sslPortProp);
  LOG.info("String_Node_Str",sslPort);
  final NettyMQTTHandler handler=new NettyMQTTHandler();
  handler.setMessaging(messaging);
  String host=props.getProperty(Constants.HOST_PROPERTY_NAME);
  initFactory(host,sslPort,new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline) throws Exception {
      pipeline.addLast("String_Node_Str",sslHandlerFactory.create());
      pipeline.addFirst("String_Node_Str",new IdleStateHandler(0,0,Constants.DEFAULT_CONNECT_TIMEOUT));
      pipeline.addAfter("String_Node_Str","String_Node_Str",new MoquetteIdleTimoutHandler());
      pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
      pipeline.addLast("String_Node_Str",new MQTTDecoder());
      pipeline.addLast("String_Node_Str",new MQTTEncoder());
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}
Program: 27406
Project: 27406
Buggy source:
@Override public void initialize(IMessaging messaging,IConfig props) throws IOException {
  m_bossGroup=new NioEventLoopGroup();
  m_workerGroup=new NioEventLoopGroup();
  initializePlainTCPTransport(messaging,props);
  initializeWebSocketTransport(messaging,props);
  String sslTcpPortProp=props.getProperty(Constants.SSL_PORT_PROPERTY_NAME);
  String wssPortProp=props.getProperty(Constants.WSS_PORT_PROPERTY_NAME);
  if (sslTcpPortProp != null || wssPortProp != null) {
    SslHandler sslHandler=initSSLHandler(props);
    if (sslHandler == null) {
      LOG.error("String_Node_Str");
      return;
    }
    initializeSSLTCPTransport(messaging,props,sslHandler);
    initializeWSSTransport(messaging,props,sslHandler);
  }
}

Fixed version (ground truth):
@Override public void initialize(IMessaging messaging,IConfig props) throws IOException {
  m_bossGroup=new NioEventLoopGroup();
  m_workerGroup=new NioEventLoopGroup();
  initializePlainTCPTransport(messaging,props);
  initializeWebSocketTransport(messaging,props);
  String sslTcpPortProp=props.getProperty(Constants.SSL_PORT_PROPERTY_NAME);
  String wssPortProp=props.getProperty(Constants.WSS_PORT_PROPERTY_NAME);
  if (sslTcpPortProp != null || wssPortProp != null) {
    SslHandlerFactory sslHandlerFactory=initSSLHandlerFactory(props);
    if (!sslHandlerFactory.canCreate()) {
      LOG.error("String_Node_Str");
      return;
    }
    initializeSSLTCPTransport(messaging,props,sslHandlerFactory);
    initializeWSSTransport(messaging,props,sslHandlerFactory);
  }
}
Program: 27407
Project: 27407
Buggy source:
@Override void init(ChannelPipeline pipeline) throws Exception {
  pipeline.addLast("String_Node_Str",sslHandler);
  pipeline.addFirst("String_Node_Str",new IdleStateHandler(0,0,Constants.DEFAULT_CONNECT_TIMEOUT));
  pipeline.addAfter("String_Node_Str","String_Node_Str",new MoquetteIdleTimoutHandler());
  pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
  pipeline.addLast("String_Node_Str",new MQTTDecoder());
  pipeline.addLast("String_Node_Str",new MQTTEncoder());
  pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
  pipeline.addLast("String_Node_Str",handler);
}

Fixed version (ground truth):
@Override void init(ChannelPipeline pipeline) throws Exception {
  pipeline.addLast("String_Node_Str",sslHandler);
  pipeline.addLast("String_Node_Str",new HttpResponseEncoder());
  pipeline.addLast("String_Node_Str",new HttpRequestDecoder());
  pipeline.addLast("String_Node_Str",new HttpObjectAggregator(65536));
  pipeline.addLast("String_Node_Str",new WebSocketServerProtocolHandler("String_Node_Str","String_Node_Str"));
  pipeline.addLast("String_Node_Str",new WebSocketFrameToByteBufDecoder());
  pipeline.addLast("String_Node_Str",new ByteBufToWebSocketFrameEncoder());
  pipeline.addFirst("String_Node_Str",new IdleStateHandler(0,0,Constants.DEFAULT_CONNECT_TIMEOUT));
  pipeline.addAfter("String_Node_Str","String_Node_Str",new MoquetteIdleTimoutHandler());
  pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
  pipeline.addLast("String_Node_Str",new MQTTDecoder());
  pipeline.addLast("String_Node_Str",new MQTTEncoder());
  pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
  pipeline.addLast("String_Node_Str",handler);
}
Program: 27408
Project: 27408
Buggy source:
private SslHandler initSSLHandler(int sslPort,Properties props){
  final String jksPath=props.getProperty(Constants.JKS_PATH_PROPERTY_NAME);
  LOG.info("String_Node_Str",sslPort,jksPath);
  if (jksPath == null || jksPath.isEmpty()) {
    LOG.warn("String_Node_Str");
    return null;
  }
  final String keyStorePassword=props.getProperty(Constants.KEY_STORE_PASSWORD_PROPERTY_NAME);
  final String keyManagerPassword=props.getProperty(Constants.KEY_MANAGER_PASSWORD_PROPERTY_NAME);
  if (keyStorePassword == null || keyStorePassword.isEmpty()) {
    LOG.warn("String_Node_Str");
    return null;
  }
  if (keyManagerPassword == null || keyManagerPassword.isEmpty()) {
    LOG.warn("String_Node_Str");
    return null;
  }
  LOG.info("String_Node_Str",sslPort,jksPath);
  try {
    InputStream jksInputStream=jksDatastore(jksPath);
    SSLContext serverContext=SSLContext.getInstance("String_Node_Str");
    final KeyStore ks=KeyStore.getInstance("String_Node_Str");
    ks.load(jksInputStream,keyStorePassword.toCharArray());
    final KeyManagerFactory kmf=KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
    kmf.init(ks,keyManagerPassword.toCharArray());
    serverContext.init(kmf.getKeyManagers(),null,null);
    SSLEngine engine=serverContext.createSSLEngine();
    engine.setUseClientMode(false);
    return new SslHandler(engine);
  }
 catch (  NoSuchAlgorithmException|UnrecoverableKeyException|CertificateException|KeyStoreException|KeyManagementException|IOException ex) {
    LOG.error("String_Node_Str",ex);
    return null;
  }
}

Fixed version (ground truth):
private SslHandler initSSLHandler(Properties props){
  final String jksPath=props.getProperty(Constants.JKS_PATH_PROPERTY_NAME);
  LOG.info("String_Node_Str",jksPath);
  if (jksPath == null || jksPath.isEmpty()) {
    LOG.warn("String_Node_Str");
    return null;
  }
  final String keyStorePassword=props.getProperty(Constants.KEY_STORE_PASSWORD_PROPERTY_NAME);
  final String keyManagerPassword=props.getProperty(Constants.KEY_MANAGER_PASSWORD_PROPERTY_NAME);
  if (keyStorePassword == null || keyStorePassword.isEmpty()) {
    LOG.warn("String_Node_Str");
    return null;
  }
  if (keyManagerPassword == null || keyManagerPassword.isEmpty()) {
    LOG.warn("String_Node_Str");
    return null;
  }
  try {
    InputStream jksInputStream=jksDatastore(jksPath);
    SSLContext serverContext=SSLContext.getInstance("String_Node_Str");
    final KeyStore ks=KeyStore.getInstance("String_Node_Str");
    ks.load(jksInputStream,keyStorePassword.toCharArray());
    final KeyManagerFactory kmf=KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
    kmf.init(ks,keyManagerPassword.toCharArray());
    serverContext.init(kmf.getKeyManagers(),null,null);
    SSLEngine engine=serverContext.createSSLEngine();
    engine.setUseClientMode(false);
    return new SslHandler(engine);
  }
 catch (  NoSuchAlgorithmException|UnrecoverableKeyException|CertificateException|KeyStoreException|KeyManagementException|IOException ex) {
    LOG.error("String_Node_Str",ex);
    return null;
  }
}
Program: 27409
Project: 27409
Buggy source:
private void initializeSSLTCPTransport(IMessaging messaging,Properties props) throws IOException {
  String sslPortProp=props.getProperty(Constants.SSL_PORT_PROPERTY_NAME);
  if (sslPortProp == null) {
    LOG.info("String_Node_Str");
    return;
  }
  int sslPort=Integer.parseInt(sslPortProp);
  final SslHandler sslHandler=initSSLHandler(sslPort,props);
  if (sslHandler == null) {
    LOG.error("String_Node_Str");
    return;
  }
  final NettyMQTTHandler handler=new NettyMQTTHandler();
  handler.setMessaging(messaging);
  String host=props.getProperty(Constants.HOST_PROPERTY_NAME);
  initFactory(host,sslPort,new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline) throws Exception {
      pipeline.addLast("String_Node_Str",sslHandler);
      pipeline.addFirst("String_Node_Str",new IdleStateHandler(0,0,Constants.DEFAULT_CONNECT_TIMEOUT));
      pipeline.addAfter("String_Node_Str","String_Node_Str",new MoquetteIdleTimoutHandler());
      pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
      pipeline.addLast("String_Node_Str",new MQTTDecoder());
      pipeline.addLast("String_Node_Str",new MQTTEncoder());
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}

Fixed version (ground truth):
private void initializeSSLTCPTransport(IMessaging messaging,Properties props,final SslHandler sslHandler) throws IOException {
  String sslPortProp=props.getProperty(Constants.SSL_PORT_PROPERTY_NAME);
  if (sslPortProp == null) {
    LOG.info("String_Node_Str");
    return;
  }
  int sslPort=Integer.parseInt(sslPortProp);
  LOG.info("String_Node_Str",sslPort);
  final NettyMQTTHandler handler=new NettyMQTTHandler();
  handler.setMessaging(messaging);
  String host=props.getProperty(Constants.HOST_PROPERTY_NAME);
  initFactory(host,sslPort,new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline) throws Exception {
      pipeline.addLast("String_Node_Str",sslHandler);
      pipeline.addFirst("String_Node_Str",new IdleStateHandler(0,0,Constants.DEFAULT_CONNECT_TIMEOUT));
      pipeline.addAfter("String_Node_Str","String_Node_Str",new MoquetteIdleTimoutHandler());
      pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
      pipeline.addLast("String_Node_Str",new MQTTDecoder());
      pipeline.addLast("String_Node_Str",new MQTTEncoder());
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}
Program: 27410
Project: 27410
Buggy source:
@Override public void initialize(IMessaging messaging,Properties props) throws IOException {
  m_bossGroup=new NioEventLoopGroup();
  m_workerGroup=new NioEventLoopGroup();
  initializePlainTCPTransport(messaging,props);
  initializeWebSocketTransport(messaging,props);
  initializeSSLTCPTransport(messaging,props);
}

Fixed version (ground truth):
@Override public void initialize(IMessaging messaging,Properties props) throws IOException {
  m_bossGroup=new NioEventLoopGroup();
  m_workerGroup=new NioEventLoopGroup();
  initializePlainTCPTransport(messaging,props);
  initializeWebSocketTransport(messaging,props);
  String sslTcpPortProp=props.getProperty(Constants.SSL_PORT_PROPERTY_NAME);
  String wssPortProp=props.getProperty(Constants.WSS_PORT_PROPERTY_NAME);
  if (sslTcpPortProp != null || wssPortProp != null) {
    SslHandler sslHandler=initSSLHandler(props);
    if (sslHandler == null) {
      LOG.error("String_Node_Str");
      return;
    }
    initializeSSLTCPTransport(messaging,props,sslHandler);
    initializeWSSTransport(messaging,props,sslHandler);
  }
}
Program: 27411
Project: 27411
Buggy source:
void removeMessageInSession(String clientID,int packetID);

Fixed version (ground truth):
void removeMessageInSession(String clientID,Integer packetID);
Program: 27412
Project: 27412
Buggy source:
@Override public void removeMessageInSession(String clientID,int messageID){
  List<PublishEvent> events=m_persistentMessageStore.get(clientID);
  PublishEvent toRemoveEvt=null;
  for (  PublishEvent evt : events) {
    if (evt.getMessageID() == messageID) {
      toRemoveEvt=evt;
    }
  }
  events.remove(toRemoveEvt);
  m_persistentMessageStore.put(clientID,events);
}

Fixed version (ground truth):
@Override public void removeMessageInSession(String clientID,Integer messageID){
  List<PublishEvent> events=m_persistentMessageStore.get(clientID);
  PublishEvent toRemoveEvt=null;
  for (  PublishEvent evt : events) {
    if (evt.getMessageID() == null && messageID == null) {
      toRemoveEvt=evt;
    }
    if (evt.getMessageID() == messageID) {
      toRemoveEvt=evt;
    }
  }
  events.remove(toRemoveEvt);
  m_persistentMessageStore.put(clientID,events);
}
Program: 27414
Project: 27414
Buggy source:
public int getMessageID(){
  return m_msgID;
}

Fixed version (ground truth):
public Integer getMessageID(){
  return m_msgID;
}
Program: 27415
Project: 27415
Buggy source:
public int getMessageID(){
  return m_msgID;
}

Fixed version (ground truth):
public Integer getMessageID(){
  return m_msgID;
}
Program: 27416
Project: 27416
Buggy source:
@Override public void removeMessageInSession(String clientID,int messageID){
  List<StoredPublishEvent> events=m_persistentMessageStore.get(clientID);
  if (events == null) {
    return;
  }
  StoredPublishEvent toRemoveEvt=null;
  for (  StoredPublishEvent evt : events) {
    if (evt.getMessageID() == messageID) {
      toRemoveEvt=evt;
    }
  }
  events.remove(toRemoveEvt);
  m_persistentMessageStore.put(clientID,events);
  m_db.commit();
}

Fixed version (ground truth):
@Override public void removeMessageInSession(String clientID,Integer messageID){
  List<StoredPublishEvent> events=m_persistentMessageStore.get(clientID);
  if (events == null) {
    return;
  }
  StoredPublishEvent toRemoveEvt=null;
  for (  StoredPublishEvent evt : events) {
    if (evt.getMessageID() == null && messageID == null) {
      toRemoveEvt=evt;
    }
    if (evt.getMessageID() == messageID) {
      toRemoveEvt=evt;
    }
  }
  events.remove(toRemoveEvt);
  m_persistentMessageStore.put(clientID,events);
  m_db.commit();
}
Program: 27417
Project: 27417
Buggy source:
public BytesMetrics computeMetrics(){
  BytesMetrics allMetrics=new BytesMetrics();
  for (  BytesMetrics m : m_allMetrics) {
    allMetrics.incrementRead(m.readBytes());
    allMetrics.incrementWrote(m.wroteBytes());
  }
  return allMetrics;
}

Fixed version (ground truth):
public BytesMetrics computeMetrics(){
  BytesMetrics allMetrics=new BytesMetrics();
  allMetrics.incrementRead(readBytes.get());
  allMetrics.incrementWrote(wroteBytes.get());
  return allMetrics;
}
Program: 27418
Project: 27418
Buggy source:
@Override public void close(ChannelHandlerContext ctx,ChannelPromise promise) throws Exception {
  BytesMetrics metrics=ctx.attr(ATTR_KEY_METRICS).get();
  m_collector.addMetrics(metrics);
  super.close(ctx,promise);
}

Fixed version (ground truth):
@Override public void close(ChannelHandlerContext ctx,ChannelPromise promise) throws Exception {
  BytesMetrics metrics=ctx.attr(ATTR_KEY_METRICS).get();
  m_collector.sumReadBytes(metrics.readBytes());
  m_collector.sumWroteBytes(metrics.wroteBytes());
  super.close(ctx,promise);
}
Program: 27419
Project: 27419
Buggy source:
public MessageMetrics computeMetrics(){
  MessageMetrics allMetrics=new MessageMetrics();
  for (  MessageMetrics m : m_allMetrics) {
    allMetrics.incrementRead(m.messagesRead());
    allMetrics.incrementWrote(m.messagesWrote());
  }
  return allMetrics;
}

Fixed version (ground truth):
public MessageMetrics computeMetrics(){
  MessageMetrics allMetrics=new MessageMetrics();
  allMetrics.incrementRead(readMsgs.get());
  allMetrics.incrementWrote(wroteMsgs.get());
  return allMetrics;
}
Program: 27420
Project: 27420
Buggy source:
@Override public void close(ChannelHandlerContext ctx,ChannelPromise promise) throws Exception {
  MessageMetrics metrics=ctx.attr(ATTR_KEY_METRICS).get();
  m_collector.addMetrics(metrics);
  super.close(ctx,promise);
}

Fixed version (ground truth):
@Override public void close(ChannelHandlerContext ctx,ChannelPromise promise) throws Exception {
  MessageMetrics metrics=ctx.attr(ATTR_KEY_METRICS).get();
  m_collector.sumReadMessages(metrics.messagesRead());
  m_collector.sumWroteMessages(metrics.messagesWrote());
  super.close(ctx,promise);
}
Program: 27421
Project: 27421
Buggy source:
@Override protected void encode(ChannelHandlerContext ctx,PublishMessage message,ByteBuf out){
  if (message.getQos() == AbstractMessage.QOSType.RESERVED) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (message.getTopicName() == null || message.getTopicName().isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ByteBuf variableHeaderBuff=ctx.alloc().buffer(2);
  try {
    variableHeaderBuff.writeBytes(Utils.encodeString(message.getTopicName()));
    if (message.getQos() == AbstractMessage.QOSType.LEAST_ONE || message.getQos() == AbstractMessage.QOSType.EXACTLY_ONCE) {
      if (message.getMessageID() == null) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      variableHeaderBuff.writeShort(message.getMessageID());
    }
    variableHeaderBuff.writeBytes(message.getPayload());
    int variableHeaderSize=variableHeaderBuff.readableBytes();
    byte flags=Utils.encodeFlags(message);
    ByteBuf buff=ctx.alloc().buffer(2 + variableHeaderSize);
    buff.writeByte(AbstractMessage.PUBLISH << 4 | flags);
    buff.writeBytes(Utils.encodeRemainingLength(variableHeaderSize));
    buff.writeBytes(variableHeaderBuff);
    out.writeBytes(buff);
  }
  finally {
    variableHeaderBuff.release();
  }
}

Fixed version (ground truth):
@Override protected void encode(ChannelHandlerContext ctx,PublishMessage message,ByteBuf out){
  if (message.getQos() == AbstractMessage.QOSType.RESERVED) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (message.getTopicName() == null || message.getTopicName().isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ByteBuf variableHeaderBuff=ctx.alloc().buffer(2);
  ByteBuf buff=null;
  try {
    variableHeaderBuff.writeBytes(Utils.encodeString(message.getTopicName()));
    if (message.getQos() == AbstractMessage.QOSType.LEAST_ONE || message.getQos() == AbstractMessage.QOSType.EXACTLY_ONCE) {
      if (message.getMessageID() == null) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      variableHeaderBuff.writeShort(message.getMessageID());
    }
    variableHeaderBuff.writeBytes(message.getPayload());
    int variableHeaderSize=variableHeaderBuff.readableBytes();
    byte flags=Utils.encodeFlags(message);
    buff=ctx.alloc().buffer(2 + variableHeaderSize);
    buff.writeByte(AbstractMessage.PUBLISH << 4 | flags);
    buff.writeBytes(Utils.encodeRemainingLength(variableHeaderSize));
    buff.writeBytes(variableHeaderBuff);
    out.writeBytes(buff);
  }
  finally {
    variableHeaderBuff.release();
    if (buff != null) {
      buff.release();
    }
  }
}
Program: 27422
Project: 27422
Buggy source:
/** 
 * Return the next valid packetIdentifer for the given client session.
 */
@Override public int nextPacketID(String clientID){
  Set<Integer> inFlightForClient=this.m_inFlightIds.get(clientID);
  if (inFlightForClient == null) {
    int nextPacketId=1;
    inFlightForClient=new HashSet<>();
    inFlightForClient.add(nextPacketId);
    this.m_inFlightIds.put(clientID,inFlightForClient);
    return nextPacketId;
  }
  int maxId=Collections.max(inFlightForClient);
  int nextPacketId=(maxId + 1) % 0xFFFF;
  inFlightForClient.add(nextPacketId);
  return nextPacketId;
}

Fixed version (ground truth):
/** 
 * Return the next valid packetIdentifier for the given client session.
 */
@Override public int nextPacketID(String clientID){
  Set<Integer> inFlightForClient=this.m_inFlightIds.get(clientID);
  if (inFlightForClient == null) {
    int nextPacketId=1;
    inFlightForClient=new HashSet<>();
    inFlightForClient.add(nextPacketId);
    this.m_inFlightIds.put(clientID,inFlightForClient);
    return nextPacketId;
  }
  int maxId=inFlightForClient.isEmpty() ? 0 : Collections.max(inFlightForClient);
  int nextPacketId=(maxId + 1) % 0xFFFF;
  inFlightForClient.add(nextPacketId);
  return nextPacketId;
}
Program: 27423
Project: 27423
Buggy source:
@Override public List<PublishEvent> retrievePersistedPublishes(String clientID){
  return m_persistentMessageStore.get(clientID);
}

Fixed version (ground truth):
@Override public List<PublishEvent> retrievePersistedPublishes(String clientID){
  return new ArrayList<>(m_persistentMessageStore.get(clientID));
}
Program: 27424
Project: 27424
Buggy source:
private void republishStored(String clientID){
  LOG.trace("String_Node_Str");
  List<PublishEvent> publishedEvents=m_messagesStore.retrievePersistedPublishes(clientID);
  if (publishedEvents == null) {
    LOG.info("String_Node_Str",clientID);
    return;
  }
  LOG.info("String_Node_Str",clientID);
  for (  PublishEvent pubEvt : publishedEvents) {
    sendPublish(pubEvt.getClientID(),pubEvt.getTopic(),pubEvt.getQos(),pubEvt.getMessage(),false,pubEvt.getMessageID());
  }
}

Fixed version (ground truth):
private void republishStored(String clientID){
  LOG.trace("String_Node_Str");
  List<PublishEvent> publishedEvents=m_messagesStore.retrievePersistedPublishes(clientID);
  if (publishedEvents == null) {
    LOG.info("String_Node_Str",clientID);
    return;
  }
  LOG.info("String_Node_Str",clientID);
  for (  PublishEvent pubEvt : publishedEvents) {
    sendPublish(pubEvt.getClientID(),pubEvt.getTopic(),pubEvt.getQos(),pubEvt.getMessage(),false,pubEvt.getMessageID());
    m_messagesStore.cleanPersistedPublishMessage(clientID,pubEvt.getMessageID());
  }
}
Program: 27425
Project: 27425
Buggy source:
public void removeQoS2Message(String publishKey){
  m_qos2Store.remove(publishKey);
}

Fixed version (ground truth):
public void removeQoS2Message(String publishKey){
  LOG.debug("String_Node_Str",publishKey);
  m_qos2Store.remove(publishKey);
}
Program: 27426
Project: 27426
Buggy source:
@Override public void onEvent(ValueEvent t,long l,boolean bln) throws Exception {
  MessagingEvent evt=t.getEvent();
  LOG.info("String_Node_Str",evt);
  if (evt instanceof StopEvent) {
    processStop();
    return;
  }
  if (evt instanceof LostConnectionEvent) {
    LostConnectionEvent lostEvt=(LostConnectionEvent)evt;
    m_processor.processConnectionLost(lostEvt);
    return;
  }
  if (evt instanceof ProtocolEvent) {
    ServerChannel session=((ProtocolEvent)evt).getSession();
    AbstractMessage message=((ProtocolEvent)evt).getMessage();
    annotationSupport.dispatch(session,message);
  }
}

Fixed version (ground truth):
@Override public void onEvent(ValueEvent t,long l,boolean bln) throws Exception {
  MessagingEvent evt=t.getEvent();
  LOG.info("String_Node_Str",evt);
  if (evt instanceof StopEvent) {
    processStop();
    return;
  }
  if (evt instanceof LostConnectionEvent) {
    LostConnectionEvent lostEvt=(LostConnectionEvent)evt;
    m_processor.processConnectionLost(lostEvt);
    return;
  }
  if (evt instanceof ProtocolEvent) {
    ServerChannel session=((ProtocolEvent)evt).getSession();
    AbstractMessage message=((ProtocolEvent)evt).getMessage();
    try {
      annotationSupport.dispatch(session,message);
    }
 catch (    Throwable th) {
      LOG.error("String_Node_Str",message,session,th);
    }
  }
}
Program: 27427
Project: 27427
Buggy source:
@Override protected void encode(ChannelHandlerContext chc,ByteBuf bb,List<Object> out) throws Exception {
  BinaryWebSocketFrame result=new BinaryWebSocketFrame(bb);
  out.add(bb);
}

Fixed version (ground truth):
@Override protected void encode(ChannelHandlerContext chc,ByteBuf bb,List<Object> out) throws Exception {
  BinaryWebSocketFrame result=new BinaryWebSocketFrame();
  System.out.println("String_Node_Str" + ByteBufUtil.hexDump(bb));
  result.content().writeBytes(bb);
  out.add(result);
}
Program: 27428
Project: 27428
Buggy source:
private void initializeWebSocketTransport(IMessaging messaging,Properties props) throws IOException {
  String webSocketPortProp=props.getProperty("String_Node_Str");
  if (webSocketPortProp == null) {
    LOG.info("String_Node_Str");
    return;
  }
  int port=Integer.parseInt(webSocketPortProp);
  final NettyMQTTHandler handler=new NettyMQTTHandler();
  handler.setMessaging(messaging);
  String host=props.getProperty("String_Node_Str");
  initFactory(host,port,new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline){
      pipeline.addLast("String_Node_Str",new HttpResponseEncoder());
      pipeline.addLast("String_Node_Str",new HttpRequestDecoder());
      pipeline.addLast("String_Node_Str",new HttpObjectAggregator(65536));
      pipeline.addLast("String_Node_Str",new WebSocketServerProtocolHandler("String_Node_Str","String_Node_Str"));
      pipeline.addLast("String_Node_Str",new ByteBufToWebSocketFrameEncoder());
      pipeline.addLast("String_Node_Str",new WebSocketFrameToByteBufDecoder());
      pipeline.addLast("String_Node_Str",new MQTTDecoder());
      pipeline.addLast("String_Node_Str",new MQTTEncoder());
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}

Fixed version (ground truth):
private void initializeWebSocketTransport(IMessaging messaging,Properties props) throws IOException {
  String webSocketPortProp=props.getProperty("String_Node_Str");
  if (webSocketPortProp == null) {
    LOG.info("String_Node_Str");
    return;
  }
  int port=Integer.parseInt(webSocketPortProp);
  final NettyMQTTHandler handler=new NettyMQTTHandler();
  handler.setMessaging(messaging);
  String host=props.getProperty("String_Node_Str");
  initFactory(host,port,new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline){
      pipeline.addLast("String_Node_Str",new HttpResponseEncoder());
      pipeline.addLast("String_Node_Str",new HttpRequestDecoder());
      pipeline.addLast("String_Node_Str",new HttpObjectAggregator(65536));
      pipeline.addLast("String_Node_Str",new WebSocketServerProtocolHandler("String_Node_Str","String_Node_Str"));
      pipeline.addLast("String_Node_Str",new WebSocketFrameToByteBufDecoder());
      pipeline.addLast("String_Node_Str",new ByteBufToWebSocketFrameEncoder());
      pipeline.addFirst("String_Node_Str",new IdleStateHandler(0,0,Constants.DEFAULT_CONNECT_TIMEOUT));
      pipeline.addAfter("String_Node_Str","String_Node_Str",new MoquetteIdleTimoutHandler());
      pipeline.addLast("String_Node_Str",new MQTTDecoder());
      pipeline.addLast("String_Node_Str",new MQTTEncoder());
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}
Program: 27429
Project: 27429
Buggy source:
@Override protected void decode(ChannelHandlerContext chc,BinaryWebSocketFrame frame,List<Object> out) throws Exception {
  ByteBuf bb=frame.content();
  out.add(bb);
}

Fixed version (ground truth):
@Override protected void decode(ChannelHandlerContext chc,BinaryWebSocketFrame frame,List<Object> out) throws Exception {
  ByteBuf bb=frame.content();
  System.out.println("String_Node_Str" + ByteBufUtil.hexDump(bb));
  bb.retain();
  out.add(bb);
}
Program: 27430
Project: 27430
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  NettyChannel channel=m_channelMapper.get(ctx);
  String clientID=(String)channel.getAttribute(Constants.ATTR_CLIENTID);
  m_messaging.lostConnection(clientID);
  ctx.close();
synchronized (m_channelMapper) {
    m_channelMapper.remove(ctx);
  }
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  NettyChannel channel=m_channelMapper.get(ctx);
  String clientID=(String)channel.getAttribute(Constants.ATTR_CLIENTID);
  m_messaging.lostConnection(channel,clientID);
  ctx.close();
synchronized (m_channelMapper) {
    m_channelMapper.remove(ctx);
  }
}
Program: 27431
Project: 27431
Buggy source:
void lostConnection(String clientID);

Fixed version (ground truth):
void lostConnection(ServerChannel session,String clientID);
Program: 27433
Project: 27433
Buggy source:
void processConnectionLost(String clientID){
  if (m_clientIDs.remove(clientID) != null) {
    subscriptions.deactivate(clientID);
    LOG.info("String_Node_Str",clientID);
  }
  if (m_willStore.containsKey(clientID)) {
    WillMessage will=m_willStore.get(clientID);
    processPublish(will,clientID);
    m_willStore.remove(clientID);
  }
}

Fixed version (ground truth):
void processConnectionLost(LostConnectionEvent evt){
  String clientID=evt.clientID;
  if (m_clientIDs.containsKey(clientID)) {
    if (!m_clientIDs.get(clientID).getSession().equals(evt.session)) {
      LOG.info("String_Node_Str",clientID);
      return;
    }
  }
  if (m_clientIDs.remove(clientID) != null) {
    subscriptions.deactivate(clientID);
    LOG.info("String_Node_Str",clientID);
  }
  if (m_willStore.containsKey(clientID)) {
    WillMessage will=m_willStore.get(clientID);
    processPublish(will,clientID);
    m_willStore.remove(clientID);
  }
}
Program: 27434
Project: 27434
Buggy source:
@Override public void lostConnection(String clientID){
  disruptorPublish(new LostConnectionEvent(clientID));
}

Fixed version (ground truth):
@Override public void lostConnection(ServerChannel session,String clientID){
  disruptorPublish(new LostConnectionEvent(session,clientID));
}
Program: 27435
Project: 27435
Buggy source:
@Override public void onEvent(ValueEvent t,long l,boolean bln) throws Exception {
  MessagingEvent evt=t.getEvent();
  LOG.info("String_Node_Str",evt);
  if (evt instanceof StopEvent) {
    processStop();
    return;
  }
  if (evt instanceof LostConnectionEvent) {
    LostConnectionEvent lostEvt=(LostConnectionEvent)evt;
    m_processor.processConnectionLost(lostEvt.getClientID());
    return;
  }
  if (evt instanceof ProtocolEvent) {
    ServerChannel session=((ProtocolEvent)evt).getSession();
    AbstractMessage message=((ProtocolEvent)evt).getMessage();
    annotationSupport.dispatch(session,message);
  }
}

Fixed version (ground truth):
@Override public void onEvent(ValueEvent t,long l,boolean bln) throws Exception {
  MessagingEvent evt=t.getEvent();
  LOG.info("String_Node_Str",evt);
  if (evt instanceof StopEvent) {
    processStop();
    return;
  }
  if (evt instanceof LostConnectionEvent) {
    LostConnectionEvent lostEvt=(LostConnectionEvent)evt;
    m_processor.processConnectionLost(lostEvt);
    return;
  }
  if (evt instanceof ProtocolEvent) {
    ServerChannel session=((ProtocolEvent)evt).getSession();
    AbstractMessage message=((ProtocolEvent)evt).getMessage();
    annotationSupport.dispatch(session,message);
  }
}
Program: 27436
Project: 27436
Buggy source:
public LostConnectionEvent(String clienID){
  m_clientID=clienID;
}

Fixed version (ground truth):
public LostConnectionEvent(ServerChannel session,String clientID){
  this.session=session;
  this.clientID=clientID;
}
Program: 27437
Project: 27437
Buggy source:
/** 
 * Verify if the 2 topics matching respecting the rules of MQTT Appendix A
 */
public static boolean matchTopics(String msgTopic,String subscriptionTopic){
  try {
    List<Token> msgTokens=SubscriptionsStore.splitTopic(msgTopic);
    List<Token> subscriptionTokens=SubscriptionsStore.splitTopic(subscriptionTopic);
    int i=0;
    Token subToken=null;
    for (; i < subscriptionTokens.size(); i++) {
      subToken=subscriptionTokens.get(i);
      if (subToken != Token.MULTI && subToken != Token.SINGLE) {
        if (i >= msgTokens.size()) {
          return false;
        }
        Token msgToken=msgTokens.get(i);
        if (!msgToken.equals(subToken)) {
          return false;
        }
      }
 else {
        if (subToken == Token.MULTI) {
          return true;
        }
        if (subToken == Token.SINGLE) {
        }
      }
    }
    if (subToken == Token.SINGLE && (i - msgTokens.size() == 1)) {
      i--;
    }
    return i == msgTokens.size();
  }
 catch (  ParseException ex) {
    LOG.error(null,ex);
    throw new RuntimeException(ex);
  }
}

Fixed version (ground truth):
/** 
 * Verify if the 2 topics matching respecting the rules of MQTT Appendix A
 */
public static boolean matchTopics(String msgTopic,String subscriptionTopic){
  try {
    List<Token> msgTokens=SubscriptionsStore.splitTopic(msgTopic);
    List<Token> subscriptionTokens=SubscriptionsStore.splitTopic(subscriptionTopic);
    int i=0;
    Token subToken=null;
    for (; i < subscriptionTokens.size(); i++) {
      subToken=subscriptionTokens.get(i);
      if (subToken != Token.MULTI && subToken != Token.SINGLE) {
        if (i >= msgTokens.size()) {
          return false;
        }
        Token msgToken=msgTokens.get(i);
        if (!msgToken.equals(subToken)) {
          return false;
        }
      }
 else {
        if (subToken == Token.MULTI) {
          return true;
        }
        if (subToken == Token.SINGLE) {
        }
      }
    }
    return i == msgTokens.size();
  }
 catch (  ParseException ex) {
    LOG.error(null,ex);
    throw new RuntimeException(ex);
  }
}
Program: 27438
Project: 27438
Buggy source:
protected static List<Token> splitTopic(String topic) throws ParseException {
  List res=new ArrayList<Token>();
  String[] splitted=topic.split("String_Node_Str");
  if (splitted.length == 0) {
    res.add(Token.EMPTY);
  }
  for (int i=0; i < splitted.length; i++) {
    String s=splitted[i];
    if (s.isEmpty()) {
      res.add(Token.EMPTY);
    }
 else     if (s.equals("String_Node_Str")) {
      if (i != splitted.length - 1) {
        throw new ParseException("String_Node_Str",i);
      }
      res.add(Token.MULTI);
    }
 else     if (s.contains("String_Node_Str")) {
      throw new ParseException("String_Node_Str" + s,i);
    }
 else     if (s.equals("String_Node_Str")) {
      res.add(Token.SINGLE);
    }
 else     if (s.contains("String_Node_Str")) {
      throw new ParseException("String_Node_Str" + s,i);
    }
 else {
      res.add(new Token(s));
    }
  }
  return res;
}

Fixed version (ground truth):
protected static List<Token> splitTopic(String topic) throws ParseException {
  List res=new ArrayList<Token>();
  String[] splitted=topic.split("String_Node_Str");
  if (splitted.length == 0) {
    res.add(Token.EMPTY);
  }
  if (topic.endsWith("String_Node_Str")) {
    String[] newSplitted=new String[splitted.length + 1];
    System.arraycopy(splitted,0,newSplitted,0,splitted.length);
    newSplitted[splitted.length]="String_Node_Str";
    splitted=newSplitted;
  }
  for (int i=0; i < splitted.length; i++) {
    String s=splitted[i];
    if (s.isEmpty()) {
      res.add(Token.EMPTY);
    }
 else     if (s.equals("String_Node_Str")) {
      if (i != splitted.length - 1) {
        throw new ParseException("String_Node_Str",i);
      }
      res.add(Token.MULTI);
    }
 else     if (s.contains("String_Node_Str")) {
      throw new ParseException("String_Node_Str" + s,i);
    }
 else     if (s.equals("String_Node_Str")) {
      res.add(Token.SINGLE);
    }
 else     if (s.contains("String_Node_Str")) {
      throw new ParseException("String_Node_Str" + s,i);
    }
 else {
      res.add(new Token(s));
    }
  }
  return res;
}
Program: 27439
Project: 27439
Buggy source:
@Test public void testMatchTopics_single(){
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertFalse(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertFalse(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testMatchTopics_single(){
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertFalse(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertFalse(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertTrue(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
  assertFalse(SubscriptionsStore.matchTopics("String_Node_Str","String_Node_Str"));
}
Program: 27440
Project: 27440
Buggy source:
@Test public void testSplitTopic() throws ParseException {
  List tokens=store.splitTopic("String_Node_Str");
  assertEqualsSeq(asArray("String_Node_Str","String_Node_Str","String_Node_Str"),tokens);
  tokens=store.splitTopic("String_Node_Str");
  assertEqualsSeq(asArray(Token.EMPTY,"String_Node_Str","String_Node_Str","String_Node_Str"),tokens);
  tokens=store.splitTopic("String_Node_Str");
  assertEqualsSeq(asArray(Token.EMPTY),tokens);
}

Fixed version (ground truth):
@Test public void testSplitTopic() throws ParseException {
  List tokens=store.splitTopic("String_Node_Str");
  assertEqualsSeq(asArray("String_Node_Str","String_Node_Str","String_Node_Str"),tokens);
  tokens=store.splitTopic("String_Node_Str");
  assertEqualsSeq(asArray(Token.EMPTY,"String_Node_Str","String_Node_Str","String_Node_Str"),tokens);
  tokens=store.splitTopic("String_Node_Str");
  assertEqualsSeq(asArray(Token.EMPTY,Token.EMPTY),tokens);
}
Program: 27441
Project: 27441
Buggy source:
private void processInit(Properties props){
  m_storageService=new HawtDBStorageService();
  m_storageService.initStore();
  subscriptions.init(m_storageService);
  String path=props.getProperty("String_Node_Str");
  IAuthenticator authenticator=new FileAuthenticator(path);
  m_processor.init(subscriptions,m_storageService,authenticator);
}

Fixed version (ground truth):
private void processInit(Properties props){
  m_storageService=new HawtDBStorageService();
  m_storageService.initStore();
  subscriptions.init(m_storageService);
  String passwdPath=props.getProperty("String_Node_Str");
  String configPath=System.getProperty("String_Node_Str","String_Node_Str");
  IAuthenticator authenticator=new FileAuthenticator(configPath + passwdPath);
  m_processor.init(subscriptions,m_storageService,authenticator);
}
Program: 27442
Project: 27442
Buggy source:
public void startServer() throws IOException {
  ConfigurationParser confParser=new ConfigurationParser();
  try {
    confParser.parse(new File("String_Node_Str"));
  }
 catch (  ParseException pex) {
    LOG.warn("String_Node_Str",pex);
  }
  Properties configProps=confParser.getProperties();
  messaging=SimpleMessaging.getInstance();
  messaging.init(configProps);
  m_acceptor=new NettyAcceptor();
  m_acceptor.initialize(messaging,configProps);
}

Fixed version (ground truth):
public void startServer() throws IOException {
  ConfigurationParser confParser=new ConfigurationParser();
  try {
    String configPath=System.getProperty("String_Node_Str","String_Node_Str");
    confParser.parse(new File(configPath + "String_Node_Str"));
  }
 catch (  ParseException pex) {
    LOG.warn("String_Node_Str",pex);
  }
  Properties configProps=confParser.getProperties();
  messaging=SimpleMessaging.getInstance();
  messaging.init(configProps);
  m_acceptor=new NettyAcceptor();
  m_acceptor.initialize(messaging,configProps);
}
Program: 27444
Project: 27444
Buggy source:
@Override public void userEventTriggered(ChannelHandlerContext ctx,Object evt) throws Exception {
  if (evt instanceof IdleState) {
    IdleState e=(IdleState)evt;
    if (e == IdleState.ALL_IDLE) {
      ctx.close();
    }
  }
}

Fixed version (ground truth):
@Override public void userEventTriggered(ChannelHandlerContext ctx,Object evt) throws Exception {
  if (evt instanceof IdleStateEvent) {
    IdleState e=((IdleStateEvent)evt).state();
    if (e == IdleState.ALL_IDLE) {
      ctx.close();
    }
  }
}
Program: 27445
Project: 27445
Buggy source:
@After public void tearDown(){
  File dbFile=new File(Server.STORAGE_FILE_PATH);
  if (dbFile.exists()) {
    dbFile.delete();
  }
  assertFalse(dbFile.exists());
}

Fixed version (ground truth):
@After public void tearDown(){
  if (m_storageService != null) {
    m_storageService.close();
  }
  File dbFile=new File(Server.STORAGE_FILE_PATH);
  if (dbFile.exists()) {
    dbFile.delete();
  }
  assertFalse(dbFile.exists());
}
Program: 27446
Project: 27446
Buggy source:
@Override public void channelRead(ChannelHandlerContext ctx,Object message){
  AbstractMessage msg=(AbstractMessage)message;
  LOG.info("String_Node_Str",Utils.msgType2String(msg.getMessageType()));
  try {
switch (msg.getMessageType()) {
case CONNECT:
case SUBSCRIBE:
case UNSUBSCRIBE:
case PUBLISH:
case PUBREC:
case PUBCOMP:
case PUBREL:
case DISCONNECT:
case PUBACK:
      NettyChannel channel;
synchronized (m_channelMapper) {
      if (!m_channelMapper.containsKey(ctx)) {
        m_channelMapper.put(ctx,new NettyChannel(ctx));
      }
      channel=m_channelMapper.get(ctx);
    }
  m_messaging.handleProtocolMessage(channel,msg);
break;
case PINGREQ:
PingRespMessage pingResp=new PingRespMessage();
ctx.write(pingResp);
break;
}
}
 catch (Exception ex) {
LOG.error("String_Node_Str",ex);
}
}

Fixed version (ground truth):
@Override public void channelRead(ChannelHandlerContext ctx,Object message){
  AbstractMessage msg=(AbstractMessage)message;
  LOG.info("String_Node_Str",Utils.msgType2String(msg.getMessageType()));
  try {
switch (msg.getMessageType()) {
case CONNECT:
case SUBSCRIBE:
case UNSUBSCRIBE:
case PUBLISH:
case PUBREC:
case PUBCOMP:
case PUBREL:
case DISCONNECT:
case PUBACK:
      NettyChannel channel;
synchronized (m_channelMapper) {
      if (!m_channelMapper.containsKey(ctx)) {
        m_channelMapper.put(ctx,new NettyChannel(ctx));
      }
      channel=m_channelMapper.get(ctx);
    }
  m_messaging.handleProtocolMessage(channel,msg);
break;
case PINGREQ:
PingRespMessage pingResp=new PingRespMessage();
ctx.writeAndFlush(pingResp);
break;
}
}
 catch (Exception ex) {
LOG.error("String_Node_Str",ex);
}
}
Program: 27447
Project: 27447
Buggy source:
private void sendPublish(String clientId,String topic,AbstractMessage.QOSType qos,ByteBuffer message,boolean retained,int messageID){
  LOG.debug("String_Node_Str",clientId,topic,qos,retained,messageID);
  PublishMessage pubMessage=new PublishMessage();
  pubMessage.setRetainFlag(retained);
  pubMessage.setTopicName(topic);
  pubMessage.setQos(qos);
  pubMessage.setPayload(message);
  LOG.info("String_Node_Str",clientId,topic);
  LOG.debug("String_Node_Str",new String(message.array()));
  if (pubMessage.getQos() != AbstractMessage.QOSType.MOST_ONE) {
    pubMessage.setMessageID(messageID);
  }
  if (m_clientIDs == null) {
    throw new RuntimeException("String_Node_Str");
  }
  LOG.debug("String_Node_Str",m_clientIDs);
  if (m_clientIDs.get(clientId) == null) {
    throw new RuntimeException(String.format("String_Node_Str",clientId,m_clientIDs));
  }
  LOG.debug("String_Node_Str",clientId,m_clientIDs.get(clientId).getSession());
  disruptorPublish(new OutputMessagingEvent(m_clientIDs.get(clientId).getSession(),pubMessage));
}

Fixed version (ground truth):
private void sendPublish(String clientId,String topic,AbstractMessage.QOSType qos,ByteBuffer message,boolean retained,int messageID){
  LOG.debug("String_Node_Str",clientId,topic,qos,retained,messageID);
  PublishMessage pubMessage=new PublishMessage();
  pubMessage.setRetainFlag(retained);
  pubMessage.setTopicName(topic);
  pubMessage.setQos(qos);
  pubMessage.setPayload(message);
  LOG.info("String_Node_Str",clientId,topic);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",DebugUtils.payload2Str(message));
  }
  if (pubMessage.getQos() != AbstractMessage.QOSType.MOST_ONE) {
    pubMessage.setMessageID(messageID);
  }
  if (m_clientIDs == null) {
    throw new RuntimeException("String_Node_Str");
  }
  LOG.debug("String_Node_Str",m_clientIDs);
  if (m_clientIDs.get(clientId) == null) {
    throw new RuntimeException(String.format("String_Node_Str",clientId,m_clientIDs));
  }
  LOG.debug("String_Node_Str",clientId,m_clientIDs.get(clientId).getSession());
  disruptorPublish(new OutputMessagingEvent(m_clientIDs.get(clientId).getSession(),pubMessage));
}