nus-yam/ex-repair huggingface dataset:
Program: 27352
Project: 27352
Buggy source:
private void initializePlainTCPTransport(final NettyMQTTHandler handler,IConfig props) throws IOException {
  LOG.info("String_Node_Str");
  final MoquetteIdleTimeoutHandler timeoutHandler=new MoquetteIdleTimeoutHandler();
  String host=props.getProperty(BrokerConstants.HOST_PROPERTY_NAME);
  String tcpPortProp=props.getProperty(PORT_PROPERTY_NAME,DISABLED_PORT_BIND);
  if (DISABLED_PORT_BIND.equals(tcpPortProp)) {
    LOG.info("String_Node_Str",BrokerConstants.PORT_PROPERTY_NAME,DISABLED_PORT_BIND);
    return;
  }
  int port=Integer.parseInt(tcpPortProp);
  initFactory(host,port,"String_Node_Str",new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline){
      pipeline.addFirst("String_Node_Str",new IdleStateHandler(nettyChannelTimeoutSeconds,0,0));
      pipeline.addAfter("String_Node_Str","String_Node_Str",timeoutHandler);
      if (errorsCather.isPresent()) {
        pipeline.addLast("String_Node_Str",errorsCather.get());
      }
      pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
      pipeline.addLast("String_Node_Str",new MqttDecoder());
      pipeline.addLast("String_Node_Str",MqttEncoder.INSTANCE);
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",new MQTTMessageLogger());
      if (metrics.isPresent()) {
        pipeline.addLast("String_Node_Str",metrics.get());
      }
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}

Fixed version (ground truth):
private void initializePlainTCPTransport(final NettyMQTTHandler handler,IConfig props) throws IOException {
  LOG.info("String_Node_Str");
  final MoquetteIdleTimeoutHandler timeoutHandler=new MoquetteIdleTimeoutHandler();
  String host=props.getProperty(BrokerConstants.HOST_PROPERTY_NAME);
  String tcpPortProp=props.getProperty(PORT_PROPERTY_NAME,DISABLED_PORT_BIND);
  if (DISABLED_PORT_BIND.equals(tcpPortProp)) {
    LOG.info("String_Node_Str",BrokerConstants.PORT_PROPERTY_NAME,DISABLED_PORT_BIND);
    return;
  }
  int port=Integer.parseInt(tcpPortProp);
  initFactory(host,port,"String_Node_Str",new PipelineInitializer(){
    @Override void init(    ChannelPipeline pipeline){
      pipeline.addFirst("String_Node_Str",new IdleStateHandler(nettyChannelTimeoutSeconds,0,0));
      pipeline.addAfter("String_Node_Str","String_Node_Str",timeoutHandler);
      if (errorsCather.isPresent()) {
        pipeline.addLast("String_Node_Str",errorsCather.get());
      }
      pipeline.addFirst("String_Node_Str",new BytesMetricsHandler(m_bytesMetricsCollector));
      pipeline.addLast("String_Node_Str",new MqttDecoder(maxBytesInMessage));
      pipeline.addLast("String_Node_Str",MqttEncoder.INSTANCE);
      pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
      pipeline.addLast("String_Node_Str",new MQTTMessageLogger());
      if (metrics.isPresent()) {
        pipeline.addLast("String_Node_Str",metrics.get());
      }
      pipeline.addLast("String_Node_Str",handler);
    }
  }
);
}
Program: 27356
Project: 27356
Buggy source:
/** 
 * SPI method used by Broker embedded applications to add intercept handlers.
 */
public boolean addInterceptHandler(InterceptHandler interceptHandler){
  if (!m_initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  return m_processor.addInterceptHandler(interceptHandler);
}

Fixed version (ground truth):
/** 
 * SPI method used by Broker embedded applications to add intercept handlers.
 * @param interceptHandler the handler to add.
 * @return true id operation was successful.
 */
public boolean addInterceptHandler(InterceptHandler interceptHandler){
  if (!m_initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  return m_processor.addInterceptHandler(interceptHandler);
}
Program: 27357
Project: 27357
Buggy source:
/** 
 * SPI method used by Broker embedded applications to get list of subscribers. Returns null if the broker is not started.
 */
public List<Subscription> getSubscriptions(){
  if (m_processorBootstrapper == null) {
    return null;
  }
  return m_processorBootstrapper.getSubscriptions();
}

Fixed version (ground truth):
/** 
 * SPI method used by Broker embedded applications to get list of subscribers. Returns null if the broker is not started.
 * @return list of subscriptions.
 */
public List<Subscription> getSubscriptions(){
  if (m_processorBootstrapper == null) {
    return null;
  }
  return m_processorBootstrapper.getSubscriptions();
}
Program: 27358
Project: 27358
Buggy source:
/** 
 * SPI method used by Broker embedded applications to remove intercept handlers.
 */
public boolean removeInterceptHandler(InterceptHandler interceptHandler){
  if (!m_initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  return m_processor.removeInterceptHandler(interceptHandler);
}

Fixed version (ground truth):
/** 
 * SPI method used by Broker embedded applications to remove intercept handlers.
 * @param interceptHandler the handler to remove.
 * @return true id operation was successful.
 */
public boolean removeInterceptHandler(InterceptHandler interceptHandler){
  if (!m_initialized) {
    throw new IllegalStateException("String_Node_Str");
  }
  return m_processor.removeInterceptHandler(interceptHandler);
}
Program: 27359
Project: 27359
Buggy source:
/** 
 * Is called when the write timeout expire.
 */
protected void channelIdle(ChannelHandlerContext ctx) throws Exception {
  ctx.channel().flush();
}

Fixed version (ground truth):
/** 
 * Is called when the write timeout expire.
 * @param ctx the channel context.
 * @throws Exception in case of any IO error.
 */
protected void channelIdle(ChannelHandlerContext ctx) throws Exception {
  ctx.channel().flush();
}
Program: 27360
Project: 27360
Buggy source:
/** 
 * Remove the messages stored in a cleanSession false.
 */
public void removeEnqueued(MessageGUID guid){
  this.m_sessionsStore.removeEnqueued(this.clientID,guid);
}

Fixed version (ground truth):
/** 
 * Remove the messages stored in a cleanSession false.
 * @param guid the guid of the message to remove from the queue.
 */
public void removeEnqueued(MessageGUID guid){
  this.m_sessionsStore.removeEnqueued(this.clientID,guid);
}
Program: 27361
Project: 27361
Buggy source:
/** 
 * Enqueue a message to be sent to the client.
 * @return false if the queue is full.
 */
public boolean enqueue(PublishMessage pubMessage){
  return m_queueToPublish.offer(pubMessage);
}

Fixed version (ground truth):
/** 
 * Enqueue a message to be sent to the client.
 * @param pubMessage the message to enqueue.
 * @return false if the queue is full.
 */
public boolean enqueue(PublishMessage pubMessage){
  return m_queueToPublish.offer(pubMessage);
}
Program: 27362
Project: 27362
Buggy source:
/** 
 * Persist the message.
 * @return the unique id in the storage (guid).
 */
MessageGUID storePublishForFuture(StoredMessage evt);

Fixed version (ground truth):
/** 
 * Persist the message.
 * @param storedMessage the message to store for future usage.
 * @return the unique id in the storage (guid).
 */
MessageGUID storePublishForFuture(StoredMessage storedMessage);
Program: 27363
Project: 27363
Buggy source:
/** 
 * Persist the message.  If the message is empty then the topic is cleaned, else it's stored.
 */
void storeRetained(String topic,MessageGUID guid);

Fixed version (ground truth):
/** 
 * Persist the message.  If the message is empty then the topic is cleaned, else it's stored.
 * @param topic for the retained.
 * @param guid of the message to mark as retained.
 */
void storeRetained(String topic,MessageGUID guid);
Program: 27364
Project: 27364
Buggy source:
/** 
 * Return the list of persisted publishes for the given clientID. For QoS1 and QoS2 with clean session flag, this method return the list of  missed publish events while the client was disconnected.
 */
List<StoredMessage> listMessagesInSession(Collection<MessageGUID> guids);

Fixed version (ground truth):
/** 
 * Return the list of persisted publishes for the given clientID. For QoS1 and QoS2 with clean session flag, this method return the list of  missed publish events while the client was disconnected.
 * @param guids the list of of guid to use as search keys.
 * @return the list of stored messages matching the passed keys.
 */
List<StoredMessage> listMessagesInSession(Collection<MessageGUID> guids);
Program: 27365
Project: 27365
Buggy source:
/** 
 * Return a list of retained messages that satisfy the condition.
 */
Collection<StoredMessage> searchMatching(IMatchingCondition condition);

Fixed version (ground truth):
/** 
 * Return a list of retained messages that satisfy the condition.
 * @param condition the condition to match during the search.
 * @return the collection of matching messages.
 */
Collection<StoredMessage> searchMatching(IMatchingCondition condition);
Program: 27366
Project: 27366
Buggy source:
/** 
 * Removed a specific subscription
 */
void removeSubscription(String topic,String clientID);

Fixed version (ground truth):
/** 
 * Removed a specific subscription
 * @param topic the topic of the subscription.
 * @param clientID the session client.
 */
void removeSubscription(String topic,String clientID);
Program: 27367
Project: 27367
Buggy source:
/** 
 * Store the guid to be later published.
 */
void bindToDeliver(MessageGUID guid,String clientID);

Fixed version (ground truth):
/** 
 * Store the guid to be later published.
 * @param guid the message guid to bind.
 * @param clientID the clientID
 */
void bindToDeliver(MessageGUID guid,String clientID);
Program: 27368
Project: 27368
Buggy source:
/** 
 * @return the subscription stored by clientID and topicFilter, if any else null;
 */
Subscription getSubscription(ClientTopicCouple couple);

Fixed version (ground truth):
/** 
 * @param couple the subscription descriptor.
 * @return the subscription stored by clientID and topicFilter, if any else null;
 */
Subscription getSubscription(ClientTopicCouple couple);
Program: 27369
Project: 27369
Buggy source:
/** 
 * List the guids for retained messages for the session
 */
Collection<MessageGUID> enqueued(String clientID);

Fixed version (ground truth):
/** 
 * List the guids for retained messages for the session
 * @param clientID the client ID owning the queue.
 * @return the list of enqueued message UUIDs.
 */
Collection<MessageGUID> enqueued(String clientID);
Program: 27370
Project: 27370
Buggy source:
/** 
 * Save the binding messageID, clientID <-> guid
 */
void inFlight(String clientID,int messageID,MessageGUID guid);

Fixed version (ground truth):
/** 
 * Save the binding messageID, clientID - guid
 * @param clientID the client ID
 * @param messageID the message ID
 * @param guid the uuid of the message to mark as inflight.
 */
void inFlight(String clientID,int messageID,MessageGUID guid);
Program: 27371
Project: 27371
Buggy source:
/** 
 * Return the next valid packetIdentifier for the given client session.
 */
int nextPacketID(String clientID);

Fixed version (ground truth):
/** 
 * Return the next valid packetIdentifier for the given client session.
 * @param clientID the clientID requesting next packet id.
 * @return the next valid id.
 */
int nextPacketID(String clientID);
Program: 27372
Project: 27372
Buggy source:
/** 
 * Remove form the queue of stored messages for session.
 */
void removeEnqueued(String clientID,MessageGUID guid);

Fixed version (ground truth):
/** 
 * Remove form the queue of stored messages for session.
 * @param clientID the client ID owning the queue.
 * @param guid the message guid to dequeue.
 */
void removeEnqueued(String clientID,MessageGUID guid);
Program: 27373
Project: 27373
Buggy source:
/** 
 * Remove all the subscriptions of the session
 */
void wipeSubscriptions(String sessionID);

Fixed version (ground truth):
/** 
 * Remove all the subscriptions of the session
 * @param sessionID the client ID
 */
void wipeSubscriptions(String sessionID);
Program: 27374
Project: 27374
Buggy source:
/** 
 * @return true iff there are subscriptions persisted with clientID
 */
boolean contains(String clientID);

Fixed version (ground truth):
/** 
 * @param clientID the session client ID.
 * @return true iff there are subscriptions persisted with clientID
 */
boolean contains(String clientID);
Program: 27375
Project: 27375
Buggy source:
/** 
 * @return the guid of message just acked.
 */
MessageGUID secondPhaseAcknowledged(String clientID,int messageID);

Fixed version (ground truth):
/** 
 * @param clientID the client ID accessing the second phase.
 * @param messageID the message ID that reached the second phase.
 * @return the guid of message just acked.
 */
MessageGUID secondPhaseAcknowledged(String clientID,int messageID);
Program: 27376
Project: 27376
Buggy source:
/** 
 * Add a new subscription to the session
 */
void addNewSubscription(Subscription newSubscription);

Fixed version (ground truth):
/** 
 * Add a new subscription to the session
 * @param newSubscription the subscription to add.
 */
void addNewSubscription(Subscription newSubscription);
Program: 27377
Project: 27377
Buggy source:
/** 
 * Remove the clientID from topic subscription, if not previously subscribed, doesn't reply any error
 */
public void processUnsubscribe(Channel channel,UnsubscribeMessage msg){
  List<String> topics=msg.topicFilters();
  String clientID=NettyUtils.clientID(channel);
  LOG.debug("String_Node_Str",topics,clientID);
  ClientSession clientSession=m_sessionsStore.sessionForClient(clientID);
  for (  String topic : topics) {
    boolean validTopic=SubscriptionsStore.validate(topic);
    if (!validTopic) {
      channel.close();
      LOG.warn("String_Node_Str",topic,clientID);
      return;
    }
    subscriptions.removeSubscription(topic,clientID);
    clientSession.unsubscribeFrom(topic);
    String username=NettyUtils.userName(channel);
    m_interceptor.notifyTopicUnsubscribed(topic,clientID,username);
  }
  int messageID=msg.getMessageID();
  UnsubAckMessage ackMessage=new UnsubAckMessage();
  ackMessage.setMessageID(messageID);
  LOG.info("String_Node_Str",messageID);
  channel.writeAndFlush(ackMessage);
}

Fixed version (ground truth):
/** 
 * Remove the clientID from topic subscription, if not previously subscribed, doesn't reply any error.
 * @param channel the channel of the incoming message.
 * @param msg the decoded unsubscribe message.
 */
public void processUnsubscribe(Channel channel,UnsubscribeMessage msg){
  List<String> topics=msg.topicFilters();
  String clientID=NettyUtils.clientID(channel);
  LOG.debug("String_Node_Str",topics,clientID);
  ClientSession clientSession=m_sessionsStore.sessionForClient(clientID);
  for (  String topic : topics) {
    boolean validTopic=SubscriptionsStore.validate(topic);
    if (!validTopic) {
      channel.close();
      LOG.warn("String_Node_Str",topic,clientID);
      return;
    }
    subscriptions.removeSubscription(topic,clientID);
    clientSession.unsubscribeFrom(topic);
    String username=NettyUtils.userName(channel);
    m_interceptor.notifyTopicUnsubscribed(topic,clientID,username);
  }
  int messageID=msg.getMessageID();
  UnsubAckMessage ackMessage=new UnsubAckMessage();
  ackMessage.setMessageID(messageID);
  LOG.info("String_Node_Str",messageID);
  channel.writeAndFlush(ackMessage);
}
Program: 27378
Project: 27378
Buggy source:
/** 
 * Intended usage is only for embedded versions of the broker, where the hosting application want to use the broker to send a publish message. Inspired by   {@link #processPublish} but with some changes to avoid security check, and the handshake phasesfor Qos1 and Qos2. It also doesn't notifyTopicPublished because using internally the owner should already know where it's publishing.
 */
public void internalPublish(PublishMessage msg){
  final AbstractMessage.QOSType qos=msg.getQos();
  final String topic=msg.getTopicName();
  LOG.info("String_Node_Str",topic,qos);
  MessageGUID guid=null;
  IMessagesStore.StoredMessage toStoreMsg=asStoredMessage(msg);
  if (msg.getClientId() == null || msg.getClientId().isEmpty()) {
    toStoreMsg.setClientID("String_Node_Str");
  }
 else {
    toStoreMsg.setClientID(msg.getClientId());
  }
  toStoreMsg.setMessageID(1);
  if (qos == AbstractMessage.QOSType.EXACTLY_ONCE) {
    guid=m_messagesStore.storePublishForFuture(toStoreMsg);
  }
  List<Subscription> topicMatchingSubscriptions=subscriptions.matches(topic);
  this.messagesPublisher.publish2Subscribers(toStoreMsg,topicMatchingSubscriptions);
  if (!msg.isRetainFlag()) {
    return;
  }
  if (qos == AbstractMessage.QOSType.MOST_ONE || !msg.getPayload().hasRemaining()) {
    m_messagesStore.cleanRetained(topic);
    return;
  }
  if (guid == null) {
    guid=m_messagesStore.storePublishForFuture(toStoreMsg);
  }
  m_messagesStore.storeRetained(topic,guid);
}

Fixed version (ground truth):
/** 
 * Intended usage is only for embedded versions of the broker, where the hosting application want to use the broker to send a publish message. Inspired by   {@link #processPublish} but with some changes to avoid security check, and the handshake phasesfor Qos1 and Qos2. It also doesn't notifyTopicPublished because using internally the owner should already know where it's publishing.
 * @param msg the message to publish.
 */
public void internalPublish(PublishMessage msg){
  final AbstractMessage.QOSType qos=msg.getQos();
  final String topic=msg.getTopicName();
  LOG.info("String_Node_Str",topic,qos);
  MessageGUID guid=null;
  IMessagesStore.StoredMessage toStoreMsg=asStoredMessage(msg);
  if (msg.getClientId() == null || msg.getClientId().isEmpty()) {
    toStoreMsg.setClientID("String_Node_Str");
  }
 else {
    toStoreMsg.setClientID(msg.getClientId());
  }
  toStoreMsg.setMessageID(1);
  if (qos == AbstractMessage.QOSType.EXACTLY_ONCE) {
    guid=m_messagesStore.storePublishForFuture(toStoreMsg);
  }
  List<Subscription> topicMatchingSubscriptions=subscriptions.matches(topic);
  this.messagesPublisher.publish2Subscribers(toStoreMsg,topicMatchingSubscriptions);
  if (!msg.isRetainFlag()) {
    return;
  }
  if (qos == AbstractMessage.QOSType.MOST_ONE || !msg.getPayload().hasRemaining()) {
    m_messagesStore.cleanRetained(topic);
    return;
  }
  if (guid == null) {
    guid=m_messagesStore.storePublishForFuture(toStoreMsg);
  }
  m_messagesStore.storeRetained(topic,guid);
}
Program: 27379
Project: 27379
Buggy source:
/** 
 * Second phase of a publish QoS2 protocol, sent by publisher to the broker. Search the stored message and publish to all interested subscribers.
 */
public void processPubRel(Channel channel,PubRelMessage msg){
  this.qos2PublishHandler.processPubRel(channel,msg);
}

Fixed version (ground truth):
/** 
 * Second phase of a publish QoS2 protocol, sent by publisher to the broker. Search the stored message and publish to all interested subscribers.
 * @param channel the channel of the incoming message.
 * @param msg the decoded pubrel message.
 */
public void processPubRel(Channel channel,PubRelMessage msg){
  this.qos2PublishHandler.processPubRel(channel,msg);
}
Program: 27381
Project: 27381
Buggy source:
/** 
 * Parse the ACL configuration file
 * @throws java.text.ParseException if the format is not compliant.
 */
public static AuthorizationsCollector parse(Reader reader) throws ParseException {
  if (reader == null) {
    LOG.warn("String_Node_Str");
    return AuthorizationsCollector.emptyImmutableCollector();
  }
  BufferedReader br=new BufferedReader(reader);
  String line;
  AuthorizationsCollector collector=new AuthorizationsCollector();
  try {
    while ((line=br.readLine()) != null) {
      int commentMarker=line.indexOf('#');
      if (commentMarker != -1) {
        if (commentMarker == 0) {
          continue;
        }
 else {
          throw new ParseException(line,commentMarker);
        }
      }
 else {
        if (line.isEmpty() || line.matches("String_Node_Str")) {
          continue;
        }
        collector.parse(line);
      }
    }
  }
 catch (  IOException ex) {
    throw new ParseException("String_Node_Str",1);
  }
  return collector;
}

Fixed version (ground truth):
/** 
 * Parse the ACL configuration file
 * @param reader to parse
 * @return the collector of authorizations form reader passed into.
 * @throws ParseException if the format is not compliant.
 */
public static AuthorizationsCollector parse(Reader reader) throws ParseException {
  if (reader == null) {
    LOG.warn("String_Node_Str");
    return AuthorizationsCollector.emptyImmutableCollector();
  }
  BufferedReader br=new BufferedReader(reader);
  String line;
  AuthorizationsCollector collector=new AuthorizationsCollector();
  try {
    while ((line=br.readLine()) != null) {
      int commentMarker=line.indexOf('#');
      if (commentMarker != -1) {
        if (commentMarker == 0) {
          continue;
        }
 else {
          throw new ParseException(line,commentMarker);
        }
      }
 else {
        if (line.isEmpty() || line.matches("String_Node_Str")) {
          continue;
        }
        collector.parse(line);
      }
    }
  }
 catch (  IOException ex) {
    throw new ParseException("String_Node_Str",1);
  }
  return collector;
}
Program: 27382
Project: 27382
Buggy source:
/** 
 * Initialize the subscription tree with the list of subscriptions. Maintained for compatibility reasons.
 */
public void init(ISessionsStore sessionsStore){
  LOG.debug("String_Node_Str");
  m_sessionsStore=sessionsStore;
  List<ClientTopicCouple> subscriptions=sessionsStore.listAllSubscriptions();
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",dumpTree());
  }
  for (  ClientTopicCouple clientTopic : subscriptions) {
    LOG.debug("String_Node_Str",clientTopic.clientID,clientTopic.topicFilter);
    add(clientTopic);
  }
  if (LOG.isTraceEnabled()) {
    LOG.trace("String_Node_Str",dumpTree());
  }
}

Fixed version (ground truth):
/** 
 * Initialize the subscription tree with the list of subscriptions. Maintained for compatibility reasons.
 * @param sessionsStore to be used as backing store from the subscription store.
 */
public void init(ISessionsStore sessionsStore){
  LOG.debug("String_Node_Str");
  m_sessionsStore=sessionsStore;
  List<ClientTopicCouple> subscriptions=sessionsStore.listAllSubscriptions();
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str",dumpTree());
  }
  for (  ClientTopicCouple clientTopic : subscriptions) {
    LOG.debug("String_Node_Str",clientTopic.clientID,clientTopic.topicFilter);
    add(clientTopic);
  }
  if (LOG.isTraceEnabled()) {
    LOG.trace("String_Node_Str",dumpTree());
  }
}
Program: 27383
Project: 27383
Buggy source:
/** 
 * Given a topic string return the clients subscriptions that matches it. Topic string can't contain character # and + because they are reserved to listeners subscriptions, and not topic publishing.
 */
public List<Subscription> matches(String topic){
  List<Token> tokens;
  try {
    tokens=parseTopic(topic);
  }
 catch (  ParseException ex) {
    LOG.error(null,ex);
    return Collections.emptyList();
  }
  Queue<Token> tokenQueue=new LinkedBlockingDeque<>(tokens);
  List<ClientTopicCouple> matchingSubs=new ArrayList<>();
  subscriptions.get().matches(tokenQueue,matchingSubs);
  Map<String,Subscription> subsForClient=new HashMap<>();
  for (  ClientTopicCouple matchingCouple : matchingSubs) {
    Subscription existingSub=subsForClient.get(matchingCouple.clientID);
    Subscription sub=m_sessionsStore.getSubscription(matchingCouple);
    if (sub == null) {
      continue;
    }
    if (existingSub == null || existingSub.getRequestedQos().byteValue() < sub.getRequestedQos().byteValue()) {
      subsForClient.put(matchingCouple.clientID,sub);
    }
  }
  return new ArrayList<>(subsForClient.values());
}

Fixed version (ground truth):
/** 
 * Given a topic string return the clients subscriptions that matches it. Topic string can't contain character # and + because they are reserved to listeners subscriptions, and not topic publishing.
 * @param topic to use fo searching matching subscriptions.
 * @return the list of matching subscriptions, or empty if not matching.
 */
public List<Subscription> matches(String topic){
  List<Token> tokens;
  try {
    tokens=parseTopic(topic);
  }
 catch (  ParseException ex) {
    LOG.error(null,ex);
    return Collections.emptyList();
  }
  Queue<Token> tokenQueue=new LinkedBlockingDeque<>(tokens);
  List<ClientTopicCouple> matchingSubs=new ArrayList<>();
  subscriptions.get().matches(tokenQueue,matchingSubs);
  Map<String,Subscription> subsForClient=new HashMap<>();
  for (  ClientTopicCouple matchingCouple : matchingSubs) {
    Subscription existingSub=subsForClient.get(matchingCouple.clientID);
    Subscription sub=m_sessionsStore.getSubscription(matchingCouple);
    if (sub == null) {
      continue;
    }
    if (existingSub == null || existingSub.getRequestedQos().byteValue() < sub.getRequestedQos().byteValue()) {
      subsForClient.put(matchingCouple.clientID,sub);
    }
  }
  return new ArrayList<>(subsForClient.values());
}
Program: 27384
Project: 27384
Buggy source:
/** 
 * Visit the topics tree to remove matching subscriptions with clientID. It's a mutating structure operation so create a new subscription tree (partial or total).
 */
public void removeForClient(String clientID){
  TreeNode oldRoot;
  TreeNode newRoot;
  do {
    oldRoot=subscriptions.get();
    newRoot=oldRoot.removeClientSubscriptions(clientID);
  }
 while (!subscriptions.compareAndSet(oldRoot,newRoot));
}

Fixed version (ground truth):
/** 
 * Visit the topics tree to remove matching subscriptions with clientID. It's a mutating structure operation so create a new subscription tree (partial or total).
 * @param clientID the client ID to remove.
 */
public void removeForClient(String clientID){
  TreeNode oldRoot;
  TreeNode newRoot;
  do {
    oldRoot=subscriptions.get();
    newRoot=oldRoot.removeClientSubscriptions(clientID);
  }
 while (!subscriptions.compareAndSet(oldRoot,newRoot));
}
Program: 27385
Project: 27385
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.parseTopic(msgTopic);
    List<Token> subscriptionTokens=SubscriptionsStore.parseTopic(subscriptionTopic);
    int i=0;
    for (; i < subscriptionTokens.size(); i++) {
      Token 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);
  }
}

Fixed version (ground truth):
/** 
 * Verify if the 2 topics matching respecting the rules of MQTT Appendix A
 * @param msgTopic the topic to match from the message
 * @param subscriptionTopic the topic filter of the subscription
 * @return true if the two topics match.
 */
public static boolean matchTopics(String msgTopic,String subscriptionTopic){
  try {
    List<Token> msgTokens=SubscriptionsStore.parseTopic(msgTopic);
    List<Token> subscriptionTokens=SubscriptionsStore.parseTopic(subscriptionTopic);
    int i=0;
    for (; i < subscriptionTokens.size(); i++) {
      Token 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: 27386
Project: 27386
Buggy source:
/** 
 * Check if the topic filter of the subscription is well formed
 */
public static boolean validate(String topicFilter){
  try {
    parseTopic(topicFilter);
    return true;
  }
 catch (  ParseException pex) {
    LOG.info("String_Node_Str",topicFilter);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Check if the topic filter of the subscription is well formed
 * @param topicFilter the filter to validate
 * @return true if it's correct.
 */
public static boolean validate(String topicFilter){
  try {
    parseTopic(topicFilter);
    return true;
  }
 catch (  ParseException pex) {
    LOG.info("String_Node_Str",topicFilter);
    return false;
  }
}
Program: 27387
Project: 27387
Buggy source:
@Override public MessageGUID storePublishForFuture(StoredMessage evt){
  LOG.debug("String_Node_Str",evt);
  if (evt.getClientID() == null) {
    LOG.error("String_Node_Str",evt);
    throw new IllegalArgumentException("String_Node_Str");
  }
  MessageGUID guid=new MessageGUID(UUID.randomUUID().toString());
  evt.setGuid(guid);
  LOG.debug("String_Node_Str",guid);
  m_persistentMessageStore.put(guid,evt);
  ConcurrentMap<Integer,MessageGUID> messageIdToGuid=m_db.getHashMap(MapDBSessionsStore.messageId2GuidsMapName(evt.getClientID()));
  messageIdToGuid.put(evt.getMessageID(),guid);
  return guid;
}

Fixed version (ground truth):
@Override public MessageGUID storePublishForFuture(StoredMessage storedMessage){
  LOG.debug("String_Node_Str",storedMessage);
  if (storedMessage.getClientID() == null) {
    LOG.error("String_Node_Str",storedMessage);
    throw new IllegalArgumentException("String_Node_Str");
  }
  MessageGUID guid=new MessageGUID(UUID.randomUUID().toString());
  storedMessage.setGuid(guid);
  LOG.debug("String_Node_Str",guid);
  m_persistentMessageStore.put(guid,storedMessage);
  ConcurrentMap<Integer,MessageGUID> messageIdToGuid=m_db.getHashMap(MapDBSessionsStore.messageId2GuidsMapName(storedMessage.getClientID()));
  messageIdToGuid.put(storedMessage.getMessageID(),guid);
  return guid;
}
Program: 27388
Project: 27388
Buggy source:
/** 
 * Factory method to create message store backed by MapDB
 */
public IMessagesStore messagesStore(){
  return m_messageStore;
}

Fixed version (ground truth):
/** 
 * Factory method to create message store backed by MapDB
 * @return the message store instance.
 */
public IMessagesStore messagesStore(){
  return m_messageStore;
}
Program: 27389
Project: 27389
Buggy source:
/** 
 * Ask the implementation of the authorizator if the topic can be used in a publish.
 */
boolean canWrite(String topic,String user,String client);

Fixed version (ground truth):
/** 
 * Ask the implementation of the authorizator if the topic can be used in a publish.
 * @param topic the topic to write to.
 * @param user the user
 * @param client the client
 * @return true if the user from client can publish data on topic.
 */
boolean canWrite(String topic,String user,String client);
Program: 27390
Project: 27390
Buggy source:
protected void directSend(ClientSession clientsession,String topic,AbstractMessage.QOSType qos,ByteBuffer message,boolean retained,Integer messageID){
  String clientId=clientsession.clientID;
  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);
  }
 else {
    if (messageID != null) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + messageID);
    }
  }
  if (m_clientIDs == null) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
  if (m_clientIDs.get(clientId) == null) {
    throw new RuntimeException(String.format("String_Node_Str",clientId,m_clientIDs));
  }
  Channel channel=m_clientIDs.get(clientId).channel;
  LOG.trace("String_Node_Str",clientId);
  if (channel.isWritable()) {
    channel.write(pubMessage);
  }
 else {
    clientsession.enqueue(pubMessage);
  }
}

Fixed version (ground truth):
protected void directSend(ClientSession clientsession,String topic,AbstractMessage.QOSType qos,ByteBuffer message,boolean retained,Integer messageID){
  String clientId=clientsession.clientID;
  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);
  }
 else {
    if (messageID != null) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + messageID);
    }
  }
  if (m_clientIDs == null) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
  if (m_clientIDs.get(clientId) == null) {
    throw new RuntimeException(String.format("String_Node_Str",clientId,m_clientIDs));
  }
  Channel channel=m_clientIDs.get(clientId).channel;
  LOG.trace("String_Node_Str",clientId);
  if (channel.isWritable()) {
    LOG.debug("String_Node_Str");
    channel.writeAndFlush(pubMessage);
  }
 else {
    LOG.debug("String_Node_Str");
    clientsession.enqueue(pubMessage);
  }
}
Program: 27391
Project: 27391
Buggy source:
/** 
 * Republish QoS1 and QoS2 messages stored into the session for the clientID.
 */
private void republishStoredInSession(ClientSession clientSession){
  LOG.trace("String_Node_Str",clientSession);
  List<IMessagesStore.StoredMessage> publishedEvents=clientSession.storedMessages();
  if (publishedEvents.isEmpty()) {
    LOG.info("String_Node_Str",clientSession.clientID);
    return;
  }
  LOG.info("String_Node_Str",clientSession.clientID);
  for (  IMessagesStore.StoredMessage pubEvt : publishedEvents) {
    directSend(clientSession,pubEvt.getTopic(),pubEvt.getQos(),pubEvt.getMessage(),false,pubEvt.getMessageID());
    clientSession.removeEnqueued(pubEvt.getGuid());
  }
}

Fixed version (ground truth):
/** 
 * Republish QoS1 and QoS2 messages stored into the session for the clientID.
 */
private void republishStoredInSession(ClientSession clientSession){
  LOG.trace("String_Node_Str",clientSession);
  List<IMessagesStore.StoredMessage> publishedEvents=clientSession.storedMessages();
  if (publishedEvents.isEmpty()) {
    LOG.info("String_Node_Str",clientSession.clientID);
    return;
  }
  LOG.info("String_Node_Str",clientSession.clientID);
  for (  IMessagesStore.StoredMessage pubEvt : publishedEvents) {
    LOG.trace("String_Node_Str",pubEvt.getMessageID());
    clientSession.inFlightAckWaiting(pubEvt.getGuid(),pubEvt.getMessageID());
    directSend(clientSession,pubEvt.getTopic(),pubEvt.getQos(),pubEvt.getMessage(),false,pubEvt.getMessageID());
    clientSession.removeEnqueued(pubEvt.getGuid());
  }
}
Program: 27392
Project: 27392
Buggy source:
@Before public void setUp() throws Exception {
  startServer();
  String dbPath=IntegrationUtils.localMapDBPath();
  IntegrationUtils.cleanPersistenceFile(dbPath);
  m_subscriber=new MqttClient("String_Node_Str","String_Node_Str",s_dataStore);
  m_messageCollector=new MessageCollector();
  m_subscriber.setCallback(m_messageCollector);
  m_publisher=new MqttClient("String_Node_Str","String_Node_Str",s_pubDataStore);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  String dbPath=IntegrationUtils.localMapDBPath();
  IntegrationUtils.cleanPersistenceFile(dbPath);
  startServer();
  m_subscriber=new MqttClient("String_Node_Str","String_Node_Str",s_dataStore);
  m_messageCollector=new MessageCollector();
  m_subscriber.setCallback(m_messageCollector);
  m_publisher=new MqttClient("String_Node_Str","String_Node_Str",s_pubDataStore);
}
Program: 27393
Project: 27393
Buggy source:
@Before public void setUp() throws Exception {
  startServer();
  String dbPath=IntegrationUtils.localMapDBPath();
  IntegrationUtils.cleanPersistenceFile(dbPath);
  m_subscriber=new MqttClient("String_Node_Str","String_Node_Str",s_dataStore);
  m_messageCollector=new MessageCollector();
  m_subscriber.setCallback(m_messageCollector);
  m_publisher=new MqttClient("String_Node_Str","String_Node_Str",s_pubDataStore);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  String dbPath=IntegrationUtils.localMapDBPath();
  IntegrationUtils.cleanPersistenceFile(dbPath);
  startServer();
  m_subscriber=new MqttClient("String_Node_Str","String_Node_Str",s_dataStore);
  m_messageCollector=new MessageCollector();
  m_subscriber.setCallback(m_messageCollector);
  m_publisher=new MqttClient("String_Node_Str","String_Node_Str",s_pubDataStore);
}
Program: 27394
Project: 27394
Buggy source:
@Override void init(ChannelPipeline pipeline) throws Exception {
  pipeline.addLast("String_Node_Str",createSslHandler(sslContext,needsClientAuth));
  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",timeoutHandler);
  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",createSslHandler(sslContext,needsClientAuth));
  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",MQTT_SUBPROTOCOL_CSV_LIST));
  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",timeoutHandler);
  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: 27397
Project: 27397
Buggy source:
/** 
 * Given a topic string return the clients subscriptions that matches it. Topic string can't contain character # and + because they are reserved to listeners subscriptions, and not topic publishing.
 */
public List<Subscription> matches(String topic){
  List<Token> tokens;
  try {
    tokens=parseTopic(topic);
  }
 catch (  ParseException ex) {
    LOG.error(null,ex);
    return Collections.emptyList();
  }
  Queue<Token> tokenQueue=new LinkedBlockingDeque<>(tokens);
  List<ClientTopicCouple> matchingSubs=new ArrayList<>();
  subscriptions.get().matches(tokenQueue,matchingSubs);
  Map<String,Subscription> subsForClient=new HashMap<>();
  for (  ClientTopicCouple matchingCouple : matchingSubs) {
    Subscription existingSub=subsForClient.get(matchingCouple.clientID);
    Subscription sub=m_sessionsStore.getSubscription(matchingCouple);
    if (existingSub == null || existingSub.getRequestedQos().byteValue() < sub.getRequestedQos().byteValue()) {
      subsForClient.put(matchingCouple.clientID,sub);
    }
  }
  return new ArrayList<>(subsForClient.values());
}

Fixed version (ground truth):
/** 
 * Given a topic string return the clients subscriptions that matches it. Topic string can't contain character # and + because they are reserved to listeners subscriptions, and not topic publishing.
 */
public List<Subscription> matches(String topic){
  List<Token> tokens;
  try {
    tokens=parseTopic(topic);
  }
 catch (  ParseException ex) {
    LOG.error(null,ex);
    return Collections.emptyList();
  }
  Queue<Token> tokenQueue=new LinkedBlockingDeque<>(tokens);
  List<ClientTopicCouple> matchingSubs=new ArrayList<>();
  subscriptions.get().matches(tokenQueue,matchingSubs);
  Map<String,Subscription> subsForClient=new HashMap<>();
  for (  ClientTopicCouple matchingCouple : matchingSubs) {
    Subscription existingSub=subsForClient.get(matchingCouple.clientID);
    Subscription sub=m_sessionsStore.getSubscription(matchingCouple);
    if (sub == null) {
      continue;
    }
    if (existingSub == null || existingSub.getRequestedQos().byteValue() < sub.getRequestedQos().byteValue()) {
      subsForClient.put(matchingCouple.clientID,sub);
    }
  }
  return new ArrayList<>(subsForClient.values());
}
Program: 27398
Project: 27398
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  String clientID=(String)NettyUtils.getAttribute(ctx,NettyChannel.ATTR_KEY_CLIENTID);
  if (clientID != null && !clientID.isEmpty()) {
    m_processor.processConnectionLost(new LostConnectionEvent(clientID));
  }
  ctx.close();
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  String clientID=(String)NettyUtils.getAttribute(ctx,NettyChannel.ATTR_KEY_CLIENTID);
  if (clientID != null && !clientID.isEmpty()) {
    boolean stolen=false;
    Boolean stolenAttr=(Boolean)NettyUtils.getAttribute(ctx,NettyChannel.ATTR_KEY_SESSION_STOLEN);
    if (stolenAttr != null && stolenAttr == Boolean.TRUE) {
      stolen=stolenAttr;
    }
    m_processor.processConnectionLost(new LostConnectionEvent(clientID,stolen));
  }
  ctx.close();
}
Program: 27400
Project: 27400
Buggy source:
public void processConnectionLost(LostConnectionEvent evt){
  String clientID=evt.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);
    forwardPublishWill(will,clientID);
    m_willStore.remove(clientID);
  }
}

Fixed version (ground truth):
public void processConnectionLost(LostConnectionEvent evt){
  String clientID=evt.clientID;
  if (evt.sessionStolen && m_clientIDs.remove(clientID) != null) {
    subscriptions.deactivate(clientID);
    LOG.info("String_Node_Str",clientID);
  }
  if (!evt.sessionStolen && m_willStore.containsKey(clientID)) {
    WillMessage will=m_willStore.get(clientID);
    forwardPublishWill(will,clientID);
    m_willStore.remove(clientID);
  }
}
Program: 27401
Project: 27401
Buggy source:
public LostConnectionEvent(String clientID){
  this.clientID=clientID;
}

Fixed version (ground truth):
public LostConnectionEvent(String clientID,boolean stolen){
  this.clientID=clientID;
  this.sessionStolen=stolen;
}
Program: 27402
Project: 27402
Buggy source:
@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);
}

Fixed version (ground truth):
@Override public void removeMessageInSession(String clientID,Integer messageID){
  List<PublishEvent> events=m_persistentMessageStore.get(clientID);
  if (events == null) {
    return;
  }
  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: 27403
Project: 27403
Buggy source:
@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);
}

Fixed version (ground truth):
@Override void init(ChannelPipeline pipeline) throws Exception {
  pipeline.addLast("String_Node_Str",sslHandlerFactory.create());
  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);
}