nus-yam/ex-repair huggingface dataset:
Program: 27300
Project: 27300
Buggy source:
@Override public int compare(Message o1,Message o2){
  int prio1=o1.getPriority().getPrio();
  int prio2=o1.getPriority().getPrio();
  if (prio1 == prio2) {
    return o1.getTimestamp().compareTo(o2.getTimestamp());
  }
  return prio1 - prio2;
}

Fixed version (ground truth):
@Override public int compare(Message o1,Message o2){
  int prio1=o1.getPriority().getPrio();
  int prio2=o2.getPriority().getPrio();
  if (prio1 == prio2) {
    return o1.getTimestamp().compareTo(o2.getTimestamp());
  }
  return prio1 - prio2;
}
Program: 27301
Project: 27301
Buggy source:
public void error(String messageFormat,Object... args){
  if (messagePriorityThreshold <= Priority.ERROR.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.ERROR,currentTimestamp(),String.format(messageFormat,args)));
}

Fixed version (ground truth):
public void error(String messageFormat,Object... args){
  if (messagePriorityThreshold > Priority.ERROR.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.ERROR,currentTimestamp(),String.format(messageFormat,args)));
}
Program: 27302
Project: 27302
Buggy source:
public synchronized List<Message> getMessages(){
  return ImmutableList.copyOf(messages);
}

Fixed version (ground truth):
public synchronized List<Message> getMessages(){
  List<Message> result=new ArrayList<Message>(messages);
  Collections.sort(result,new MessagePriorityComparator());
  Collections.reverse(result);
  return ImmutableList.copyOf(result);
}
Program: 27303
Project: 27303
Buggy source:
public synchronized void addAllMessagesTo(Collection<Message> collection){
  collection.addAll(messages);
}

Fixed version (ground truth):
public synchronized void addAllMessagesTo(Collection<Message> collection){
  for (  Message msg : collection) {
    if (msg.getPriority().getPrio() >= messagePriorityThreshold) {
      addMessage(msg);
      ;
    }
  }
}
Program: 27304
Project: 27304
Buggy source:
public void info(String messageFormat,Object... args){
  if (messagePriorityThreshold <= Priority.INFO.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.INFO,currentTimestamp(),String.format(messageFormat,args)));
}

Fixed version (ground truth):
public void info(String messageFormat,Object... args){
  if (messagePriorityThreshold > Priority.INFO.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.INFO,currentTimestamp(),String.format(messageFormat,args)));
}
Program: 27305
Project: 27305
Buggy source:
public void debug(String messageFormat,Object... args){
  if (messagePriorityThreshold <= Priority.DEBUG.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.DEBUG,currentTimestamp(),String.format(messageFormat,args)));
}

Fixed version (ground truth):
public void debug(String messageFormat,Object... args){
  if (messagePriorityThreshold > Priority.DEBUG.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.DEBUG,currentTimestamp(),String.format(messageFormat,args)));
}
Program: 27306
Project: 27306
Buggy source:
public void warn(String messageFormat,Object... args){
  if (messagePriorityThreshold <= Priority.WARN.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.WARN,currentTimestamp(),String.format(messageFormat,args)));
}

Fixed version (ground truth):
public void warn(String messageFormat,Object... args){
  if (messagePriorityThreshold > Priority.WARN.getPrio()) {
    return;
  }
  addMessage(new Message(Priority.WARN,currentTimestamp(),String.format(messageFormat,args)));
}
Program: 27307
Project: 27307
Buggy source:
public void onItemRangeChanged(int startPosition,int itemCount){
  headersViewByHeadersIds.clear();
  if (startPosition + itemCount >= isHeaderByItemPosition.size()) {
    for (int i=startPosition; i < startPosition + itemCount; i++) {
      if (i >= isHeaderByItemPosition.size()) {
        isHeaderByItemPosition.add(null);
      }
    }
  }
  for (int i=0; i < itemCount; i++) {
    isHeaderByItemPosition.set(i + startPosition,null);
  }
  long startPositionId=adapter.getHeaderId(startPosition);
  if (startPosition > 0) {
    long beforeStartPositionId=adapter.getHeaderId(startPosition - 1);
    isHeaderByItemPosition.set(startPosition,startPositionId != beforeStartPositionId);
  }
  if (startPosition + itemCount < isHeaderByItemPosition.size()) {
    long afterStartPositionId=adapter.getHeaderId(startPosition + itemCount);
    isHeaderByItemPosition.set(startPosition + itemCount,startPositionId != afterStartPositionId);
  }
}

Fixed version (ground truth):
public void onItemRangeChanged(int startPosition,int itemCount){
  headersViewByHeadersIds.clear();
  if (startPosition >= isHeaderByItemPosition.size()) {
    return;
  }
  final int start=Math.min(startPosition,isHeaderByItemPosition.size());
  final int end=Math.min(startPosition + itemCount + 1,isHeaderByItemPosition.size());
  for (int i=start; i < end; ++i) {
    isHeaderByItemPosition.set(i,null);
  }
}
Program: 27308
Project: 27308
Buggy source:
void receivedPublishQos1(Channel channel,MqttPublishMessage msg){
  final Topic topic=new Topic(msg.variableHeader().topicName());
  String clientID=NettyUtils.clientID(channel);
  String username=NettyUtils.userName(channel);
  if (!m_authorizator.canWrite(topic,username,clientID)) {
    LOG.error("String_Node_Str",clientID,topic);
    return;
  }
  final int messageID=msg.variableHeader().messageId();
  IMessagesStore.StoredMessage toStoreMsg=asStoredMessage(msg);
  toStoreMsg.setClientID(clientID);
  this.publisher.publish2Subscribers(toStoreMsg,topic,messageID);
  sendPubAck(clientID,messageID);
  if (msg.fixedHeader().isRetain()) {
    if (!msg.payload().isReadable()) {
      m_messagesStore.cleanRetained(topic);
    }
 else {
      m_messagesStore.storeRetained(topic,toStoreMsg);
    }
  }
  m_interceptor.notifyTopicPublished(msg,clientID,username);
}

Fixed version (ground truth):
void receivedPublishQos1(Channel channel,MqttPublishMessage msg){
  final Topic topic=new Topic(msg.variableHeader().topicName());
  topic.getTokens();
  if (!topic.isValid()) {
    LOG.warn("String_Node_Str");
    channel.close().addListener(CLOSE_ON_FAILURE);
    return;
  }
  String clientID=NettyUtils.clientID(channel);
  String username=NettyUtils.userName(channel);
  if (!m_authorizator.canWrite(topic,username,clientID)) {
    LOG.error("String_Node_Str",clientID,topic);
    return;
  }
  final int messageID=msg.variableHeader().messageId();
  IMessagesStore.StoredMessage toStoreMsg=asStoredMessage(msg);
  toStoreMsg.setClientID(clientID);
  this.publisher.publish2Subscribers(toStoreMsg,topic,messageID);
  sendPubAck(clientID,messageID);
  if (msg.fixedHeader().isRetain()) {
    if (!msg.payload().isReadable()) {
      m_messagesStore.cleanRetained(topic);
    }
 else {
      m_messagesStore.storeRetained(topic,toStoreMsg);
    }
  }
  m_interceptor.notifyTopicPublished(msg,clientID,username);
}
Program: 27309
Project: 27309
Buggy source:
private List<Token> parseTopic(String topic) throws ParseException {
  List<Token> res=new ArrayList<>();
  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;
}

Fixed version (ground truth):
private List<Token> parseTopic(String topic) throws ParseException {
  if (topic.length() == 0) {
    throw new ParseException("String_Node_Str" + "String_Node_Str",0);
  }
  List<Token> res=new ArrayList<>();
  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: 27310
Project: 27310
Buggy source:
void verifyNoPublishIsReceived(){
  final Object messageReceived=m_channel.readOutbound();
  assertNull("String_Node_Str",messageReceived);
}

Fixed version (ground truth):
void verifyNoPublishIsReceived(EmbeddedChannel channel){
  final Object messageReceived=channel.readOutbound();
  assertNull("String_Node_Str",messageReceived);
}
Program: 27314
Project: 27314
Buggy source:
private boolean removeSubscriptions(ConnectionDescriptor descriptor,String clientID){
  final boolean success=descriptor.assignState(ESTABLISHED,SUBSCRIPTIONS_REMOVED);
  if (!success) {
    return false;
  }
  if (descriptor.cleanSession) {
    LOG.trace("String_Node_Str",descriptor.clientID);
    final ClientSession session=this.sessionsRepository.sessionForClient(clientID);
    session.wipeSubscriptions();
    LOG.trace("String_Node_Str",descriptor.clientID);
  }
  return true;
}

Fixed version (ground truth):
private boolean removeSubscriptions(ConnectionDescriptor descriptor,String clientID){
  final boolean success=descriptor.assignState(ESTABLISHED,SUBSCRIPTIONS_REMOVED);
  if (!success) {
    return false;
  }
  if (descriptor.cleanSession) {
    LOG.trace("String_Node_Str",descriptor.clientID);
    final ClientSession session=this.sessionsRepository.sessionForClient(clientID);
    session.wipeSubscriptions();
    for (    Subscription existingSub : session.getSubscriptions()) {
      this.subscriptions.removeSubscription(existingSub.getTopicFilter(),clientID);
    }
    LOG.trace("String_Node_Str",descriptor.clientID);
  }
  return true;
}
Program: 27316
Project: 27316
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  String clientID=NettyUtils.clientID(ctx.channel());
  if (clientID != null && !clientID.isEmpty()) {
    LOG.info("String_Node_Str",clientID);
    m_processor.processConnectionLost(clientID,ctx.channel());
  }
  ctx.close().addListener(CLOSE_ON_FAILURE);
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx){
  String clientID=NettyUtils.clientID(ctx.channel());
  if (clientID != null && !clientID.isEmpty()) {
    LOG.info("String_Node_Str",clientID);
    m_processor.processConnectionLost(clientID,ctx.channel());
  }
  ctx.close().addListener(CLOSE_ON_FAILURE);
}
Program: 27317
Project: 27317
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  LOG.error("String_Node_Str" + "String_Node_Str",NettyUtils.clientID(ctx.channel()),cause.getCause(),cause.getMessage());
  ctx.close().addListener(CLOSE_ON_FAILURE);
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause){
  LOG.error("String_Node_Str",NettyUtils.clientID(ctx.channel()),cause);
  ctx.close().addListener(CLOSE_ON_FAILURE);
}
Program: 27318
Project: 27318
Buggy source:
@Override public void channelRead(ChannelHandlerContext ctx,Object message){
  MqttMessage msg=(MqttMessage)message;
  MqttMessageType messageType=msg.fixedHeader().messageType();
  LOG.debug("String_Node_Str",messageType);
  try {
switch (messageType) {
case CONNECT:
      m_processor.processConnect(ctx.channel(),(MqttConnectMessage)msg);
    break;
case SUBSCRIBE:
  m_processor.processSubscribe(ctx.channel(),(MqttSubscribeMessage)msg);
break;
case UNSUBSCRIBE:
m_processor.processUnsubscribe(ctx.channel(),(MqttUnsubscribeMessage)msg);
break;
case PUBLISH:
m_processor.processPublish(ctx.channel(),(MqttPublishMessage)msg);
break;
case PUBREC:
m_processor.processPubRec(ctx.channel(),msg);
break;
case PUBCOMP:
m_processor.processPubComp(ctx.channel(),msg);
break;
case PUBREL:
m_processor.processPubRel(ctx.channel(),msg);
break;
case DISCONNECT:
m_processor.processDisconnect(ctx.channel());
break;
case PUBACK:
m_processor.processPubAck(ctx.channel(),(MqttPubAckMessage)msg);
break;
case PINGREQ:
MqttFixedHeader pingHeader=new MqttFixedHeader(MqttMessageType.PINGRESP,false,AT_MOST_ONCE,false,0);
MqttMessage pingResp=new MqttMessage(pingHeader);
ctx.writeAndFlush(pingResp).addListener(CLOSE_ON_FAILURE);
break;
default :
LOG.error("String_Node_Str",messageType);
break;
}
}
 catch (Throwable ex) {
LOG.error("String_Node_Str",ex.getCause(),ex);
ctx.fireExceptionCaught(ex);
ctx.close().addListener(CLOSE_ON_FAILURE);
}
 finally {
ReferenceCountUtil.release(msg);
}
}

Fixed version (ground truth):
@Override public void channelRead(ChannelHandlerContext ctx,Object message){
  MqttMessage msg=(MqttMessage)message;
  MqttMessageType messageType=msg.fixedHeader().messageType();
  LOG.debug("String_Node_Str",messageType);
  try {
switch (messageType) {
case CONNECT:
      m_processor.processConnect(ctx.channel(),(MqttConnectMessage)msg);
    break;
case SUBSCRIBE:
  m_processor.processSubscribe(ctx.channel(),(MqttSubscribeMessage)msg);
break;
case UNSUBSCRIBE:
m_processor.processUnsubscribe(ctx.channel(),(MqttUnsubscribeMessage)msg);
break;
case PUBLISH:
m_processor.processPublish(ctx.channel(),(MqttPublishMessage)msg);
break;
case PUBREC:
m_processor.processPubRec(ctx.channel(),msg);
break;
case PUBCOMP:
m_processor.processPubComp(ctx.channel(),msg);
break;
case PUBREL:
m_processor.processPubRel(ctx.channel(),msg);
break;
case DISCONNECT:
m_processor.processDisconnect(ctx.channel());
break;
case PUBACK:
m_processor.processPubAck(ctx.channel(),(MqttPubAckMessage)msg);
break;
case PINGREQ:
MqttFixedHeader pingHeader=new MqttFixedHeader(MqttMessageType.PINGRESP,false,AT_MOST_ONCE,false,0);
MqttMessage pingResp=new MqttMessage(pingHeader);
ctx.writeAndFlush(pingResp).addListener(CLOSE_ON_FAILURE);
break;
default :
LOG.error("String_Node_Str",messageType);
break;
}
}
 catch (Throwable ex) {
ctx.fireExceptionCaught(ex);
}
 finally {
ReferenceCountUtil.release(msg);
}
}
Program: 27319
Project: 27319
Buggy source:
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
  if (ctx.channel().isWritable()) {
    m_processor.notifyChannelWritable(ctx.channel());
  }
  ctx.fireChannelWritabilityChanged();
}

Fixed version (ground truth):
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx){
  if (ctx.channel().isWritable()) {
    m_processor.notifyChannelWritable(ctx.channel());
  }
  ctx.fireChannelWritabilityChanged();
}
Program: 27320
Project: 27320
Buggy source:
/** 
 * 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,MqttUnsubscribeMessage msg){
  List<String> topics=msg.payload().topics();
  String clientID=NettyUtils.clientID(channel);
  LOG.debug("String_Node_Str",clientID,topics);
  ClientSession clientSession=this.sessionsRepository.sessionForClient(clientID);
  for (  String t : topics) {
    Topic topic=new Topic(t);
    boolean validTopic=topic.isValid();
    if (!validTopic) {
      channel.close().addListener(CLOSE_ON_FAILURE);
      LOG.error("String_Node_Str",clientID,topics,topic);
      return;
    }
    LOG.trace("String_Node_Str",clientID,topic);
    subscriptions.removeSubscription(topic,clientID);
    clientSession.unsubscribeFrom(topic);
    String username=NettyUtils.userName(channel);
    m_interceptor.notifyTopicUnsubscribed(topic.toString(),clientID,username);
  }
  int messageID=msg.variableHeader().messageId();
  MqttFixedHeader fixedHeader=new MqttFixedHeader(MqttMessageType.UNSUBACK,false,AT_LEAST_ONCE,false,0);
  MqttUnsubAckMessage ackMessage=new MqttUnsubAckMessage(fixedHeader,from(messageID));
  LOG.debug("String_Node_Str",clientID,topics,messageID);
  channel.writeAndFlush(ackMessage).addListener(FIRE_EXCEPTION_ON_FAILURE);
  LOG.info("String_Node_Str",clientID,topics);
}

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,MqttUnsubscribeMessage msg){
  List<String> topics=msg.payload().topics();
  String clientID=NettyUtils.clientID(channel);
  LOG.debug("String_Node_Str",clientID,topics);
  ClientSession clientSession=this.sessionsRepository.sessionForClient(clientID);
  for (  String t : topics) {
    Topic topic=new Topic(t);
    boolean validTopic=topic.isValid();
    if (!validTopic) {
      channel.close().addListener(CLOSE_ON_FAILURE);
      LOG.error("String_Node_Str",clientID,topics,topic);
      return;
    }
    LOG.trace("String_Node_Str",clientID,topic);
    subscriptions.removeSubscription(topic,clientID);
    clientSession.unsubscribeFrom(topic);
    String username=NettyUtils.userName(channel);
    m_interceptor.notifyTopicUnsubscribed(topic.toString(),clientID,username);
  }
  int messageID=msg.variableHeader().messageId();
  MqttFixedHeader fixedHeader=new MqttFixedHeader(MqttMessageType.UNSUBACK,false,AT_MOST_ONCE,false,0);
  MqttUnsubAckMessage ackMessage=new MqttUnsubAckMessage(fixedHeader,from(messageID));
  LOG.debug("String_Node_Str",clientID,topics,messageID);
  channel.writeAndFlush(ackMessage).addListener(FIRE_EXCEPTION_ON_FAILURE);
  LOG.info("String_Node_Str",clientID,topics);
}
Program: 27322
Project: 27322
Buggy source:
private boolean removeSubscriptions(ConnectionDescriptor descriptor,String clientID){
  final boolean success=descriptor.assignState(ESTABLISHED,SUBSCRIPTIONS_REMOVED);
  if (!success) {
    return false;
  }
  if (descriptor.cleanSession) {
    LOG.info("String_Node_Str",descriptor.clientID);
    subscriptionStore.wipeSubscriptions(clientID);
    LOG.info("String_Node_Str",descriptor.clientID);
  }
  return true;
}

Fixed version (ground truth):
private boolean removeSubscriptions(ConnectionDescriptor descriptor,String clientID){
  final boolean success=descriptor.assignState(ESTABLISHED,SUBSCRIPTIONS_REMOVED);
  if (!success) {
    return false;
  }
  if (descriptor.cleanSession) {
    LOG.info("String_Node_Str",descriptor.clientID);
    final ClientSession session=this.sessionsRepository.sessionForClient(clientID);
    session.wipeSubscriptions();
    LOG.info("String_Node_Str",descriptor.clientID);
  }
  return true;
}
Program: 27323
Project: 27323
Buggy source:
@Override public void onPublish(InterceptPublishMessage msg){
  ByteBuf payload=msg.getPayload();
  byte[] payloadContent=readBytesAndRewind(payload);
  LOG.info("String_Node_Str",msg.getClientID(),msg.getTopicName(),new String(payloadContent));
  ITopic<HazelcastMsg> topic=hz.getTopic("String_Node_Str");
  HazelcastMsg hazelcastMsg=new HazelcastMsg(msg);
  topic.publish(hazelcastMsg);
}

Fixed version (ground truth):
@Override public void onPublish(InterceptPublishMessage msg){
  ByteBuf payload=msg.getPayload();
  byte[] payloadContent=readBytesAndRewind(payload);
  LOG.info("String_Node_Str",msg.getClientID(),msg.getTopicName(),new String(payloadContent,UTF_8));
  ITopic<HazelcastMsg> topic=hz.getTopic("String_Node_Str");
  HazelcastMsg hazelcastMsg=new HazelcastMsg(msg);
  topic.publish(hazelcastMsg);
}
Program: 27324
Project: 27324
Buggy source:
public byte[] getPassword(){
  return msg.payload().password().getBytes();
}

Fixed version (ground truth):
public byte[] getPassword(){
  return msg.payload().password().getBytes(StandardCharsets.UTF_8);
}
Program: 27325
Project: 27325
Buggy source:
public byte[] getWillMessage(){
  return msg.payload().willMessage().getBytes();
}

Fixed version (ground truth):
public byte[] getWillMessage(){
  return msg.payload().willMessage().getBytes(StandardCharsets.UTF_8);
}
Program: 27326
Project: 27326
Buggy source:
public void writeAndFlush(Object payload){
  this.channel.writeAndFlush(payload);
}

Fixed version (ground truth):
public void writeAndFlush(Object payload){
  this.channel.writeAndFlush(payload).addListener(FIRE_EXCEPTION_ON_FAILURE);
}
Program: 27327
Project: 27327
Buggy source:
public void abort(){
  LOG.info("String_Node_Str",clientID);
  this.channel.close();
}

Fixed version (ground truth):
public void abort(){
  LOG.info("String_Node_Str",clientID);
  this.channel.close().addListener(CLOSE_ON_FAILURE);
}
Program: 27328
Project: 27328
Buggy source:
public boolean close(){
  LOG.info("String_Node_Str",clientID);
  final boolean success=assignState(ConnectionState.INTERCEPTORS_NOTIFIED,ConnectionState.DISCONNECTED);
  if (!success) {
    return false;
  }
  this.channel.close();
  return true;
}

Fixed version (ground truth):
public boolean close(){
  LOG.info("String_Node_Str",clientID);
  final boolean success=assignState(ConnectionState.INTERCEPTORS_NOTIFIED,ConnectionState.DISCONNECTED);
  if (!success) {
    return false;
  }
  this.channel.close().addListener(CLOSE_ON_FAILURE);
  return true;
}
Program: 27329
Project: 27329
Buggy source:
@Override public Reader loadResource(String relativePath){
  LOG.info("String_Node_Str",relativePath);
  InputStream is=this.classLoader.getResourceAsStream(relativePath);
  return is != null ? new InputStreamReader(is) : null;
}

Fixed version (ground truth):
@Override public Reader loadResource(String relativePath){
  LOG.info("String_Node_Str",relativePath);
  InputStream is=this.classLoader.getResourceAsStream(relativePath);
  return is != null ? new InputStreamReader(is,StandardCharsets.UTF_8) : null;
}
Program: 27330
Project: 27330
Buggy source:
public Reader loadResource(File f){
  LOG.info("String_Node_Str",f.getAbsolutePath());
  if (f.isDirectory()) {
    LOG.error("String_Node_Str",f.getAbsolutePath());
    throw new ResourceIsDirectoryException("String_Node_Str" + f + "String_Node_Str");
  }
  try {
    return new FileReader(f);
  }
 catch (  FileNotFoundException e) {
    LOG.error("String_Node_Str",f.getAbsolutePath());
    return null;
  }
}

Fixed version (ground truth):
public Reader loadResource(File f){
  LOG.info("String_Node_Str",f.getAbsolutePath());
  if (f.isDirectory()) {
    LOG.error("String_Node_Str",f.getAbsolutePath());
    throw new ResourceIsDirectoryException("String_Node_Str" + f + "String_Node_Str");
  }
  try {
    return Files.newBufferedReader(f.toPath(),UTF_8);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",f.getAbsolutePath());
    return null;
  }
}
Program: 27331
Project: 27331
Buggy source:
@Override public void userEventTriggered(ChannelHandlerContext ctx,Object evt) throws Exception {
  if (evt instanceof IdleStateEvent) {
    IdleState e=((IdleStateEvent)evt).state();
    if (e == IdleState.READER_IDLE) {
      LOG.info("String_Node_Str",NettyUtils.clientID(ctx.channel()));
      ctx.fireChannelInactive();
      ctx.close();
    }
  }
 else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str",NettyUtils.clientID(ctx.channel()),evt.getClass().getName());
    }
    super.userEventTriggered(ctx,evt);
  }
}

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.READER_IDLE) {
      LOG.info("String_Node_Str",NettyUtils.clientID(ctx.channel()));
      ctx.fireChannelInactive();
      ctx.close().addListener(CLOSE_ON_FAILURE);
    }
  }
 else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str",NettyUtils.clientID(ctx.channel()),evt.getClass().getName());
    }
    super.userEventTriggered(ctx,evt);
  }
}
Program: 27332
Project: 27332
Buggy source:
private void initFactory(String host,int port,String protocol,final PipelineInitializer pipeliner){
  LOG.info("String_Node_Str",protocol);
  ServerBootstrap b=new ServerBootstrap();
  b.group(m_bossGroup,m_workerGroup).channel(channelClass).childHandler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ChannelPipeline pipeline=ch.pipeline();
      try {
        pipeliner.init(pipeline);
      }
 catch (      Throwable th) {
        LOG.error("String_Node_Str",th);
        throw th;
      }
    }
  }
).option(ChannelOption.SO_BACKLOG,nettySoBacklog).option(ChannelOption.SO_REUSEADDR,nettySoReuseaddr).option(ChannelOption.TCP_NODELAY,nettyTcpNodelay).childOption(ChannelOption.SO_KEEPALIVE,nettySoKeepalive);
  try {
    LOG.info("String_Node_Str",host,port);
    ChannelFuture f=b.bind(host,port);
    LOG.info("String_Node_Str",host,port);
    f.sync();
  }
 catch (  InterruptedException ex) {
    LOG.error("String_Node_Str",protocol,ex);
  }
}

Fixed version (ground truth):
private void initFactory(String host,int port,String protocol,final PipelineInitializer pipeliner){
  LOG.info("String_Node_Str",protocol);
  ServerBootstrap b=new ServerBootstrap();
  b.group(m_bossGroup,m_workerGroup).channel(channelClass).childHandler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ChannelPipeline pipeline=ch.pipeline();
      try {
        pipeliner.init(pipeline);
      }
 catch (      Throwable th) {
        LOG.error("String_Node_Str",th);
        throw th;
      }
    }
  }
).option(ChannelOption.SO_BACKLOG,nettySoBacklog).option(ChannelOption.SO_REUSEADDR,nettySoReuseaddr).option(ChannelOption.TCP_NODELAY,nettyTcpNodelay).childOption(ChannelOption.SO_KEEPALIVE,nettySoKeepalive);
  try {
    LOG.info("String_Node_Str",host,port);
    ChannelFuture f=b.bind(host,port);
    LOG.info("String_Node_Str",host,port);
    f.sync().addListener(FIRE_EXCEPTION_ON_FAILURE);
  }
 catch (  InterruptedException ex) {
    LOG.error("String_Node_Str",protocol,ex);
  }
}
Program: 27333
Project: 27333
Buggy source:
public void close(){
  LOG.info("String_Node_Str");
  if (m_workerGroup == null || m_bossGroup == null) {
    LOG.error("String_Node_Str");
    throw new IllegalStateException("String_Node_Str");
  }
  Future<?> workerWaiter=m_workerGroup.shutdownGracefully();
  Future<?> bossWaiter=m_bossGroup.shutdownGracefully();
  LOG.info("String_Node_Str");
  try {
    workerWaiter.await(10,TimeUnit.SECONDS);
    bossWaiter.await(10,TimeUnit.SECONDS);
  }
 catch (  InterruptedException iex) {
    LOG.warn("String_Node_Str");
  }
  if (!m_workerGroup.isTerminated()) {
    LOG.warn("String_Node_Str");
    m_workerGroup.shutdownGracefully(0L,0L,TimeUnit.MILLISECONDS);
  }
  if (!m_bossGroup.isTerminated()) {
    LOG.warn("String_Node_Str");
    m_bossGroup.shutdownGracefully(0L,0L,TimeUnit.MILLISECONDS);
  }
  LOG.info("String_Node_Str");
  MessageMetrics metrics=m_metricsCollector.computeMetrics();
  LOG.info("String_Node_Str",metrics.messagesRead(),metrics.messagesWrote());
  LOG.info("String_Node_Str");
  BytesMetrics bytesMetrics=m_bytesMetricsCollector.computeMetrics();
  LOG.info("String_Node_Str",bytesMetrics.readBytes(),bytesMetrics.wroteBytes());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void close(){
  LOG.info("String_Node_Str");
  if (m_workerGroup == null || m_bossGroup == null) {
    LOG.error("String_Node_Str");
    throw new IllegalStateException("String_Node_Str");
  }
  Future<?> workerWaiter=m_workerGroup.shutdownGracefully();
  Future<?> bossWaiter=m_bossGroup.shutdownGracefully();
  LOG.info("String_Node_Str");
  try {
    workerWaiter.await(10,TimeUnit.SECONDS);
    bossWaiter.await(10,TimeUnit.SECONDS);
  }
 catch (  InterruptedException iex) {
    LOG.warn("String_Node_Str");
  }
  if (!m_workerGroup.isTerminated()) {
    LOG.warn("String_Node_Str");
    m_workerGroup.shutdownGracefully(0L,0L,TimeUnit.MILLISECONDS);
  }
  if (!m_bossGroup.isTerminated()) {
    LOG.warn("String_Node_Str");
    m_bossGroup.shutdownGracefully(0L,0L,TimeUnit.MILLISECONDS);
  }
  LOG.info("String_Node_Str");
  MessageMetrics metrics=m_metricsCollector.computeMetrics();
  LOG.info("String_Node_Str",metrics.messagesRead(),metrics.messagesWrote());
  LOG.info("String_Node_Str");
  BytesMetrics bytesMetrics=m_bytesMetricsCollector.computeMetrics();
  LOG.info("String_Node_Str",bytesMetrics.readBytes(),bytesMetrics.wroteBytes());
}
Program: 27334
Project: 27334
Buggy source:
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  String clientID=NettyUtils.clientID(ctx.channel());
  if (clientID != null && !clientID.isEmpty()) {
    LOG.info("String_Node_Str",clientID);
    m_processor.processConnectionLost(clientID,ctx.channel());
  }
  ctx.close();
}

Fixed version (ground truth):
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  String clientID=NettyUtils.clientID(ctx.channel());
  if (clientID != null && !clientID.isEmpty()) {
    LOG.info("String_Node_Str",clientID);
    m_processor.processConnectionLost(clientID,ctx.channel());
  }
  ctx.close().addListener(CLOSE_ON_FAILURE);
}
Program: 27335
Project: 27335
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  LOG.error("String_Node_Str" + "String_Node_Str",NettyUtils.clientID(ctx.channel()),cause.getCause(),cause.getMessage());
  ctx.close();
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
  LOG.error("String_Node_Str" + "String_Node_Str",NettyUtils.clientID(ctx.channel()),cause.getCause(),cause.getMessage());
  ctx.close().addListener(CLOSE_ON_FAILURE);
}
Program: 27336
Project: 27336
Buggy source:
@Override public void channelRead(ChannelHandlerContext ctx,Object message){
  MqttMessage msg=(MqttMessage)message;
  MqttMessageType messageType=msg.fixedHeader().messageType();
  LOG.debug("String_Node_Str",messageType);
  try {
switch (messageType) {
case CONNECT:
      m_processor.processConnect(ctx.channel(),(MqttConnectMessage)msg);
    break;
case SUBSCRIBE:
  m_processor.processSubscribe(ctx.channel(),(MqttSubscribeMessage)msg);
break;
case UNSUBSCRIBE:
m_processor.processUnsubscribe(ctx.channel(),(MqttUnsubscribeMessage)msg);
break;
case PUBLISH:
m_processor.processPublish(ctx.channel(),(MqttPublishMessage)msg);
break;
case PUBREC:
m_processor.processPubRec(ctx.channel(),msg);
break;
case PUBCOMP:
m_processor.processPubComp(ctx.channel(),msg);
break;
case PUBREL:
m_processor.processPubRel(ctx.channel(),msg);
break;
case DISCONNECT:
m_processor.processDisconnect(ctx.channel());
break;
case PUBACK:
m_processor.processPubAck(ctx.channel(),(MqttPubAckMessage)msg);
break;
case PINGREQ:
MqttFixedHeader pingHeader=new MqttFixedHeader(MqttMessageType.PINGRESP,false,AT_MOST_ONCE,false,0);
MqttMessage pingResp=new MqttMessage(pingHeader);
ctx.writeAndFlush(pingResp);
break;
default :
LOG.error("String_Node_Str",messageType);
break;
}
}
 catch (Throwable ex) {
LOG.error("String_Node_Str" + ex.getCause(),ex);
ctx.fireExceptionCaught(ex);
ctx.close();
}
 finally {
ReferenceCountUtil.release(msg);
}
}

Fixed version (ground truth):
@Override public void channelRead(ChannelHandlerContext ctx,Object message){
  MqttMessage msg=(MqttMessage)message;
  MqttMessageType messageType=msg.fixedHeader().messageType();
  LOG.debug("String_Node_Str",messageType);
  try {
switch (messageType) {
case CONNECT:
      m_processor.processConnect(ctx.channel(),(MqttConnectMessage)msg);
    break;
case SUBSCRIBE:
  m_processor.processSubscribe(ctx.channel(),(MqttSubscribeMessage)msg);
break;
case UNSUBSCRIBE:
m_processor.processUnsubscribe(ctx.channel(),(MqttUnsubscribeMessage)msg);
break;
case PUBLISH:
m_processor.processPublish(ctx.channel(),(MqttPublishMessage)msg);
break;
case PUBREC:
m_processor.processPubRec(ctx.channel(),msg);
break;
case PUBCOMP:
m_processor.processPubComp(ctx.channel(),msg);
break;
case PUBREL:
m_processor.processPubRel(ctx.channel(),msg);
break;
case DISCONNECT:
m_processor.processDisconnect(ctx.channel());
break;
case PUBACK:
m_processor.processPubAck(ctx.channel(),(MqttPubAckMessage)msg);
break;
case PINGREQ:
MqttFixedHeader pingHeader=new MqttFixedHeader(MqttMessageType.PINGRESP,false,AT_MOST_ONCE,false,0);
MqttMessage pingResp=new MqttMessage(pingHeader);
ctx.writeAndFlush(pingResp).addListener(CLOSE_ON_FAILURE);
break;
default :
LOG.error("String_Node_Str",messageType);
break;
}
}
 catch (Throwable ex) {
LOG.error("String_Node_Str",ex.getCause(),ex);
ctx.fireExceptionCaught(ex);
ctx.close().addListener(CLOSE_ON_FAILURE);
}
 finally {
ReferenceCountUtil.release(msg);
}
}
Program: 27337
Project: 27337
Buggy source:
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  BytesMetrics metrics=ctx.channel().attr(ATTR_KEY_METRICS).get();
  metrics.incrementWrote(((ByteBuf)msg).writableBytes());
  ctx.write(msg,promise);
}

Fixed version (ground truth):
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  BytesMetrics metrics=ctx.channel().attr(ATTR_KEY_METRICS).get();
  metrics.incrementWrote(((ByteBuf)msg).writableBytes());
  ctx.write(msg,promise).addListener(CLOSE_ON_FAILURE);
}
Program: 27338
Project: 27338
Buggy source:
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  logMQTTMessage(ctx,msg,"String_Node_Str");
  ctx.write(msg,promise);
}

Fixed version (ground truth):
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  logMQTTMessage(ctx,msg,"String_Node_Str");
  ctx.write(msg,promise).addListener(CLOSE_ON_FAILURE);
}
Program: 27339
Project: 27339
Buggy source:
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  MessageMetrics metrics=ctx.channel().attr(ATTR_KEY_METRICS).get();
  metrics.incrementWrote(1);
  ctx.write(msg,promise);
}

Fixed version (ground truth):
@Override public void write(ChannelHandlerContext ctx,Object msg,ChannelPromise promise) throws Exception {
  MessageMetrics metrics=ctx.channel().attr(ATTR_KEY_METRICS).get();
  metrics.incrementWrote(1);
  ctx.write(msg,promise).addListener(CLOSE_ON_FAILURE);
}
Program: 27340
Project: 27340
Buggy source:
void assignDefaults(){
  setProperty(BrokerConstants.PORT_PROPERTY_NAME,Integer.toString(BrokerConstants.PORT));
  setProperty(BrokerConstants.HOST_PROPERTY_NAME,BrokerConstants.HOST);
  setProperty(BrokerConstants.PASSWORD_FILE_PROPERTY_NAME,"String_Node_Str");
  setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME,Boolean.TRUE.toString());
  setProperty(BrokerConstants.AUTHENTICATOR_CLASS_NAME,"String_Node_Str");
  setProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME,"String_Node_Str");
}

Fixed version (ground truth):
void assignDefaults(){
  setProperty(BrokerConstants.PORT_PROPERTY_NAME,Integer.toString(BrokerConstants.PORT));
  setProperty(BrokerConstants.HOST_PROPERTY_NAME,BrokerConstants.HOST);
  setProperty(BrokerConstants.PASSWORD_FILE_PROPERTY_NAME,"String_Node_Str");
  setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME,Boolean.TRUE.toString());
  setProperty(BrokerConstants.AUTHENTICATOR_CLASS_NAME,"String_Node_Str");
  setProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME,"String_Node_Str");
  setProperty(BrokerConstants.NETTY_MAX_BYTES_PROPERTY_NAME,String.valueOf(BrokerConstants.DEFAULT_NETTY_MAX_BYTES_IN_MESSAGE));
}
Program: 27341
Project: 27341
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",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(nettyChannelTimeoutSeconds,0,0));
  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",MqttEncoder.INSTANCE);
  pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
  pipeline.addLast("String_Node_Str",new MQTTMessageLogger());
  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(nettyChannelTimeoutSeconds,0,0));
  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(maxBytesInMessage));
  pipeline.addLast("String_Node_Str",MqttEncoder.INSTANCE);
  pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
  pipeline.addLast("String_Node_Str",new MQTTMessageLogger());
  pipeline.addLast("String_Node_Str",handler);
}
Program: 27343
Project: 27343
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: 27347
Project: 27347
Buggy source:
/** 
 * Create the SUBACK response from a list of topicFilters
 */
private MqttSubAckMessage doAckMessageFromValidateFilters(List<MqttTopicSubscription> topicFilters,int messageId){
  List<Integer> grantedQoSLevels=new ArrayList<>();
  for (  MqttTopicSubscription req : topicFilters) {
    grantedQoSLevels.add(req.qualityOfService().value());
  }
  MqttFixedHeader fixedHeader=new MqttFixedHeader(MqttMessageType.SUBACK,false,AT_LEAST_ONCE,false,0);
  MqttSubAckPayload payload=new MqttSubAckPayload(grantedQoSLevels);
  return new MqttSubAckMessage(fixedHeader,from(messageId),payload);
}

Fixed version (ground truth):
/** 
 * Create the SUBACK response from a list of topicFilters
 */
private MqttSubAckMessage doAckMessageFromValidateFilters(List<MqttTopicSubscription> topicFilters,int messageId){
  List<Integer> grantedQoSLevels=new ArrayList<>();
  for (  MqttTopicSubscription req : topicFilters) {
    grantedQoSLevels.add(req.qualityOfService().value());
  }
  MqttFixedHeader fixedHeader=new MqttFixedHeader(MqttMessageType.SUBACK,false,AT_MOST_ONCE,false,0);
  MqttSubAckPayload payload=new MqttSubAckPayload(grantedQoSLevels);
  return new MqttSubAckMessage(fixedHeader,from(messageId),payload);
}
Program: 27348
Project: 27348
Buggy source:
/** 
 * Specialized version to publish will testament message.
 */
private void forwardPublishWill(WillMessage will,String clientID){
  LOG.info("String_Node_Str",clientID,will.getTopic());
  IMessagesStore.StoredMessage tobeStored=asStoredMessage(will);
  tobeStored.setClientID(clientID);
  Topic topic=new Topic(tobeStored.getTopic());
  this.messagesPublisher.publish2Subscribers(tobeStored,topic);
}

Fixed version (ground truth):
/** 
 * Specialized version to publish will testament message.
 */
private void forwardPublishWill(WillMessage will,String clientID){
  LOG.info("String_Node_Str",clientID,will.getTopic());
  IMessagesStore.StoredMessage tobeStored=asStoredMessage(will);
  tobeStored.setClientID(clientID);
  Topic topic=new Topic(tobeStored.getTopic());
  this.messagesPublisher.publish2Subscribers(tobeStored,topic);
  if (will.isRetained()) {
    m_messagesStore.storeRetained(topic,tobeStored);
  }
}
Program: 27349
Project: 27349
Buggy source:
void assignDefaults(){
  setProperty(BrokerConstants.PORT_PROPERTY_NAME,Integer.toString(BrokerConstants.PORT));
  setProperty(BrokerConstants.HOST_PROPERTY_NAME,BrokerConstants.HOST);
  setProperty(BrokerConstants.PASSWORD_FILE_PROPERTY_NAME,"String_Node_Str");
  setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME,Boolean.TRUE.toString());
  setProperty(BrokerConstants.AUTHENTICATOR_CLASS_NAME,"String_Node_Str");
  setProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME,"String_Node_Str");
}

Fixed version (ground truth):
void assignDefaults(){
  setProperty(BrokerConstants.PORT_PROPERTY_NAME,Integer.toString(BrokerConstants.PORT));
  setProperty(BrokerConstants.HOST_PROPERTY_NAME,BrokerConstants.HOST);
  setProperty(BrokerConstants.PASSWORD_FILE_PROPERTY_NAME,"String_Node_Str");
  setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME,Boolean.TRUE.toString());
  setProperty(BrokerConstants.AUTHENTICATOR_CLASS_NAME,"String_Node_Str");
  setProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME,"String_Node_Str");
  setProperty(BrokerConstants.NETTY_MAX_BYTES_PROPERTY_NAME,String.valueOf(BrokerConstants.DEFAULT_NETTY_MAX_BYTES_IN_MESSAGE));
}
Program: 27350
Project: 27350
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",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(nettyChannelTimeoutSeconds,0,0));
  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",MqttEncoder.INSTANCE);
  pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
  pipeline.addLast("String_Node_Str",new MQTTMessageLogger());
  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(nettyChannelTimeoutSeconds,0,0));
  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(maxBytesInMessage));
  pipeline.addLast("String_Node_Str",MqttEncoder.INSTANCE);
  pipeline.addLast("String_Node_Str",new MessageMetricsHandler(m_metricsCollector));
  pipeline.addLast("String_Node_Str",new MQTTMessageLogger());
  pipeline.addLast("String_Node_Str",handler);
}