nus-yam/ex-repair huggingface dataset:
Program: 37813
Project: 37813
Buggy source:
/** 
 * Installs flow through one switch.
 * @param message command message for flow installation
 */
private void doInstallOneSwitchFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallOneSwitchFlow command=(InstallOneSwitchFlow)message.getData();
  logger.debug("String_Node_Str",command);
  Long meterId=command.getMeterId();
  if (meterId == null) {
    logger.error("String_Node_Str",command.getCookie());
    meterId=(long)meterPool.allocate(command.getSwitchId(),command.getId());
    logger.error("String_Node_Str",meterId,command.getCookie());
  }
  try {
    context.getSwitchManager().installMeter(DatapathId.of(command.getSwitchId()),command.getBandwidth(),1024,meterId);
    OutputVlanType directOutputVlanType=command.getOutputVlanType();
    context.getSwitchManager().installOneSwitchFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getInputVlanId(),command.getOutputVlanId(),directOutputVlanType,meterId);
    message.setDestination(replyDestination);
    context.getKafkaProducer().postMessage(replyToTopic,message);
  }
 catch (  SwitchOperationException e) {
    throw new FlowCommandException(command.getId(),ErrorType.CREATION_FAILURE,e);
  }
}

Fixed version (ground truth):
/** 
 * Installs flow through one switch.
 * @param message command message for flow installation
 */
private void doInstallOneSwitchFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallOneSwitchFlow command=(InstallOneSwitchFlow)message.getData();
  logger.debug("String_Node_Str",command);
  Long meterId=command.getMeterId();
  if (meterId == null) {
    logger.error("String_Node_Str",command.getCookie());
    meterId=(long)meterPool.allocate(command.getSwitchId(),command.getId());
    logger.error("String_Node_Str",meterId,command.getCookie());
  }
  try {
    context.getSwitchManager().installMeter(DatapathId.of(command.getSwitchId()),command.getBandwidth(),1024,meterId);
    OutputVlanType directOutputVlanType=command.getOutputVlanType();
    context.getSwitchManager().installOneSwitchFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getInputVlanId(),command.getOutputVlanId(),directOutputVlanType,meterId);
    if (!StringUtils.isBlank(replyToTopic)) {
      message.setDestination(replyDestination);
      context.getKafkaProducer().postMessage(replyToTopic,message);
    }
  }
 catch (  SwitchOperationException e) {
    throw new FlowCommandException(command.getId(),ErrorType.CREATION_FAILURE,e);
  }
}
Program: 37814
Project: 37814
Buggy source:
protected void doControllerMsg(CommandMessage message){
  final String replyToTopic;
  if (message instanceof CommandWithReplyToMessage) {
    replyToTopic=((CommandWithReplyToMessage)message).getReplyTo();
  }
 else {
    replyToTopic=OUTPUT_FLOW_TOPIC;
  }
  final Destination replyDestination=getDestinationForTopic(replyToTopic);
  try {
    CommandData data=message.getData();
    if (data instanceof DiscoverIslCommandData) {
      doDiscoverIslCommand(data);
    }
 else     if (data instanceof DiscoverPathCommandData) {
      doDiscoverPathCommand(data);
    }
 else     if (data instanceof InstallIngressFlow) {
      doInstallIngressFlow(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof InstallEgressFlow) {
      doInstallEgressFlow(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof InstallTransitFlow) {
      doInstallTransitFlow(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof InstallOneSwitchFlow) {
      doInstallOneSwitchFlow(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof RemoveFlow) {
      doDeleteFlow(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof NetworkCommandData) {
      doNetworkDump(message);
    }
 else     if (data instanceof SwitchRulesDeleteRequest) {
      doDeleteSwitchRules(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof SwitchRulesInstallRequest) {
      doInstallSwitchRules(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof ConnectModeRequest) {
      doConnectMode(message,replyToTopic,replyDestination);
    }
 else     if (data instanceof DumpRulesRequest) {
      doDumpRulesRequest(message);
    }
 else     if (data instanceof InstallMissedFlowsRequest) {
      doSyncRulesRequest(message);
    }
 else {
      logger.error("String_Node_Str",data.toString());
    }
  }
 catch (  FlowCommandException e) {
    ErrorMessage error=new ErrorMessage(e.makeErrorResponse(),System.currentTimeMillis(),message.getCorrelationId(),replyDestination);
    context.getKafkaProducer().postMessage(replyToTopic,error);
  }
catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
protected void doControllerMsg(CommandMessage message){
  final String replyToTopic;
  if (message instanceof CommandWithReplyToMessage) {
    replyToTopic=((CommandWithReplyToMessage)message).getReplyTo();
  }
 else {
    replyToTopic=OUTPUT_FLOW_TOPIC;
  }
  final Destination replyDestination=getDestinationForTopic(replyToTopic);
  try {
    CommandData data=message.getData();
    handleCommand(message,data,replyToTopic,replyDestination);
  }
 catch (  FlowCommandException e) {
    ErrorMessage error=new ErrorMessage(e.makeErrorResponse(),System.currentTimeMillis(),message.getCorrelationId(),replyDestination);
    context.getKafkaProducer().postMessage(replyToTopic,error);
  }
catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}
Program: 37815
Project: 37815
Buggy source:
/** 
 * Installs ingress flow on the switch.
 * @param message command message for flow installation
 */
private void doInstallIngressFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallIngressFlow command=(InstallIngressFlow)message.getData();
  logger.debug("String_Node_Str",command);
  Long meterId=command.getMeterId();
  if (meterId == null) {
    logger.error("String_Node_Str",command.getCookie());
    meterId=(long)meterPool.allocate(command.getSwitchId(),command.getId());
    logger.error("String_Node_Str",meterId,command.getCookie());
  }
  try {
    context.getSwitchManager().installMeter(DatapathId.of(command.getSwitchId()),command.getBandwidth(),1024,meterId);
    context.getSwitchManager().installIngressFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getInputVlanId(),command.getTransitVlanId(),command.getOutputVlanType(),meterId);
    message.setDestination(replyDestination);
    context.getKafkaProducer().postMessage(replyToTopic,message);
  }
 catch (  SwitchOperationException e) {
    throw new FlowCommandException(command.getId(),ErrorType.CREATION_FAILURE,e);
  }
}

Fixed version (ground truth):
/** 
 * Installs ingress flow on the switch.
 * @param message command message for flow installation
 */
private void doInstallIngressFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallIngressFlow command=(InstallIngressFlow)message.getData();
  logger.debug("String_Node_Str",command);
  Long meterId=command.getMeterId();
  if (meterId == null) {
    logger.error("String_Node_Str",command.getCookie());
    meterId=(long)meterPool.allocate(command.getSwitchId(),command.getId());
    logger.error("String_Node_Str",meterId,command.getCookie());
  }
  try {
    context.getSwitchManager().installMeter(DatapathId.of(command.getSwitchId()),command.getBandwidth(),1024,meterId);
    context.getSwitchManager().installIngressFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getInputVlanId(),command.getTransitVlanId(),command.getOutputVlanType(),meterId);
    if (!StringUtils.isBlank(replyToTopic)) {
      message.setDestination(replyDestination);
      context.getKafkaProducer().postMessage(replyToTopic,message);
    }
  }
 catch (  SwitchOperationException e) {
    throw new FlowCommandException(command.getId(),ErrorType.CREATION_FAILURE,e);
  }
}
Program: 37816
Project: 37816
Buggy source:
private void doDumpRulesRequest(final CommandMessage message){
  DumpRulesRequest request=(DumpRulesRequest)message.getData();
  final String switchId=request.getSwitchId();
  logger.debug("String_Node_Str",switchId);
  OFFlowStatsReply reply=context.getSwitchManager().dumpFlowTable(DatapathId.of(switchId));
  List<FlowEntry> flows=reply.getEntries().stream().map(OFFlowStatsConverter::toFlowEntry).collect(Collectors.toList());
  SwitchFlowEntries response=SwitchFlowEntries.builder().switchId(switchId).flowEntries(flows).build();
  InfoMessage infoMessage=new InfoMessage(response,message.getTimestamp(),message.getCorrelationId());
  context.getKafkaProducer().postMessage(OUTPUT_FLOW_TOPIC,infoMessage);
}

Fixed version (ground truth):
private void doDumpRulesRequest(final CommandMessage message){
  DumpRulesRequest request=(DumpRulesRequest)message.getData();
  final String switchId=request.getSwitchId();
  logger.debug("String_Node_Str",switchId);
  OFFlowStatsReply reply=context.getSwitchManager().dumpFlowTable(DatapathId.of(switchId));
  List<FlowEntry> flows=reply.getEntries().stream().map(OFFlowStatsConverter::toFlowEntry).collect(Collectors.toList());
  SwitchFlowEntries response=SwitchFlowEntries.builder().switchId(switchId).flowEntries(flows).build();
  InfoMessage infoMessage=new InfoMessage(response,message.getTimestamp(),message.getCorrelationId());
  context.getKafkaProducer().postMessage(TOPO_ENG_TOPIC,infoMessage);
}
Program: 37817
Project: 37817
Buggy source:
/** 
 * Installs transit flow on the switch.
 * @param message command message for flow installation
 */
private void doInstallTransitFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallTransitFlow command=(InstallTransitFlow)message.getData();
  logger.debug("String_Node_Str",command);
  try {
    context.getSwitchManager().installTransitFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getTransitVlanId());
    message.setDestination(replyDestination);
    context.getKafkaProducer().postMessage(replyToTopic,message);
  }
 catch (  SwitchOperationException e) {
    throw new FlowCommandException(command.getId(),ErrorType.CREATION_FAILURE,e);
  }
}

Fixed version (ground truth):
/** 
 * Installs transit flow on the switch.
 * @param message command message for flow installation
 */
private void doInstallTransitFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallTransitFlow command=(InstallTransitFlow)message.getData();
  logger.debug("String_Node_Str",command);
  try {
    context.getSwitchManager().installTransitFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getTransitVlanId());
    if (!StringUtils.isBlank(replyToTopic)) {
      message.setDestination(replyDestination);
      context.getKafkaProducer().postMessage(replyToTopic,message);
    }
  }
 catch (  SwitchOperationException e) {
    throw new FlowCommandException(command.getId(),ErrorType.CREATION_FAILURE,e);
  }
}
Program: 37818
Project: 37818
Buggy source:
@After public void verifyMocks(){
  verify(topologyEngineService).getActiveSwitches();
  verify(topologyEngineService).getActiveLinks();
  verify(topologyDefinition,times(3)).getActiveSwitches();
  verify(topologyDefinition).getIslsForActiveSwitches();
}

Fixed version (ground truth):
@After public void verifyMocks(){
  verify(topologyEngineService).getActiveSwitches();
  verify(topologyEngineService).getActiveLinks();
  verify(topologyDefinition,times(2)).getActiveSwitches();
  verify(topologyDefinition).getIslsForActiveSwitches();
}
Program: 37820
Project: 37820
Buggy source:
@Override public StormTopology createTopology() throws NameCollisionException {
}

Fixed version (ground truth):
@Override public StormTopology createTopology() throws NameCollisionException {
  final String clazzName=this.getClass().getSimpleName();
  logger.debug("String_Node_Str",clazzName);
  TopologyBuilder builder=new TopologyBuilder();
  String topoDiscoTopic=config.getKafkaTopoDiscoTopic();
  checkAndCreateTopic(topoDiscoTopic);
  logger.debug("String_Node_Str",topoDiscoTopic);
  builder.setSpout(TOPO_DISCO_SPOUT,createKafkaSpout(topoDiscoTopic,clazzName + topoDiscoTopic));
  TopoDiscoParseBolt topoDiscoParseBolt=new TopoDiscoParseBolt();
  builder.setBolt(TOPO_DISCO_PARSE_BOLT_NAME,topoDiscoParseBolt,config.getParallelism()).shuffleGrouping(TopoDiscoParseBolt.TOPO_TO_PORT_INFO_STREAM,PARSE_PORT_INFO_BOLT_NAME);
  ParsePortInfoBolt parsePortInfoBolt=new ParsePortInfoBolt();
  builder.setBolt(PARSE_PORT_INFO_BOLT_NAME,parsePortInfoBolt,config.getParallelism()).shuffleGrouping(TopoDiscoParseBolt.TOPO_TO_PORT_INFO_STREAM,TOPO_DISCO_PARSE_BOLT_NAME).shuffleGrouping(WfmStatsParseBolt.WFM_TO_PARSE_PORT_INFO_STREAM,WFM_STATS_PARSE_BOLT_NAME);
  final String openTsdbTopic=config.getKafkaOtsdbTopic();
  checkAndCreateTopic(openTsdbTopic);
  KafkaBolt openTsdbBolt=createKafkaBolt(openTsdbTopic);
  builder.setBolt(OtsdbKafkaBoltName,openTsdbBolt,config.getParallelism()).shuffleGrouping(PARSE_PORT_INFO_BOLT_NAME);
  String wfmStatsTopic=config.getKafkaStatsTopic();
  checkAndCreateTopic(wfmStatsTopic);
  logger.debug("String_Node_Str",wfmStatsTopic);
  builder.setSpout(WFM_STATS_SPOUT,createKafkaSpout(wfmStatsTopic,clazzName + wfmStatsTopic));
  WfmStatsParseBolt wfmStatsParseBolt=new WfmStatsParseBolt();
  builder.setBolt(WFM_STATS_PARSE_BOLT_NAME,wfmStatsParseBolt,config.getParallelism()).shuffleGrouping(WFM_STATS_SPOUT);
  SwitchPortsSpout switchPortsSpout=new SwitchPortsSpout(JANITOR_REFRESH);
  builder.setSpout(SWITCH_PORTS_SPOUT_NAME,switchPortsSpout);
  final String speakerTopic=config.getKafkaSpeakerTopic();
  checkAndCreateTopic(speakerTopic);
  KafkaBolt speakerBolt=createKafkaBolt(speakerTopic);
  builder.setBolt(SpeakerBoltName,speakerBolt,config.getParallelism()).shuffleGrouping(SWITCH_PORTS_SPOUT_NAME);
  return builder.createTopology();
}
Program: 37821
Project: 37821
Buggy source:
@Override public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer){
  outputFieldsDeclarer.declareStream(PARSE_PORT_INFO_STREAM,new Fields(FIELD_NAME));
}

Fixed version (ground truth):
@Override public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer){
  outputFieldsDeclarer.declareStream(TOPO_TO_PORT_INFO_STREAM,new Fields(FIELD_NAME));
}
Program: 37822
Project: 37822
Buggy source:
private void doParseMessage(Tuple tuple){
  try {
    InfoData infoData=getInfoData(tuple);
    if (infoData instanceof PortInfoData) {
      collector.emit(PARSE_PORT_INFO_STREAM,new Values((PortInfoData)infoData));
    }
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",tuple.toString(),e);
  }
catch (  MessageException e) {
  }
 finally {
    collector.ack(tuple);
  }
}

Fixed version (ground truth):
private void doParseMessage(Tuple tuple){
  try {
    InfoData infoData=getInfoData(tuple);
    if (infoData instanceof PortInfoData) {
      collector.emit(TOPO_TO_PORT_INFO_STREAM,new Values((PortInfoData)infoData));
    }
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",tuple.toString(),e);
  }
catch (  MessageException e) {
  }
 finally {
    collector.ack(tuple);
  }
}
Program: 37823
Project: 37823
Buggy source:
/** 
 * Chk string is not empty.
 * @param value the value
 * @return true, if successful
 */
public static boolean chkStringIsNotEmpty(Object value){
  boolean flag=false;
  if (value != null) {
    String string=String.valueOf(value);
    if (string != null && !"String_Node_Str".equalsIgnoreCase(string.trim()) && string.length() > 0 && !"String_Node_Str".equalsIgnoreCase(string)) {
      flag=true;
    }
  }
  return flag;
}

Fixed version (ground truth):
/** 
 * Chk string is not empty.
 * @param value the value
 * @return true, if successful
 */
public static boolean chkStringIsNotEmpty(String value){
  if (value != null) {
    Predicate<String> predicates=s -> {
      return value.trim().length() > 0;
    }
;
    return predicates.test(value);
  }
  return false;
}
Program: 37824
Project: 37824
Buggy source:
@Override public void execute(Tuple input){
  StatsComponentType componentId=StatsComponentType.valueOf(input.getSourceComponent());
  InfoMessage message=(InfoMessage)input.getValueByField(MESSAGE_FIELD);
  if (!Destination.WFM_STATS.equals(message.getDestination())) {
    collector.ack(input);
    return;
  }
  LOGGER.debug("String_Node_Str",CORRELATION_ID,message.getCorrelationId(),componentId,StatsStreamType.valueOf(input.getSourceStreamId()));
  PortStatsData data=(PortStatsData)message.getData();
  long timestamp=message.getTimestamp();
  try {
    String switchId=data.getSwitchId().replaceAll("String_Node_Str","String_Node_Str");
    for (    PortStatsReply reply : data.getStats()) {
      for (      PortStatsEntry entry : reply.getEntries()) {
        emit(entry,timestamp,switchId);
      }
    }
  }
  finally {
    collector.ack(input);
  }
}

Fixed version (ground truth):
@Override public void execute(Tuple input){
  StatsComponentType componentId=StatsComponentType.valueOf(input.getSourceComponent());
  InfoMessage message=(InfoMessage)input.getValueByField(MESSAGE_FIELD);
  if (!Destination.WFM_STATS.equals(message.getDestination())) {
    collector.ack(input);
    return;
  }
  LOGGER.debug("String_Node_Str",CORRELATION_ID,message.getCorrelationId(),componentId,StatsStreamType.valueOf(input.getSourceStreamId()));
  PortStatsData data=(PortStatsData)message.getData();
  long timestamp=message.getTimestamp();
  try {
    String switchId=switchNameCache.get(data.getSwitchId());
    if (switchId == null) {
      switchId="String_Node_Str" + data.getSwitchId().replaceAll("String_Node_Str","String_Node_Str").toUpperCase();
      switchNameCache.put(data.getSwitchId(),switchId);
    }
    for (    PortStatsReply reply : data.getStats()) {
      for (      PortStatsEntry entry : reply.getEntries()) {
        emit(entry,timestamp,switchId);
      }
    }
  }
  finally {
    collector.ack(input);
  }
}
Program: 37825
Project: 37825
Buggy source:
public void handleFailed(String switchId,String portId){
  Node node=new Node(switchId,portId);
  List<DiscoveryNode> subjectList=filterQueue(node);
  if (subjectList.size() == 0) {
    logger.warn("String_Node_Str",node);
  }
 else {
    DiscoveryNode subject=subjectList.get(0);
    subject.countFailure();
    logger.info("String_Node_Str",subject);
  }
}

Fixed version (ground truth):
/** 
 * ISL Failure Event
 * @return true if this is new .. ie this isn't a consecutive failure.
 */
public boolean handleFailed(String switchId,String portId){
  boolean stateChanged=false;
  Node node=new Node(switchId,portId);
  List<DiscoveryNode> subjectList=filterQueue(node);
  if (subjectList.size() == 0) {
    logger.warn("String_Node_Str",node);
  }
 else {
    DiscoveryNode subject=subjectList.get(0);
    if (subject.isFoundIsl() && subject.getConsecutiveFailure() == 0) {
      stateChanged=true;
      logger.info("String_Node_Str",subject);
    }
    subject.renew();
    subject.incConsecutiveFailure();
    subject.clearConsecutiveSuccess();
  }
  return stateChanged;
}
Program: 37826
Project: 37826
Buggy source:
public Plan makeDiscoveryPlan(){
  Plan result=new Plan();
  for (  DiscoveryNode subject : pollQueue) {
    Node node=new Node(subject.getSwitchId(),subject.getPortId());
    if (subject.forlorn()) {
      continue;
    }
 else     if (subject.isStale(consecutiveLostTillFail) && subject.timeToCheck()) {
      result.discoveryFailure.add(node);
      subject.resetTickCounter();
      continue;
    }
 else     if (subject.isStale(consecutiveLostTillFail) && !subject.timeToCheck()) {
      subject.logTick();
      continue;
    }
    if (filter.isMatch(subject)) {
      logger.debug("String_Node_Str",subject);
      subject.renew();
      subject.resetTickCounter();
      continue;
    }
    subject.incAge();
    subject.resetTickCounter();
    result.needDiscovery.add(node);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * The discovery plan takes into consideration multiple metrics to determine what should be discovered. At present, we want to send Discovery health checks on every ISL every x period. And, if the Discovery fails (either isn't an ISL or ISL is down) then we may want to give up checking. General algorithm: 1) if the node is an ISL (isFoundIsl) .. and is UP .. keep checking 2) if the node is not an ISL (ie !isFoundIsl), then check less frequently 3) if the node is an ISL .. and is DOWN .. keep checking
 */
public Plan makeDiscoveryPlan(){
  Plan result=new Plan();
  for (  DiscoveryNode subject : pollQueue) {
    if (filter.isMatch(subject)) {
      logger.debug("String_Node_Str",subject);
      subject.renew();
      subject.resetTickCounter();
      continue;
    }
    if (subject.forlorn()) {
      continue;
    }
    Node node=new Node(subject.getSwitchId(),subject.getPortId());
    if (subject.maxAttempts(consecutiveLostTillFail)) {
      if (subject.isFoundIsl() && subject.getConsecutiveFailure() == 0) {
        result.discoveryFailure.add(node);
        logger.info("String_Node_Str",subject);
      }
      subject.incConsecutiveFailure();
    }
    if (subject.timeToCheck()) {
      subject.incAttempts();
      subject.resetTickCounter();
      result.needDiscovery.add(node);
    }
 else {
      subject.logTick();
    }
  }
  return result;
}
Program: 37827
Project: 37827
Buggy source:
public void handleDiscovered(String switchId,String portId){
  Node node=new Node(switchId,portId);
  List<DiscoveryNode> subjectList=filterQueue(node);
  if (subjectList.size() == 0) {
    logger.warn("String_Node_Str",node);
  }
 else {
    DiscoveryNode subject=subjectList.get(0);
    subject.renew();
    logger.info("String_Node_Str",subject);
  }
}

Fixed version (ground truth):
/** 
 * ISL Discovery Event
 * @return true if this is a new event (ie first time discovered or prior failure)
 */
public boolean handleDiscovered(String switchId,String portId){
  boolean stateChanged=false;
  Node node=new Node(switchId,portId);
  List<DiscoveryNode> subjectList=filterQueue(node);
  if (subjectList.size() == 0) {
    logger.warn("String_Node_Str",node);
  }
 else {
    DiscoveryNode subject=subjectList.get(0);
    if (!subject.isFoundIsl()) {
      subject.setFoundIsl(true);
      stateChanged=true;
      logger.info("String_Node_Str",subject);
    }
    if (subject.getConsecutiveFailure() > 0) {
      stateChanged=true;
      logger.info("String_Node_Str",subject);
    }
    subject.renew();
    subject.incConsecutiveSuccess();
    subject.clearConsecutiveFailure();
  }
  return stateChanged;
}
Program: 37828
Project: 37828
Buggy source:
public boolean forlorn(){
  if (forlornThreshold == NEVER) {
    return false;
  }
  return consecutiveFailures >= forlornThreshold;
}

Fixed version (ground truth):
public boolean forlorn(){
  if (forlornThreshold == NEVER) {
    return false;
  }
  return consecutiveFailure >= forlornThreshold;
}
Program: 37829
Project: 37829
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + switchId + '\''+ "String_Node_Str"+ portId+ '\''+ "String_Node_Str"+ age+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + switchId + '\''+ "String_Node_Str"+ portId+ '\''+ "String_Node_Str"+ attempts+ "String_Node_Str"+ consecutiveFailure+ "String_Node_Str"+ consecutiveSuccess+ '}';
}
Program: 37830
Project: 37830
Buggy source:
public void renew(){
  age=0;
  timeCounter=0;
}

Fixed version (ground truth):
/** 
 * Whereas renew is called when a successful Discovery is received, it isn't the place to put "foundIsl". This is out of fear that renew() could be called from somewhere else. The semantics of "renew" doesn't say "found ISL"
 */
public void renew(){
  attempts=0;
  timeCounter=0;
}
Program: 37831
Project: 37831
Buggy source:
private void handleIslEvent(Tuple tuple,IslInfoData discoveredIsl){
  PathNode node=discoveredIsl.getPath().get(0);
  String switchID=node.getSwitchId();
  String portID="String_Node_Str" + node.getPortNo();
  IslChangeType state=discoveredIsl.getState();
  logger.info("String_Node_Str",switchID,portID,state);
  if (IslChangeType.DISCOVERED.equals(state)) {
    discovery.handleDiscovered(switchID,portID);
  }
 else   if (IslChangeType.FAILED.equals(state)) {
    discovery.handleFailed(switchID,portID);
  }
 else {
    logger.warn("String_Node_Str",state);
  }
  String json=tuple.getString(0);
  collector.emit(topoEngTopic,tuple,new Values(PAYLOAD,json));
}

Fixed version (ground truth):
private void handleIslEvent(Tuple tuple,IslInfoData discoveredIsl){
  PathNode node=discoveredIsl.getPath().get(0);
  String switchID=node.getSwitchId();
  String portID="String_Node_Str" + node.getPortNo();
  IslChangeType state=discoveredIsl.getState();
  boolean stateChanged=false;
  if (IslChangeType.DISCOVERED.equals(state)) {
    stateChanged=discovery.handleDiscovered(switchID,portID);
  }
 else   if (IslChangeType.FAILED.equals(state)) {
    stateChanged=discovery.handleFailed(switchID,portID);
  }
 else {
    logger.warn("String_Node_Str",state);
  }
  if (stateChanged) {
    logger.info("String_Node_Str",switchID,portID,state);
    String json=tuple.getString(0);
    collector.emit(topoEngTopic,tuple,new Values(PAYLOAD,json));
  }
}
Program: 37832
Project: 37832
Buggy source:
@Override public void run(){
  while (true) {
    KafkaConsumer<String,String> consumer=null;
    try {
      consumer=new KafkaConsumer<>(kafkaProps);
      consumer.subscribe(topics);
      while (true) {
        ConsumerRecords<String,String> records=consumer.poll(100);
        logger.debug("String_Node_Str",records.count());
        for (        ConsumerRecord<String,String> record : records) {
          logger.trace("String_Node_Str",record.offset(),record.value());
          parseRecordExecutor.execute(new ParseRecord(record));
        }
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      if (consumer != null) {
        consumer.close();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    KafkaConsumer<String,String> consumer=null;
    try {
      consumer=new KafkaConsumer<>(kafkaProps);
      consumer.subscribe(topics);
      while (true) {
        ConsumerRecords<String,String> records=consumer.poll(100);
        if (records.count() > 0)         logger.debug("String_Node_Str",records.count());
        for (        ConsumerRecord<String,String> record : records) {
          logger.trace("String_Node_Str",record.offset(),record.value());
          parseRecordExecutor.execute(new ParseRecord(record));
        }
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",e);
      if (consumer != null) {
        consumer.close();
      }
    }
  }
}
Program: 37833
Project: 37833
Buggy source:
@Override public boolean sendDiscoveryMessage(DatapathId srcSwId,OFPort port,DatapathId dstSwId){
  IOFSwitch srcSwitch=switchService.getSwitch(srcSwId);
  if (srcSwitch == null) {
    return false;
  }
  if (dstSwId == null) {
    return srcSwitch.write(generateVerificationPacket(srcSwitch,port));
  }
  IOFSwitch dstSwitch=switchService.getSwitch(dstSwId);
  OFPacketOut ofPacketOut=generateVerificationPacket(srcSwitch,port,dstSwitch);
  logger.debug("String_Node_Str",srcSwitch.getId().toString(),port.getPortNumber(),Hex.encodeHexString(ofPacketOut.getData()));
  return srcSwitch.write(ofPacketOut);
}

Fixed version (ground truth):
@Override public boolean sendDiscoveryMessage(DatapathId srcSwId,OFPort port,DatapathId dstSwId){
  IOFSwitch srcSwitch=switchService.getSwitch(srcSwId);
  if (srcSwitch == null || srcSwitch.getPort(port) == null) {
    return false;
  }
  if (dstSwId == null) {
    return srcSwitch.write(generateVerificationPacket(srcSwitch,port));
  }
  IOFSwitch dstSwitch=switchService.getSwitch(dstSwId);
  OFPacketOut ofPacketOut=generateVerificationPacket(srcSwitch,port,dstSwitch);
  logger.debug("String_Node_Str",srcSwitch.getId().toString(),port.getPortNumber(),Hex.encodeHexString(ofPacketOut.getData()));
  return srcSwitch.write(ofPacketOut);
}
Program: 37836
Project: 37836
Buggy source:
/** 
 * Checks if is valid response.
 * @param response the response
 * @return true, if is valid response
 */
public static boolean isValidResponse(final HttpResponse response){
  _log.debug("String_Node_Str" + response.getStatusLine().getStatusCode());
  return response.getStatusLine().getStatusCode() >= HttpStatus.OK.value() && response.getStatusLine().getStatusCode() < HttpStatus.MULTIPLE_CHOICES.value() && response.getEntity() != null;
}

Fixed version (ground truth):
/** 
 * Checks if is valid response.
 * @param response the response
 * @return true, if is valid response
 */
public static boolean isValidResponse(final HttpResponse response){
  LOGGER.debug("String_Node_Str" + response.getStatusLine().getStatusCode());
  return response.getStatusLine().getStatusCode() >= HttpStatus.OK.value() && response.getStatusLine().getStatusCode() < HttpStatus.MULTIPLE_CHOICES.value() && response.getEntity() != null;
}
Program: 37838
Project: 37838
Buggy source:
@Override public int hashCode(){
  int result=metric != null ? metric.hashCode() : 0;
  result=31 * result + (tags != null ? tags.hashCode() : 0);
  result=31 * result + (value != null ? value.hashCode() : 0);
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=metric != null ? metric.hashCode() : 0;
  result=31 * result + (tags != null ? tags.hashCode() : 0);
  return result;
}
Program: 37840
Project: 37840
Buggy source:
@Override public StormTopology createTopology(){
  LOGGER.info("String_Node_Str");
  TopologyBuilder tb=new TopologyBuilder();
  final String topic=config.getKafkaOtsdbTopic();
  final String spoutId=topic + "String_Node_Str";
  final String boltId=topic + "String_Node_Str";
  checkAndCreateTopic(topic);
  KafkaSpout kafkaSpout=createKafkaSpout(topic,spoutId);
  tb.setSpout(spoutId,kafkaSpout,config.getOpenTsdbNumSpouts());
  tb.setBolt(boltId,new OpenTSDBFilterBolt(),config.getOpenTsdbNumOpentasbFilterBolt()).shuffleGrouping(spoutId);
  OpenTsdbClient.Builder tsdbBuilder=OpenTsdbClient.newBuilder(config.getOpenTsDBHosts()).sync(config.getOpenTsdbTimeout()).returnDetails();
  OpenTsdbBolt openTsdbBolt=new OpenTsdbBolt(tsdbBuilder,TupleOpenTsdbDatapointMapper.DEFAULT_MAPPER).withBatchSize(10).withFlushInterval(2).failTupleForFailedMetrics();
  tb.setBolt("String_Node_Str",openTsdbBolt,config.getOpenTsdbNumOpentsdbBolt()).shuffleGrouping(boltId);
  return tb.createTopology();
}

Fixed version (ground truth):
@Override public StormTopology createTopology(){
  LOGGER.info("String_Node_Str");
  TopologyBuilder tb=new TopologyBuilder();
  final String topic=config.getKafkaOtsdbTopic();
  final String spoutId=topic + "String_Node_Str";
  final String boltId=topic + "String_Node_Str";
  checkAndCreateTopic(topic);
  KafkaSpout kafkaSpout=createKafkaSpout(topic,spoutId);
  tb.setSpout(spoutId,kafkaSpout,config.getOpenTsdbNumSpouts());
  tb.setBolt(boltId,new OpenTSDBFilterBolt(),config.getOpenTsdbFilterBoltExecutors()).fieldsGrouping(spoutId,new Fields("String_Node_Str"));
  OpenTsdbClient.Builder tsdbBuilder=OpenTsdbClient.newBuilder(config.getOpenTsDBHosts()).sync(config.getOpenTsdbTimeout()).returnDetails();
  OpenTsdbBolt openTsdbBolt=new OpenTsdbBolt(tsdbBuilder,TupleOpenTsdbDatapointMapper.DEFAULT_MAPPER).withBatchSize(config.getOpenTsdbBatchSize()).withFlushInterval(config.getOpenTsdbFlushInterval()).failTupleForFailedMetrics();
  tb.setBolt("String_Node_Str",openTsdbBolt,config.getOpenTsdbBoltExecutors()).setNumTasks(config.getOpenTsdbBoltWorkers()).shuffleGrouping(boltId);
  return tb.createTopology();
}
Program: 37841
Project: 37841
Buggy source:
private boolean isUpdateRequired(Datapoint datapoint){
  return !storage.contains(datapoint) || isDatapointOutdated(datapoint);
}

Fixed version (ground truth):
private boolean isUpdateRequired(Datapoint datapoint){
  boolean update=true;
  if (storage.containsKey(datapoint.hashCode())) {
    Datapoint prevDatapoint=storage.get(datapoint.hashCode());
    update=!prevDatapoint.getValue().equals(datapoint.getValue()) || datapoint.getTime() - prevDatapoint.getTime() >= TEN_MINUTES;
  }
  return update;
}
Program: 37842
Project: 37842
Buggy source:
private void addDatapoint(Datapoint datapoint){
  if (!storage.add(datapoint)) {
    storage.remove(datapoint);
    storage.add(datapoint);
  }
}

Fixed version (ground truth):
private void addDatapoint(Datapoint datapoint){
  LOGGER.debug("String_Node_Str" + datapoint.hashCode());
  storage.put(datapoint.hashCode(),datapoint);
}
Program: 37843
Project: 37843
Buggy source:
private void sendDiscoveryFailed(String switchId,String portId,Tuple tuple) throws IOException {
  String discoFail=OFEMessageUtils.createIslFail(switchId,portId);
  Values dataVal=new Values(PAYLOAD,discoFail,switchId,portId,OFEMessageUtils.LINK_DOWN);
  collector.emit(topoEngTopic,tuple,dataVal);
  discovery.handleFailed(switchId,portId);
  logger.warn("String_Node_Str",discoFail);
}

Fixed version (ground truth):
private void sendDiscoveryFailed(String switchId,String portId,Tuple tuple) throws IOException {
  String discoFail=OFEMessageUtils.createIslFail(switchId,portId);
  collector.emit(topoEngTopic,tuple,new Values(PAYLOAD,discoFail));
  discovery.handleFailed(switchId,portId);
  logger.warn("String_Node_Str",discoFail);
}
Program: 37844
Project: 37844
Buggy source:
private void parseRecord(ConsumerRecord record){
  try {
    if (record.value() instanceof String) {
      String value=(String)record.value();
      BaseMessage message=MAPPER.readValue(value,BaseMessage.class);
      if (message instanceof CommandMessage) {
        logger.debug("String_Node_Str",value);
        doControllerMsg((CommandMessage)message);
      }
 else {
        logger.trace("String_Node_Str",message);
      }
    }
 else {
      logger.error("String_Node_Str",record.value());
    }
  }
 catch (  Exception exception) {
    logger.error("String_Node_Str",record.value(),exception);
  }
}

Fixed version (ground truth):
private void parseRecord(ConsumerRecord record){
  try {
    if (record.value() instanceof String) {
      String value=(String)record.value();
      CommandMessage message=MAPPER.readValue(value,CommandMessage.class);
      doControllerMsg((CommandMessage)message);
    }
 else {
      logger.error("String_Node_Str",record.value());
    }
  }
 catch (  Exception exception) {
    logger.error("String_Node_Str",record.value(),exception);
  }
}
Program: 37845
Project: 37845
Buggy source:
/** 
 * Returns CommandData entity constructed by data string from json resource file.
 * @param value data string from json resource file
 * @return CommandData entity
 * @throws IOException if mapping fails
 */
private static CommandData prepareData(String value) throws IOException {
  Message message=MAPPER.readValue(value,Message.class);
  CommandMessage commandMessage=(CommandMessage)message;
  return commandMessage.getData();
}

Fixed version (ground truth):
/** 
 * Returns CommandData entity constructed by data string from json resource file.
 * @param value data string from json resource file
 * @return CommandData entity
 * @throws IOException if mapping fails
 */
private static CommandData prepareData(String value) throws IOException {
  CommandMessage message=MAPPER.readValue(value,CommandMessage.class);
  return message.getData();
}
Program: 37846
Project: 37846
Buggy source:
/** 
 * Runs test case.
 * @param value       data string from json resource file
 * @param flowCommand OFFlowAdd instance to compare result with
 * @throws InterruptedException if test was interrupted during run
 */
private void runTest(final String value,final OFFlowAdd flowCommand,final OFMeterMod meterCommand,final OFFlowAdd reverseFlowCommand,final OFMeterMod reverseMeterCommand) throws InterruptedException {
  ConsumerRecord<String,String> record=new ConsumerRecord<>("String_Node_Str",0,0,"String_Node_Str",value);
  KafkaMessageCollector.ParseRecord parseRecord=collector.new ParseRecord(record);
  Capture<OFFlowAdd> flowAddCapture=flowCommand == null ? null : newCapture(CaptureType.ALL);
  Capture<OFMeterMod> meterAddCapture=meterCommand == null ? null : newCapture(CaptureType.ALL);
  prepareMocks(flowAddCapture,meterAddCapture,reverseFlowCommand != null,reverseMeterCommand != null);
  parseRecordExecutor.execute(parseRecord);
  parseRecordExecutor.shutdown();
  parseRecordExecutor.awaitTermination(10,TimeUnit.SECONDS);
  if (meterCommand != null) {
    assertEquals(meterCommand,meterAddCapture.getValues().get(0));
    if (reverseMeterCommand != null) {
      assertEquals(reverseMeterCommand,meterAddCapture.getValues().get(1));
    }
  }
  if (flowCommand != null) {
    assertEquals(flowCommand,flowAddCapture.getValues().get(0));
    if (reverseFlowCommand != null) {
      assertEquals(reverseFlowCommand,flowAddCapture.getValues().get(1));
    }
  }
}

Fixed version (ground truth):
/** 
 * Runs test case.
 * @param value       data string from json resource file
 * @param flowCommand OFFlowAdd instance to compare result with
 * @throws InterruptedException if test was interrupted during run
 */
private void runTest(final String value,final OFFlowAdd flowCommand,final OFMeterMod meterCommand,final OFFlowAdd reverseFlowCommand,final OFMeterMod reverseMeterCommand) throws InterruptedException {
  ConsumerRecord<String,String> record=new ConsumerRecord<>("String_Node_Str",0,0,"String_Node_Str",value);
  KafkaMessageCollector.ParseRecord parseRecord=collector.new ParseRecord(record);
  Capture<OFFlowAdd> flowAddCapture=flowCommand == null ? null : newCapture(CaptureType.ALL);
  Capture<OFMeterMod> meterAddCapture=meterCommand == null ? null : newCapture(CaptureType.ALL);
  prepareMocks(flowAddCapture,meterAddCapture,reverseFlowCommand != null,reverseMeterCommand != null);
  parseRecordExecutor.execute(parseRecord);
  parseRecordExecutor.shutdown();
  parseRecordExecutor.awaitTermination(10,TimeUnit.SECONDS);
  if (meterCommand != null) {
    System.out.println("String_Node_Str" + meterCommand);
    System.out.println("String_Node_Str" + meterAddCapture.getValues());
    assertEquals(meterCommand,meterAddCapture.getValues().get(0));
    if (reverseMeterCommand != null) {
      assertEquals(reverseMeterCommand,meterAddCapture.getValues().get(1));
    }
  }
  if (flowCommand != null) {
    assertEquals(flowCommand,flowAddCapture.getValues().get(0));
    if (reverseFlowCommand != null) {
      assertEquals(reverseFlowCommand,flowAddCapture.getValues().get(1));
    }
  }
}
Program: 37849
Project: 37849
Buggy source:
private void initMocks(){
  Fields switchSchema=new Fields(OFEMessageUtils.FIELD_SWITCH_ID,OFEMessageUtils.FIELD_STATE);
  when(topologyContext.getComponentId(0)).thenReturn(InfoEventSplitterBolt.I_SWITCH_UPDOWN);
  when(topologyContext.getComponentOutputFields(InfoEventSplitterBolt.I_SWITCH_UPDOWN,InfoEventSplitterBolt.I_SWITCH_UPDOWN)).thenReturn(switchSchema);
  Fields portSchema=new Fields(OFEMessageUtils.FIELD_SWITCH_ID,OFEMessageUtils.FIELD_PORT_ID,OFEMessageUtils.FIELD_STATE);
  when(topologyContext.getComponentId(1)).thenReturn(InfoEventSplitterBolt.I_PORT_UPDOWN);
  when(topologyContext.getComponentOutputFields(InfoEventSplitterBolt.I_PORT_UPDOWN,InfoEventSplitterBolt.I_PORT_UPDOWN)).thenReturn(portSchema);
  Fields tickSchema=new Fields();
  when(topologyContext.getComponentId(2)).thenReturn(Constants.SYSTEM_COMPONENT_ID);
  when(topologyContext.getComponentOutputFields(Constants.SYSTEM_COMPONENT_ID,Constants.SYSTEM_TICK_STREAM_ID)).thenReturn(tickSchema);
  Fields islSchema=new Fields(InfoEventSplitterBolt.I_ISL_UPDOWN);
  when(topologyContext.getComponentId(3)).thenReturn(InfoEventSplitterBolt.I_ISL_UPDOWN);
  when(topologyContext.getComponentOutputFields(InfoEventSplitterBolt.I_ISL_UPDOWN,InfoEventSplitterBolt.I_ISL_UPDOWN)).thenReturn(islSchema);
  when(topologyContext.getComponentId(4)).thenReturn(OFEventWFMTopology.SPOUT_ID_INPUT);
  when(topologyContext.getComponentOutputFields(OFEventWFMTopology.SPOUT_ID_INPUT,AbstractTopology.MESSAGE_FIELD)).thenReturn(AbstractTopology.fieldMessage);
}

Fixed version (ground truth):
private void initMocks(String topo_input_topic){
  Fields switchSchema=new Fields(OFEMessageUtils.FIELD_SWITCH_ID,OFEMessageUtils.FIELD_STATE);
  when(topologyContext.getComponentId(0)).thenReturn(topo_input_topic);
  when(topologyContext.getComponentOutputFields(topo_input_topic,topo_input_topic)).thenReturn(switchSchema);
  Fields portSchema=new Fields(OFEMessageUtils.FIELD_SWITCH_ID,OFEMessageUtils.FIELD_PORT_ID,OFEMessageUtils.FIELD_STATE);
  when(topologyContext.getComponentId(1)).thenReturn(topo_input_topic);
  when(topologyContext.getComponentOutputFields(topo_input_topic,topo_input_topic)).thenReturn(portSchema);
  Fields tickSchema=new Fields();
  when(topologyContext.getComponentId(2)).thenReturn(Constants.SYSTEM_COMPONENT_ID);
  when(topologyContext.getComponentOutputFields(Constants.SYSTEM_COMPONENT_ID,Constants.SYSTEM_TICK_STREAM_ID)).thenReturn(tickSchema);
  Fields islSchema=new Fields(topo_input_topic);
  when(topologyContext.getComponentId(3)).thenReturn(topo_input_topic);
  when(topologyContext.getComponentOutputFields(topo_input_topic,topo_input_topic)).thenReturn(islSchema);
  when(topologyContext.getComponentId(4)).thenReturn(OFEventWFMTopology.SPOUT_ID_INPUT);
  when(topologyContext.getComponentOutputFields(OFEventWFMTopology.SPOUT_ID_INPUT,AbstractTopology.MESSAGE_FIELD)).thenReturn(AbstractTopology.fieldMessage);
}
Program: 37850
Project: 37850
Buggy source:
@BeforeClass public static void setupOnce() throws Exception {
  System.out.println("String_Node_Str");
  makeConfigFile();
  server=new TestUtils.KafkaTestFixture(makeUnboundConfig());
  server.start();
  cluster=new LocalCluster();
  kProducer=new TestKafkaProducer(kafkaProperties());
}

Fixed version (ground truth):
@BeforeClass public static void setupOnce() throws Exception {
  System.out.println("String_Node_Str");
  clusterParam=new MkClusterParam();
  clusterParam.setSupervisors(1);
  Config daemonConfig=new Config();
  daemonConfig.put(Config.STORM_LOCAL_MODE_ZMQ,false);
  clusterParam.setDaemonConf(daemonConfig);
  makeConfigFile();
  Config conf=new Config();
  conf.setNumWorkers(1);
  completeTopologyParam=new CompleteTopologyParam();
  completeTopologyParam.setStormConf(conf);
}
Program: 37851
Project: 37851
Buggy source:
@Override public void execute(Tuple tuple){
  try {
    String tupleSource=tuple.getSourceComponent();
switch (tupleSource) {
case SimulatorTopology.SIMULATOR_SPOUT:
      doCommand(tuple);
    break;
default :
  logger.error("String_Node_Str",tupleSource);
}
}
 catch (Exception e) {
logger.error(e);
}
 finally {
collector.ack(tuple);
}
}

Fixed version (ground truth):
@Override public void execute(Tuple tuple){
  try {
    String tupleSource=tuple.getSourceComponent();
switch (tupleSource) {
case SimulatorTopology.SIMULATOR_SPOUT:
      doCommand(tuple);
    break;
default :
  logger.error("String_Node_Str",tupleSource);
}
}
 catch (Exception e) {
logger.error(e.toString());
}
 finally {
collector.ack(tuple);
}
}
Program: 37852
Project: 37852
Buggy source:
protected List<Values> addSwitch(SwitchMessage switchMessage) throws Exception {
  ISwitchImpl sw=switches.get(switchMessage.getDpid());
  List<Values> values=new ArrayList<>();
  if (sw == null) {
    logger.info("String_Node_Str");
    sw=new ISwitchImpl(switchMessage.getDpid(),switchMessage.getNumOfPorts(),PortStateType.DOWN);
    sw.activate();
    List<LinkMessage> links=switchMessage.getLinks();
    for (    LinkMessage l : links) {
      IPortImpl localPort=sw.getPort(l.getLocalPort());
      localPort.setLatency(l.getLatency());
      localPort.setPeerPortNum(l.getPeerPort());
      localPort.setPeerSwitch(l.getPeerSwitch());
      localPort.enable();
    }
    switches.put(sw.getDpid().toString(),sw);
    values.add(new Values("String_Node_Str",makeSwitchMessage(sw,SwitchState.ADDED)));
    values.add(new Values("String_Node_Str",makeSwitchMessage(sw,SwitchState.ACTIVATED)));
    for (    IPortImpl p : sw.getPorts()) {
      PortChangeType changeType=p.isActive() ? PortChangeType.UP : PortChangeType.DOWN;
      values.add(new Values("String_Node_Str",makePortMessage(sw,p.getNumber(),changeType)));
    }
  }
  return values;
}

Fixed version (ground truth):
protected List<Values> addSwitch(SwitchMessage switchMessage) throws Exception {
  ISwitchImpl sw=switches.get(switchMessage.getDpid());
  List<Values> values=new ArrayList<>();
  if (sw == null) {
    logger.info("String_Node_Str");
    sw=new ISwitchImpl(switchMessage.getDpid(),switchMessage.getNumOfPorts(),PortStateType.DOWN);
    sw.activate();
    List<LinkMessage> links=switchMessage.getLinks();
    for (    LinkMessage l : links) {
      IPortImpl localPort=sw.getPort(l.getLocalPort());
      localPort.setLatency(l.getLatency());
      localPort.setPeerPortNum(l.getPeerPort());
      localPort.setPeerSwitch(l.getPeerSwitch());
      localPort.enable();
    }
    switches.put(sw.getDpid().toString(),sw);
    values.add(new Values("String_Node_Str",makeSwitchMessage(sw,SwitchState.ADDED)));
    values.add(new Values("String_Node_Str",makeSwitchMessage(sw,SwitchState.ACTIVATED)));
    for (    IPortImpl p : sw.getPorts()) {
      PortChangeType changeType=p.isActive() ? PortChangeType.UP : PortChangeType.DOWN;
      if (changeType == PortChangeType.UP) {
        values.add(new Values("String_Node_Str",makePortMessage(sw,p.getNumber(),changeType)));
      }
    }
  }
  return values;
}
Program: 37853
Project: 37853
Buggy source:
protected void discoverIslPartTwo(Tuple tuple,IslInfoData data) throws Exception {
  ISwitchImpl sw=getSwitch(data.getPath().get(1).getSwitchId());
  if (!sw.isActive()) {
    return;
  }
  IPortImpl port=sw.getPort(data.getPath().get(1).getPortNo());
  if (port.isActiveIsl()) {
    long now=Instant.now().toEpochMilli();
    InfoMessage infoMessage=new InfoMessage(data,now,"String_Node_Str",null);
    logger.info("String_Node_Str",data.toString());
    collector.emit(SimulatorTopology.KAFKA_BOLT_STREAM,tuple,new Values("String_Node_Str",Utils.MAPPER.writeValueAsString(infoMessage)));
  }
}

Fixed version (ground truth):
protected void discoverIslPartTwo(Tuple tuple,IslInfoData data) throws Exception {
  ISwitchImpl sw=getSwitch(data.getPath().get(1).getSwitchId());
  if (!sw.isActive()) {
    return;
  }
  IPortImpl port=sw.getPort(data.getPath().get(1).getPortNo());
  if (port.isActiveIsl()) {
    long now=Instant.now().toEpochMilli();
    InfoMessage infoMessage=new InfoMessage(data,now,"String_Node_Str",null);
    logger.debug("String_Node_Str",data.toString());
    collector.emit(SimulatorTopology.KAFKA_BOLT_STREAM,tuple,new Values("String_Node_Str",Utils.MAPPER.writeValueAsString(infoMessage)));
  }
}
Program: 37854
Project: 37854
Buggy source:
@Override public void execute(Tuple tuple){
  logger.debug("String_Node_Str",tuple.toString());
  try {
    String tupleSource=tuple.getSourceComponent();
switch (tupleSource) {
case SimulatorTopology.COMMAND_BOLT:
case SimulatorTopology.SWITCH_BOLT:
      doCommand(tuple);
    break;
case SimulatorTopology.SIMULATOR_COMMAND_BOLT:
  doSimulatorCommand(tuple);
break;
default :
logger.error("String_Node_Str",tupleSource);
}
}
 catch (Exception e) {
logger.error(e);
e.printStackTrace();
}
 finally {
collector.ack(tuple);
}
}

Fixed version (ground truth):
@Override public void execute(Tuple tuple){
  logger.debug("String_Node_Str",tuple.toString());
  try {
    String tupleSource=tuple.getSourceComponent();
switch (tupleSource) {
case SimulatorTopology.COMMAND_BOLT:
case SimulatorTopology.SWITCH_BOLT:
      doCommand(tuple);
    break;
case SimulatorTopology.SIMULATOR_COMMAND_BOLT:
  doSimulatorCommand(tuple);
break;
default :
logger.error("String_Node_Str",tupleSource);
}
}
 catch (Exception e) {
logger.error(e.toString());
e.printStackTrace();
}
 finally {
collector.ack(tuple);
}
}