nus-yam/ex-repair huggingface dataset:
Program: 37787
Project: 37787
Buggy source:
@Override public List<IslInfoData> getIsls(){
  String q="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  logger.debug("String_Node_Str",q);
  Session session=driver.session();
  StatementResult queryResults=session.run(q);
  List<IslInfoData> results=new LinkedList<>();
  for (  Record record : queryResults.list()) {
    IslInfoData isl=new IslInfoData();
    List<PathNode> pathNodes=new ArrayList<>();
    PathNode src=new PathNode();
    src.setSwitchId(record.get("String_Node_Str").asString());
    src.setPortNo(record.get("String_Node_Str").asInt());
    src.setSegLatency(record.get("String_Node_Str").asInt());
    pathNodes.add(src);
    PathNode dst=new PathNode();
    dst.setSwitchId(record.get("String_Node_Str").asString());
    dst.setPortNo(record.get("String_Node_Str").asInt());
    dst.setSegLatency(record.get("String_Node_Str").asInt());
    pathNodes.add(dst);
    isl.setPath(pathNodes);
    isl.setSpeed(record.get("String_Node_Str").asInt());
    isl.setLatency(record.get("String_Node_Str").asInt());
    isl.setAvailableBandwidth(record.get("String_Node_Str").asInt());
    String status=record.get("String_Node_Str").asString();
    IslChangeType ct=("String_Node_Str".equals(status)) ? IslChangeType.DISCOVERED : IslChangeType.FAILED;
    isl.setState(ct);
    isl.setTimestamp(System.currentTimeMillis());
    results.add(isl);
  }
  return results;
}

Fixed version (ground truth):
@Override public List<IslInfoData> getIsls(){
  String q="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  logger.debug("String_Node_Str",q);
  Session session=driver.session();
  StatementResult queryResults=session.run(q);
  List<IslInfoData> results=new LinkedList<>();
  for (  Record record : queryResults.list()) {
    List<PathNode> pathNodes=new ArrayList<>();
    PathNode src=new PathNode();
    src.setSwitchId(record.get("String_Node_Str").asString());
    src.setPortNo(record.get("String_Node_Str").asInt());
    src.setSegLatency(record.get("String_Node_Str").asInt());
    pathNodes.add(src);
    PathNode dst=new PathNode();
    dst.setSwitchId(record.get("String_Node_Str").asString());
    dst.setPortNo(record.get("String_Node_Str").asInt());
    dst.setSegLatency(record.get("String_Node_Str").asInt());
    pathNodes.add(dst);
    String status=record.get("String_Node_Str").asString();
    IslChangeType state=("String_Node_Str".equals(status)) ? IslChangeType.DISCOVERED : IslChangeType.FAILED;
    IslInfoData isl=new IslInfoData(record.get("String_Node_Str").asInt(),pathNodes,record.get("String_Node_Str").asInt(),state,record.get("String_Node_Str").asInt());
    isl.setTimestamp(System.currentTimeMillis());
    results.add(isl);
  }
  return results;
}
Program: 37788
Project: 37788
Buggy source:
/** 
 * Builds new forward and reverse flow pair.
 * @param flow  source flow
 * @param path  flow path
 * @param cache resource cache
 * @return new forward and reverse flow pair
 */
public ImmutablePair<Flow,Flow> buildFlow(final Flow flow,ImmutablePair<PathInfoData,PathInfoData> path,ResourceCache cache){
  String timestamp=Utils.getIsoTimestamp();
  int cookie=cache.allocateCookie();
  Flow forward=new Flow(flow.getFlowId(),flow.getBandwidth(),flow.isIgnoreBandwidth(),cookie | ResourceCache.FORWARD_FLOW_COOKIE_MASK,flow.getDescription(),timestamp,flow.getSourceSwitch(),flow.getDestinationSwitch(),flow.getSourcePort(),flow.getDestinationPort(),flow.getSourceVlan(),flow.getDestinationVlan(),cache.allocateMeterId(flow.getSourceSwitch()),cache.allocateVlanId(),path.getLeft(),FlowState.ALLOCATED);
  Flow reverse=new Flow(flow.getFlowId(),flow.getBandwidth(),flow.isIgnoreBandwidth(),cookie | ResourceCache.REVERSE_FLOW_COOKIE_MASK,flow.getDescription(),timestamp,flow.getDestinationSwitch(),flow.getSourceSwitch(),flow.getDestinationPort(),flow.getSourcePort(),flow.getDestinationVlan(),flow.getSourceVlan(),cache.allocateMeterId(flow.getDestinationSwitch()),cache.allocateVlanId(),path.getRight(),FlowState.ALLOCATED);
  return new ImmutablePair<>(forward,reverse);
}

Fixed version (ground truth):
/** 
 * Builds new forward and reverse flow pair.
 * @param flow  source flow
 * @param path  flow path
 * @param cache resource cache
 * @return new forward and reverse flow pair
 */
public ImmutablePair<Flow,Flow> buildFlow(final Flow flow,ImmutablePair<PathInfoData,PathInfoData> path,ResourceCache cache){
  String timestamp=Utils.getIsoTimestamp();
  int cookie=cache.allocateCookie();
  int forwardVlan=0;
  int reverseVlan=0;
  if (!flow.isOneSwitchFlow()) {
    forwardVlan=cache.allocateVlanId();
    reverseVlan=cache.allocateVlanId();
  }
  Flow forward=new Flow(flow.getFlowId(),flow.getBandwidth(),flow.isIgnoreBandwidth(),cookie | ResourceCache.FORWARD_FLOW_COOKIE_MASK,flow.getDescription(),timestamp,flow.getSourceSwitch(),flow.getDestinationSwitch(),flow.getSourcePort(),flow.getDestinationPort(),flow.getSourceVlan(),flow.getDestinationVlan(),cache.allocateMeterId(flow.getSourceSwitch()),forwardVlan,path.getLeft(),FlowState.ALLOCATED);
  Flow reverse=new Flow(flow.getFlowId(),flow.getBandwidth(),flow.isIgnoreBandwidth(),cookie | ResourceCache.REVERSE_FLOW_COOKIE_MASK,flow.getDescription(),timestamp,flow.getDestinationSwitch(),flow.getSourceSwitch(),flow.getDestinationPort(),flow.getSourcePort(),flow.getDestinationVlan(),flow.getSourceVlan(),cache.allocateMeterId(flow.getDestinationSwitch()),reverseVlan,path.getRight(),FlowState.ALLOCATED);
  return new ImmutablePair<>(forward,reverse);
}
Program: 37789
Project: 37789
Buggy source:
/** 
 * Track and allocate the flow.
 * @param flow The flow to track / allocate.
 */
public void pushFlow(ImmutablePair<Flow,Flow> flow){
  putFlow(flow);
  resourceCache.allocateFlow(flow);
}

Fixed version (ground truth):
/** 
 * Track and allocate the flow.
 * @param flow The flow to track / allocate.
 */
public void pushFlow(ImmutablePair<Flow,Flow> flow){
  resourceCache.allocateFlow(flow);
  putFlow(flow);
}
Program: 37790
Project: 37790
Buggy source:
/** 
 * Allocates flow resources.
 * @param flow flow
 */
public void allocateFlow(ImmutablePair<Flow,Flow> flow){
  if (flow.left != null) {
    allocateCookie((int)(FLOW_COOKIE_VALUE_MASK & flow.left.getCookie()));
    allocateVlanId(flow.left.getTransitVlan());
    allocateMeterId(flow.left.getSourceSwitch(),flow.left.getMeterId());
  }
  if (flow.right != null) {
    allocateVlanId(flow.right.getTransitVlan());
    allocateMeterId(flow.right.getSourceSwitch(),flow.right.getMeterId());
  }
}

Fixed version (ground truth):
/** 
 * Allocates flow resources. All flows come here .. single switch and multi switch flows.
 * @param flow flow
 */
public void allocateFlow(ImmutablePair<Flow,Flow> flow){
  if (flow.left != null) {
    allocateCookie((int)(FLOW_COOKIE_VALUE_MASK & flow.left.getCookie()));
    if (!flow.left.isOneSwitchFlow()) {
      allocateVlanId(flow.left.getTransitVlan());
    }
    allocateMeterId(flow.left.getSourceSwitch(),flow.left.getMeterId());
  }
  if (flow.right != null) {
    if (!flow.right.isOneSwitchFlow()) {
      allocateVlanId(flow.right.getTransitVlan());
    }
    allocateMeterId(flow.right.getSourceSwitch(),flow.right.getMeterId());
  }
}
Program: 37791
Project: 37791
Buggy source:
@Test public void allocateFlow() throws Exception {
  resourceCache.allocateFlow(new ImmutablePair<>(forwardCreatedFlow,reverseCreatedFlow));
  resourceCache.allocateFlow(new ImmutablePair<>(forwardCreatedFlow,reverseCreatedFlow));
  Set<Integer> allocatedCookies=resourceCache.getAllCookies();
  Set<Integer> allocatedVlanIds=resourceCache.getAllVlanIds();
  Set<Integer> allocatedMeterIds=resourceCache.getAllMeterIds(NetworkTopologyConstants.sw3.getSwitchId());
  Set<Integer> expectedCookies=new HashSet<>(Arrays.asList((int)forwardCreatedFlow.getCookie(),(int)reverseCreatedFlow.getCookie()));
  Set<Integer> expectedVlanIds=new HashSet<>(Arrays.asList(forwardCreatedFlow.getTransitVlan(),reverseCreatedFlow.getTransitVlan()));
  Set<Integer> expectedMeterIds=new HashSet<>(Arrays.asList(forwardCreatedFlow.getMeterId(),reverseCreatedFlow.getMeterId()));
  assertEquals(expectedCookies,allocatedCookies);
  assertEquals(expectedVlanIds,allocatedVlanIds);
  assertEquals(expectedMeterIds,allocatedMeterIds);
}

Fixed version (ground truth):
@Test public void allocateFlow() throws Exception {
  resourceCache.allocateFlow(new ImmutablePair<>(forwardCreatedFlow,reverseCreatedFlow));
  resourceCache.allocateFlow(new ImmutablePair<>(forwardCreatedFlow,reverseCreatedFlow));
  Set<Integer> allocatedCookies=resourceCache.getAllCookies();
  Set<Integer> allocatedVlanIds=resourceCache.getAllVlanIds();
  Set<Integer> allocatedMeterIds=new HashSet<>();
  allocatedMeterIds.addAll(resourceCache.getAllMeterIds(NetworkTopologyConstants.sw3.getSwitchId()));
  allocatedMeterIds.addAll(resourceCache.getAllMeterIds(NetworkTopologyConstants.sw4.getSwitchId()));
  Set<Integer> expectedCookies=new HashSet<>(Arrays.asList((int)forwardCreatedFlow.getCookie(),(int)reverseCreatedFlow.getCookie()));
  Set<Integer> expectedVlanIds=new HashSet<>(Arrays.asList(forwardCreatedFlow.getTransitVlan(),reverseCreatedFlow.getTransitVlan()));
  Set<Integer> expectedMeterIds=new HashSet<>(Arrays.asList(forwardCreatedFlow.getMeterId(),reverseCreatedFlow.getMeterId()));
  assertEquals(expectedCookies,allocatedCookies);
  assertEquals(expectedVlanIds,allocatedVlanIds);
  assertEquals(expectedMeterIds,allocatedMeterIds);
}
Program: 37792
Project: 37792
Buggy source:
private void initFlowCache(){
  logger.info("String_Node_Str");
  Map<String,BidirectionalFlow> flowPairsMap=new HashMap<>();
  List<Flow> flows=pathComputer.getAllFlows();
  logger.info("String_Node_Str",flows.size());
  for (  Flow flow : flows) {
    logger.info("String_Node_Str",flow);
    if (!flowPairsMap.containsKey(flow.getFlowId())) {
      flowPairsMap.put(flow.getFlowId(),new BidirectionalFlow());
    }
    BidirectionalFlow pair=flowPairsMap.get(flow.getFlowId());
    try {
      pair.add(flow);
    }
 catch (    IllegalArgumentException e) {
      logger.error("String_Node_Str",flow.getFlowId(),e.toString());
    }
  }
  for (  BidirectionalFlow bidirectionalFlow : flowPairsMap.values()) {
    try {
      flowCache.pushFlow(bidirectionalFlow.makeFlowPair());
    }
 catch (    InvalidArgumentException e) {
      logger.error("String_Node_Str",bidirectionalFlow.anyDefined().getFlowId(),e.toString());
    }
  }
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
private void initFlowCache(){
  logger.info("String_Node_Str");
  Map<String,BidirectionalFlow> flowPairsMap=new HashMap<>();
  List<Flow> flows=pathComputer.getAllFlows();
  logger.info("String_Node_Str",flows.size());
  for (  Flow flow : flows) {
    if (!flowPairsMap.containsKey(flow.getFlowId())) {
      flowPairsMap.put(flow.getFlowId(),new BidirectionalFlow());
    }
    BidirectionalFlow pair=flowPairsMap.get(flow.getFlowId());
    try {
      pair.add(flow);
    }
 catch (    IllegalArgumentException e) {
      logger.error("String_Node_Str",flow.getFlowId(),e.toString());
    }
  }
  for (  BidirectionalFlow bidirectionalFlow : flowPairsMap.values()) {
    try {
      flowCache.pushFlow(bidirectionalFlow.makeFlowPair());
    }
 catch (    InvalidArgumentException e) {
      logger.error("String_Node_Str",bidirectionalFlow.anyDefined().getFlowId(),e.toString());
    }
  }
  logger.info("String_Node_Str");
}
Program: 37793
Project: 37793
Buggy source:
@Override public int hashCode(){
  int result=metric != null ? metric.hashCode() : 0;
  result=31 * result + (tags != null ? tags.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);
  result=31 * result + (value != null ? value.hashCode() : 0);
  return result;
}
Program: 37794
Project: 37794
Buggy source:
@Override public StormTopology createTopology(){
  LOGGER.info("String_Node_Str");
  TopologyBuilder tb=new TopologyBuilder();
  checkAndCreateTopic(topic);
  KafkaSpout kafkaSpout=createKafkaSpout(topic,spoutId);
  tb.setSpout(spoutId,kafkaSpout,config.getOpenTsdbNumSpouts());
  tb.setBolt(parseBoltId,new DatapointParseBolt(),config.getGetDatapointParseBoltExecutors()).setNumTasks(config.getGetDatapointParseBoltWorkers()).shuffleGrouping(spoutId);
  tb.setBolt(boltId,new OpenTSDBFilterBolt(),config.getOpenTsdbFilterBoltExecutors()).fieldsGrouping(parseBoltId,new Fields("String_Node_Str"));
  return tb.createTopology();
}

Fixed version (ground truth):
@Override public StormTopology createTopology(){
  LOGGER.info("String_Node_Str");
  TopologyBuilder tb=new TopologyBuilder();
  checkAndCreateTopic(topic);
  KafkaSpout kafkaSpout=createKafkaSpout(topic,spoutId);
  tb.setSpout(spoutId,kafkaSpout,config.getOpenTsdbNumSpouts());
  tb.setBolt(parseBoltId,new DatapointParseBolt(),config.getGetDatapointParseBoltExecutors()).setNumTasks(config.getGetDatapointParseBoltWorkers()).shuffleGrouping(spoutId);
  tb.setBolt(boltId,new OpenTSDBFilterBolt(),config.getOpenTsdbFilterBoltExecutors()).fieldsGrouping(parseBoltId,new Fields("String_Node_Str"));
  OpenTsdbClient.Builder tsdbBuilder=OpenTsdbClient.newBuilder(config.getOpenTsDBHosts()).returnDetails();
  if (config.isOpenTsdbClientChunkedRequestsEnabled()) {
    tsdbBuilder.enableChunkedEncoding();
  }
  OpenTsdbBolt openTsdbBolt=new OpenTsdbBolt(tsdbBuilder,Collections.singletonList(TupleOpenTsdbDatapointMapper.DEFAULT_MAPPER));
  openTsdbBolt.withBatchSize(config.getOpenTsdbBatchSize()).withFlushInterval(config.getOpenTsdbFlushInterval());
  tb.setBolt("String_Node_Str",openTsdbBolt,config.getOpenTsdbBoltExecutors()).setNumTasks(config.getOpenTsdbBoltWorkers()).shuffleGrouping(boltId);
  return tb.createTopology();
}
Program: 37795
Project: 37795
Buggy source:
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;
}

Fixed version (ground truth):
private boolean isUpdateRequired(Datapoint datapoint){
  boolean update=true;
  if (storage.containsKey(datapoint.simpleHashCode())) {
    Datapoint prevDatapoint=storage.get(datapoint.simpleHashCode());
    update=!prevDatapoint.getValue().equals(datapoint.getValue()) || datapoint.getTime() - prevDatapoint.getTime() >= TEN_MINUTES;
  }
  return update;
}
Program: 37796
Project: 37796
Buggy source:
private void addDatapoint(Datapoint datapoint){
  LOGGER.debug("String_Node_Str" + datapoint.hashCode());
  LOGGER.debug("String_Node_Str" + storage.size());
  storage.put(datapoint.hashCode(),datapoint);
}

Fixed version (ground truth):
private void addDatapoint(Datapoint datapoint){
  LOGGER.debug("String_Node_Str" + datapoint.simpleHashCode());
  LOGGER.debug("String_Node_Str" + storage.size());
  storage.put(datapoint.simpleHashCode(),datapoint);
}
Program: 37797
Project: 37797
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public FlowValidationDto validateFlow(final String flowId,final String correlationId){
  Flow flow=pathComputer.getFlow(flowId);
  if (flow == null)   return null;
  logger.debug("String_Node_Str",flow);
  Set<String> switches=new HashSet<>();
  switches.add(flow.getSourceSwitch());
  if (flow.getFlowPath() == null) {
    throw new InvalidPathException(flowId,"String_Node_Str");
  }
  for (  PathNode node : flow.getFlowPath().getPath()) {
    switches.add(node.getSwitchId());
  }
  switches.add(flow.getDestinationSwitch());
  Long ignoreCookie=0L;
  int correlation_iter=1;
  Map<String,SwitchFlowEntries> rules=new HashMap<>();
  for (  String switchid : switches) {
    String corr_id=correlationId + "String_Node_Str" + correlation_iter++;
    rules.put(switchid,switchService.getRules(switchid,ignoreCookie,corr_id));
  }
  List<PathDiscrepancyDto> discrepencies=new ArrayList<>();
  for (  String switchid : switches) {
    PathDiscrepancyDto disc=new PathDiscrepancyDto();
    disc.setField("String_Node_Str" + switchid);
    disc.setExpectedValue("String_Node_Str");
    int numRules=(rules.get(switchid) == null) ? 0 : rules.get(switchid).getFlowEntries().size();
    disc.setActualValue("String_Node_Str" + numRules);
    disc.setNode(new PathNode());
    discrepencies.add(disc);
  }
  FlowValidationDto result=new FlowValidationDto();
  result.setFlow(flow);
  result.setFlowId(flowId);
  result.setDiscrepancies(discrepencies);
  result.setAsExpected(discrepencies.size() > 0);
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public FlowValidationDto validateFlow(final String flowId,final String correlationId){
  Flow flow=pathComputer.getFlow(flowId);
  if (flow == null)   return null;
  logger.debug("String_Node_Str",flow);
  Set<String> switches=new HashSet<>();
  switches.add(flow.getSourceSwitch());
  if (flow.getFlowPath() == null) {
    throw new InvalidPathException(flowId,"String_Node_Str");
  }
  for (  PathNode node : flow.getFlowPath().getPath()) {
    switches.add(node.getSwitchId());
  }
  switches.add(flow.getDestinationSwitch());
  Long ignoreCookie=0L;
  int correlation_iter=1;
  Map<String,SwitchFlowEntries> rules=new HashMap<>();
  for (  String switchid : switches) {
    String corr_id=correlationId + "String_Node_Str" + correlation_iter++;
    rules.put(switchid,switchService.getRules(switchid,ignoreCookie,corr_id));
  }
  List<PathDiscrepancyDto> discrepencies=new ArrayList<>();
  for (  String switchid : switches) {
    PathDiscrepancyDto disc=new PathDiscrepancyDto();
    disc.setField("String_Node_Str" + switchid);
    disc.setExpectedValue("String_Node_Str");
    int numRules=(rules.get(switchid) == null) ? 0 : rules.get(switchid).getFlowEntries().size();
    disc.setActualValue("String_Node_Str" + numRules);
    disc.setNode(new PathNode());
    discrepencies.add(disc);
  }
  FlowValidationDto result=new FlowValidationDto();
  result.setFlow(flow);
  result.setFlowId(flowId);
  result.setDiscrepancies(discrepencies);
  result.setAsExpected(discrepencies.size() == 0);
  return result;
}
Program: 37798
Project: 37798
Buggy source:
public FlowAdapter(Record dbRecord){
  String pathJson=dbRecord.get("String_Node_Str").asString();
  if (pathJson.equals("String_Node_Str")) {
    pathJson="String_Node_Str";
  }
  String remaining=pathJson.substring(2);
  PathInfoData path;
  pathJson="String_Node_Str" + remaining;
  try {
    path=Utils.MAPPER.readValue(pathJson,PathInfoData.class);
  }
 catch (  IOException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",pathJson),e);
  }
  flow=new Flow(dbRecord.get(Utils.FLOW_ID).asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asBoolean(),dbRecord.get("String_Node_Str").asLong(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),path,FlowState.CACHED);
}

Fixed version (ground truth):
public FlowAdapter(Record dbRecord){
  String pathJson=dbRecord.get("String_Node_Str").asString().trim();
  if (pathJson.equals("String_Node_Str")) {
    pathJson="String_Node_Str";
  }
  String start=pathJson.substring(0,pathJson.length() - 1);
  PathInfoData path;
  pathJson=start + "String_Node_Str";
  try {
    path=Utils.MAPPER.readValue(pathJson,PathInfoData.class);
  }
 catch (  IOException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",pathJson),e);
  }
  flow=new Flow(dbRecord.get(Utils.FLOW_ID).asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asBoolean(),dbRecord.get("String_Node_Str").asLong(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),path,FlowState.CACHED);
}
Program: 37799
Project: 37799
Buggy source:
/** 
 * Gets the flow path.
 * @param flowId the flowid
 * @param FlowPayload the Flow Payload
 * @return the flow path
 */
public static FlowPath getFlowPath(final String flowId,final FlowPayload flowPayload){
  PathInfoData pathInfo=new PathInfoData(setPath(flowPayload.getForward()),setPath(flowPayload.getReverse()));
  return new FlowPath(flowId,pathInfo);
}

Fixed version (ground truth):
/** 
 * Gets the flow path.
 * @param flowId the flowid
 * @param FlowPayload the Flow Payload
 * @return the flow path
 */
public FlowPath getFlowPath(final String flowId,final FlowPayload flowPayload){
  PathInfoData pathInfo=new PathInfoData(setPath(flowPayload.getForward()),setPath(flowPayload.getReverse()));
  return new FlowPath(flowId,pathInfo);
}
Program: 37800
Project: 37800
Buggy source:
/** 
 * Sets the path.
 * @param FlowPathInfoData the flow path info data
 * @return the {@link PathNode} list
 */
private static List<PathNode> setPath(final FlowPathInfoData flowPathInfoData){
  List<PathNode> pathNodes=new ArrayList<PathNode>();
  org.openkilda.integration.model.response.PathInfoData flowpath=flowPathInfoData.getFlowpath();
  List<org.openkilda.integration.model.response.PathNode> paths=flowpath.getPath();
  Integer inport=null;
  Integer seq_id=0;
  if (paths != null && !paths.isEmpty()) {
    for (    org.openkilda.integration.model.response.PathNode path : paths) {
      if (path.getSeqId() == 0) {
        pathNodes.add(new PathNode(seq_id,flowPathInfoData.getSrcPort(),path.getPortNo(),flowPathInfoData.getSrcSwitch()));
        seq_id++;
      }
 else {
        if (path.getSeqId() % 2 == 0) {
          pathNodes.add(new PathNode(seq_id,inport,path.getPortNo(),path.getSwitchId()));
          seq_id++;
        }
 else         inport=path.getPortNo();
      }
    }
  }
  pathNodes.add(new PathNode(seq_id,inport,flowPathInfoData.getDstPort(),flowPathInfoData.getDstSwitch()));
  return pathNodes;
}

Fixed version (ground truth):
/** 
 * Sets the path.
 * @param FlowPathInfoData the flow path info data
 * @return the {@link PathNode} list
 */
private List<PathNode> setPath(FlowPathInfoData flowPathInfoData){
  List<PathNode> pathNodes=new ArrayList<PathNode>();
  org.openkilda.integration.model.response.PathInfoData flowpath=flowPathInfoData.getFlowpath();
  List<org.openkilda.integration.model.response.PathNode> paths=flowpath.getPath();
  Integer inport=null;
  Integer seq_id=0;
  Map<String,String> csNames=switchIntegrationService.getCustomSwitchNameFromFile();
  if (paths != null && !paths.isEmpty()) {
    for (    org.openkilda.integration.model.response.PathNode path : paths) {
      if (path.getSeqId() == 1) {
        String switchName=switchIntegrationService.customSwitchName(csNames,flowPathInfoData.getSrcSwitch());
        pathNodes.add(new PathNode(seq_id,flowPathInfoData.getSrcPort(),path.getPortNo(),switchName));
        seq_id++;
      }
 else {
        if (path.getSeqId() % 2 == 1) {
          String switchName=switchIntegrationService.customSwitchName(csNames,path.getSwitchId());
          pathNodes.add(new PathNode(seq_id,inport,path.getPortNo(),switchName));
          seq_id++;
        }
 else         inport=path.getPortNo();
      }
    }
  }
  String switchName=switchIntegrationService.customSwitchName(csNames,flowPathInfoData.getDstSwitch());
  pathNodes.add(new PathNode(seq_id,inport,flowPathInfoData.getDstPort(),switchName));
  return pathNodes;
}
Program: 37801
Project: 37801
Buggy source:
/** 
 * Gets the flows.
 * @return the flows
 * @throws IntegrationException
 */
public List<FlowInfo> getFlows(){
  List<Flow> flowList=getAllFlowList();
  if (flowList != null) {
    List<FlowInfo> flows=FlowConverter.toFlowsInfo(flowList);
    if (!CollectionUtil.isEmpty(flows)) {
      flows.forEach(flowInfo -> {
        try {
          String status=getFlowStatus(flowInfo.getFlowid());
          flowInfo.setStatus(status);
        }
 catch (        Exception e) {
          LOGGER.error("String_Node_Str" + e,e);
        }
      }
);
    }
 else {
      throw new ContentNotFoundException();
    }
    return flows;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the flows.
 * @return the flows
 * @throws IntegrationException
 */
public List<FlowInfo> getFlows(){
  List<Flow> flowList=getAllFlowList();
  if (flowList != null) {
    List<FlowInfo> flows=FlowConverter.toFlowsInfo(flowList);
    return flows;
  }
  return null;
}
Program: 37802
Project: 37802
Buggy source:
/** 
 * Gets the flow paths.
 * @return the flow paths
 * @throws IntegrationException
 */
public FlowPath getFlowPath(final String flowId){
  try {
    HttpResponse response=restClientManager.invoke(applicationProperties.getTopologyFlows() + "String_Node_Str" + flowId,HttpMethod.GET,"String_Node_Str","String_Node_Str","String_Node_Str");
    if (RestClientManager.isValidResponse(response)) {
      FlowPayload flowPayload=restClientManager.getResponse(response,FlowPayload.class);
      return FlowPathConverter.getFlowPath(flowId,flowPayload);
    }
 else {
      String content=IoUtil.toString(response.getEntity().getContent());
      throw new InvalidResponseException(response.getStatusLine().getStatusCode(),content);
    }
  }
 catch (  Exception exception) {
    LOGGER.error("String_Node_Str" + exception.getMessage());
    throw new IntegrationException(exception);
  }
}

Fixed version (ground truth):
/** 
 * Gets the flow paths.
 * @return the flow paths
 * @throws IntegrationException
 */
public FlowPath getFlowPath(final String flowId){
  try {
    HttpResponse response=restClientManager.invoke(applicationProperties.getTopologyFlows() + "String_Node_Str" + flowId,HttpMethod.GET,"String_Node_Str","String_Node_Str","String_Node_Str");
    if (RestClientManager.isValidResponse(response)) {
      FlowPayload flowPayload=restClientManager.getResponse(response,FlowPayload.class);
      return flowPathConverter.getFlowPath(flowId,flowPayload);
    }
 else {
      String content=IoUtil.toString(response.getEntity().getContent());
      throw new InvalidResponseException(response.getStatusLine().getStatusCode(),content);
    }
  }
 catch (  Exception exception) {
    LOGGER.error("String_Node_Str" + exception.getMessage());
    throw new IntegrationException(exception);
  }
}
Program: 37803
Project: 37803
Buggy source:
@SuppressWarnings("String_Node_Str") private Map<String,String> getCustomSwitchNameFromFile(){
  Map<String,String> csNames=new HashMap<String,String>();
  InputStream inputStream=null;
  String data=null;
  try {
    inputStream=new URL(applicationProperties.getSwitchDataFilePath()).openStream();
    if (inputStream != null) {
      data=IoUtil.toString(inputStream);
      if (data != null && !StringUtils.isEmpty(data)) {
        csNames=JsonUtil.toObject(data,HashMap.class);
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
  return csNames;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Map<String,String> getCustomSwitchNameFromFile(){
  Map<String,String> csNames=new HashMap<String,String>();
  InputStream inputStream=null;
  String data=null;
  try {
    inputStream=new URL(applicationProperties.getSwitchDataFilePath()).openStream();
    if (inputStream != null) {
      data=IoUtil.toString(inputStream);
      if (data != null && !StringUtils.isEmpty(data)) {
        csNames=JsonUtil.toObject(data,HashMap.class);
      }
    }
  }
 catch (  Exception ex) {
    LOGGER.error("String_Node_Str",ex);
  }
  return csNames;
}
Program: 37804
Project: 37804
Buggy source:
/** 
 * Gets the SwitchInfoSetName.
 * @return the switches
 * @throws IntegrationException
 */
private List<SwitchInfo> getSwitchInfoSetName(List<SwitchInfo> switches){
  LOGGER.info("String_Node_Str");
  if (switches != null && !StringUtils.isEmpty(switches)) {
    Map<String,String> csNames=getCustomSwitchNameFromFile();
    for (    SwitchInfo switchInfo : switches) {
      String switchId=switchInfo.getSwitchId();
      if (csNames != null && !StringUtils.isEmpty(csNames) && csNames.size() > 0) {
        if (csNames.containsKey(switchId.toLowerCase()) || csNames.containsKey(switchId.toUpperCase())) {
          if (!IoUtil.chkStringIsNotEmpty(csNames.get(switchId))) {
            switchInfo.setName(switchId);
          }
 else {
            switchInfo.setName(csNames.get(switchId));
          }
        }
 else {
          switchInfo.setName(switchId);
        }
      }
 else       switchInfo.setName(switchId);
    }
  }
  return switches;
}

Fixed version (ground truth):
/** 
 * Gets the SwitchInfoSetName.
 * @return the switches
 * @throws IntegrationException
 */
private List<SwitchInfo> getSwitchInfoSetName(List<SwitchInfo> switches){
  LOGGER.info("String_Node_Str");
  if (switches != null && !StringUtils.isEmpty(switches)) {
    Map<String,String> csNames=getCustomSwitchNameFromFile();
    for (    SwitchInfo switchInfo : switches) {
      switchInfo.setName(customSwitchName(csNames,switchInfo.getSwitchId()));
    }
  }
  return switches;
}
Program: 37805
Project: 37805
Buggy source:
public FlowAdapter(Record dbRecord){
  String pathJson=dbRecord.get("String_Node_Str").asString();
  PathInfoData path;
  try {
    path=Utils.MAPPER.readValue(pathJson,PathInfoData.class);
  }
 catch (  IOException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",pathJson),e);
  }
  flow=new Flow(dbRecord.get(Utils.FLOW_ID).asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asBoolean(),dbRecord.get("String_Node_Str").asLong(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),path,FlowState.CACHED);
}

Fixed version (ground truth):
public FlowAdapter(Record dbRecord){
  String pathJson=dbRecord.get("String_Node_Str").asString();
  if (pathJson.equals("String_Node_Str")) {
    pathJson="String_Node_Str";
  }
  String remaining=pathJson.substring(2);
  PathInfoData path;
  pathJson="String_Node_Str" + remaining;
  try {
    path=Utils.MAPPER.readValue(pathJson,PathInfoData.class);
  }
 catch (  IOException e) {
    throw new IllegalArgumentException(String.format("String_Node_Str",pathJson),e);
  }
  flow=new Flow(dbRecord.get(Utils.FLOW_ID).asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asBoolean(),dbRecord.get("String_Node_Str").asLong(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asString(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),dbRecord.get("String_Node_Str").asInt(),path,FlowState.CACHED);
}
Program: 37806
Project: 37806
Buggy source:
@Test public void getAllFlows(){
  try (Transaction tx=graphDb.beginTx()){
    Node node1, node2;
    node1=graphDb.createNode(Label.label("String_Node_Str"));
    node1.setProperty("String_Node_Str","String_Node_Str");
    node2=graphDb.createNode(Label.label("String_Node_Str"));
    node2.setProperty("String_Node_Str","String_Node_Str");
    Relationship rel1=node1.createRelationshipTo(node2,RelationshipType.withName("String_Node_Str"));
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str",3);
    rel1.setProperty("String_Node_Str",2);
    rel1.setProperty("String_Node_Str",1);
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str",1);
    rel1.setProperty("String_Node_Str",2);
    rel1.setProperty("String_Node_Str",5);
    rel1.setProperty("String_Node_Str",5);
    rel1.setProperty("String_Node_Str",200);
    rel1.setProperty("String_Node_Str",true);
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str","String_Node_Str");
    tx.success();
  }
   List<Flow> flows=target.getAllFlows();
  Flow flow=flows.get(0);
  Assert.assertEquals(3,flow.getCookie());
  Assert.assertEquals("String_Node_Str",flow.getFlowId());
  Assert.assertEquals(true,flow.isIgnoreBandwidth());
}

Fixed version (ground truth):
@Test public void getAllFlows(){
  try (Transaction tx=graphDb.beginTx()){
    Node node1, node2;
    node1=graphDb.createNode(Label.label("String_Node_Str"));
    node1.setProperty("String_Node_Str","String_Node_Str");
    node2=graphDb.createNode(Label.label("String_Node_Str"));
    node2.setProperty("String_Node_Str","String_Node_Str");
    Relationship rel1=node1.createRelationshipTo(node2,RelationshipType.withName("String_Node_Str"));
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str",3);
    rel1.setProperty("String_Node_Str",2);
    rel1.setProperty("String_Node_Str",1);
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str",1);
    rel1.setProperty("String_Node_Str",2);
    rel1.setProperty("String_Node_Str",5);
    rel1.setProperty("String_Node_Str",5);
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str",200);
    rel1.setProperty("String_Node_Str",true);
    rel1.setProperty("String_Node_Str","String_Node_Str");
    rel1.setProperty("String_Node_Str","String_Node_Str");
    tx.success();
  }
   List<Flow> flows=target.getAllFlows();
  Flow flow=flows.get(0);
  Assert.assertEquals(3,flow.getCookie());
  Assert.assertEquals("String_Node_Str",flow.getFlowId());
  Assert.assertEquals(true,flow.isIgnoreBandwidth());
}
Program: 37807
Project: 37807
Buggy source:
/** 
 * Compares the Flow from the DB to what is on each switch.
 * @param flowId id of flow to be rerouted.
 * @param correlationId correlation ID header value.
 * @return flow payload with updated path.
 */
@ApiOperation(value="String_Node_Str",response=FlowPathPayload.class) @ApiResponses(value={@ApiResponse(code=200,response=FlowPathPayload.class,message="String_Node_Str"),@ApiResponse(code=400,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=401,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=403,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=404,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=500,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=503,response=MessageError.class,message="String_Node_Str")}) @RequestMapping(path="String_Node_Str",method=RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public ResponseEntity<FlowValidationDto> validateFlow(@PathVariable("String_Node_Str") String flowId,@RequestHeader(value=CORRELATION_ID,defaultValue=DEFAULT_CORRELATION_ID) String correlationId){
  if (correlationId.equals(DEFAULT_CORRELATION_ID))   correlationId=getUniqueCorrelation();
  logger.debug("String_Node_Str",correlationId,flowId);
  FlowValidationDto result=flowService.validateFlow(flowId,correlationId);
  ResponseEntity<FlowValidationDto> response;
  if (result == null)   response=new ResponseEntity<>(null,new HttpHeaders(),HttpStatus.NOT_FOUND);
 else   response=new ResponseEntity<>(result,new HttpHeaders(),HttpStatus.OK);
  return response;
}

Fixed version (ground truth):
/** 
 * Compares the Flow from the DB to what is on each switch.
 * @param flowId id of flow to be rerouted.
 * @param correlationId correlation ID header value.
 * @return flow payload with updated path.
 */
@ApiOperation(value="String_Node_Str",response=FlowPathPayload.class) @ApiResponses(value={@ApiResponse(code=200,response=FlowPathPayload.class,message="String_Node_Str"),@ApiResponse(code=400,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=401,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=403,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=404,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=500,response=MessageError.class,message="String_Node_Str"),@ApiResponse(code=503,response=MessageError.class,message="String_Node_Str")}) @RequestMapping(path="String_Node_Str",method=RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public ResponseEntity<FlowValidationDto> validateFlow(@PathVariable("String_Node_Str") String flowId,@RequestHeader(value=CORRELATION_ID,defaultValue=DEFAULT_CORRELATION_ID) String correlationId){
}
Program: 37808
Project: 37808
Buggy source:
/** 
 * Performs validation of specific flow - ie comparing what is in the database with what is on the network.
 * @param flowId id of the flow
 * @param correlationId request correlation Id
 * @return the results of the comparison, or null if the flow isn't found.
 */
FlowValidationDto validateFlow(final String flowId,final String correlationId);

Fixed version (ground truth):
/** 
 * Performs validation of specific flow - ie comparing what is in the database with what is on the network.
 * @param flowId id of the flow
 * @param correlationId request correlation Id
 * @return the results of the comparison, or null if the flow isn't found.
 * @throws java.nio.file.InvalidPathException if the flow doesn't return a path and it should.
 */
FlowValidationDto validateFlow(final String flowId,final String correlationId);
Program: 37809
Project: 37809
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public FlowValidationDto validateFlow(final String flowId,final String correlationId){
  Flow flow=pathComputer.getFlow(flowId);
  if (flow == null)   return null;
  Set<String> switches=new HashSet<>();
  switches.add(flow.getSourceSwitch());
  for (  PathNode node : flow.getFlowPath().getPath()) {
    switches.add(node.getSwitchId());
  }
  switches.add(flow.getDestinationSwitch());
  Long ignoreCookie=0L;
  int correlation_iter=1;
  Map<String,SwitchFlowEntries> rules=new HashMap<>();
  for (  String switchid : switches) {
    String corr_id=correlationId + "String_Node_Str" + correlation_iter++;
    rules.put(switchid,switchService.getRules(switchid,ignoreCookie,corr_id));
  }
  List<PathDiscrepancyDto> discrepencies=new ArrayList<>();
  for (  String switchid : switches) {
    PathDiscrepancyDto disc=new PathDiscrepancyDto();
    disc.setField("String_Node_Str" + switchid);
    disc.setExpectedValue("String_Node_Str");
    int numRules=(rules.get(switchid) == null) ? 0 : rules.get(switchid).getFlowEntries().size();
    disc.setActualValue("String_Node_Str" + numRules);
    disc.setNode(new PathNode());
    discrepencies.add(disc);
  }
  FlowValidationDto result=new FlowValidationDto();
  result.setFlow(flow);
  result.setFlowId(flowId);
  result.setDiscrepancies(discrepencies);
  result.setAsExpected(discrepencies.size() > 0);
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public FlowValidationDto validateFlow(final String flowId,final String correlationId){
  Flow flow=pathComputer.getFlow(flowId);
  if (flow == null)   return null;
  logger.debug("String_Node_Str",flow);
  Set<String> switches=new HashSet<>();
  switches.add(flow.getSourceSwitch());
  if (flow.getFlowPath() == null) {
    throw new InvalidPathException(flowId,"String_Node_Str");
  }
  for (  PathNode node : flow.getFlowPath().getPath()) {
    switches.add(node.getSwitchId());
  }
  switches.add(flow.getDestinationSwitch());
  Long ignoreCookie=0L;
  int correlation_iter=1;
  Map<String,SwitchFlowEntries> rules=new HashMap<>();
  for (  String switchid : switches) {
    String corr_id=correlationId + "String_Node_Str" + correlation_iter++;
    rules.put(switchid,switchService.getRules(switchid,ignoreCookie,corr_id));
  }
  List<PathDiscrepancyDto> discrepencies=new ArrayList<>();
  for (  String switchid : switches) {
    PathDiscrepancyDto disc=new PathDiscrepancyDto();
    disc.setField("String_Node_Str" + switchid);
    disc.setExpectedValue("String_Node_Str");
    int numRules=(rules.get(switchid) == null) ? 0 : rules.get(switchid).getFlowEntries().size();
    disc.setActualValue("String_Node_Str" + numRules);
    disc.setNode(new PathNode());
    discrepencies.add(disc);
  }
  FlowValidationDto result=new FlowValidationDto();
  result.setFlow(flow);
  result.setFlowId(flowId);
  result.setDiscrepancies(discrepencies);
  result.setAsExpected(discrepencies.size() > 0);
  return result;
}
Program: 37810
Project: 37810
Buggy source:
private void handleFlowEvent(FlowInfoData flowData,Tuple tuple) throws IOException {
switch (flowData.getOperation()) {
case PUSH:
    logger.debug("String_Node_Str",flowData);
  flowCache.putFlow(flowData.getPayload());
logger.info("String_Node_Str",flowData);
break;
case UNPUSH:
logger.debug("String_Node_Str",flowData);
String flowsId=flowData.getPayload().getLeft().getFlowId();
flowCache.removeFlow(flowsId);
reroutedFlows.remove(flowsId);
logger.info("String_Node_Str",flowData);
break;
case CREATE:
flowCache.putFlow(flowData.getPayload());
emitFlowMessage(flowData,tuple,flowData.getCorrelationId());
logger.info("String_Node_Str",flowData);
break;
case DELETE:
String flowsId=flowData.getPayload().getLeft().getFlowId();
flowCache.removeFlow(flowsId);
reroutedFlows.remove(flowsId);
emitFlowMessage(flowData,tuple,flowData.getCorrelationId());
logger.info("String_Node_Str",flowData);
break;
case UPDATE:
processFlowUpdate(flowData.getPayload().getLeft());
flowCache.putFlow(flowData.getPayload());
emitFlowMessage(flowData,tuple,flowData.getCorrelationId());
logger.info("String_Node_Str",flowData);
break;
case STATE:
flowCache.putFlow(flowData.getPayload());
logger.info("String_Node_Str",flowData);
break;
case CACHE:
break;
default :
logger.warn("String_Node_Str",flowData);
break;
}
}

Fixed version (ground truth):
private void handleFlowEvent(FlowInfoData flowData,Tuple tuple) throws IOException {
switch (flowData.getOperation()) {
case PUSH:
    logger.debug("String_Node_Str",flowData);
  flowCache.putFlow(flowData.getPayload());
logger.info("String_Node_Str",flowData);
break;
case UNPUSH:
logger.debug("String_Node_Str",flowData);
String flowsId2=flowData.getPayload().getLeft().getFlowId();
flowCache.removeFlow(flowsId2);
reroutedFlows.remove(flowsId2);
logger.info("String_Node_Str",flowData);
break;
case CREATE:
flowCache.putFlow(flowData.getPayload());
emitFlowMessage(flowData,tuple,flowData.getCorrelationId());
logger.info("String_Node_Str",flowData);
break;
case DELETE:
String flowsId=flowData.getPayload().getLeft().getFlowId();
flowCache.removeFlow(flowsId);
reroutedFlows.remove(flowsId);
emitFlowMessage(flowData,tuple,flowData.getCorrelationId());
logger.info("String_Node_Str",flowData);
break;
case UPDATE:
processFlowUpdate(flowData.getPayload().getLeft());
flowCache.putFlow(flowData.getPayload());
emitFlowMessage(flowData,tuple,flowData.getCorrelationId());
logger.info("String_Node_Str",flowData);
break;
case STATE:
flowCache.putFlow(flowData.getPayload());
logger.info("String_Node_Str",flowData);
break;
case CACHE:
break;
default :
logger.warn("String_Node_Str",flowData);
break;
}
}
Program: 37811
Project: 37811
Buggy source:
/** 
 * Installs egress flow on the switch.
 * @param message command message for flow installation
 */
private void doInstallEgressFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallEgressFlow command=(InstallEgressFlow)message.getData();
  logger.debug("String_Node_Str",command);
  try {
    context.getSwitchManager().installEgressFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getTransitVlanId(),command.getOutputVlanId(),command.getOutputVlanType());
    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 egress flow on the switch.
 * @param message command message for flow installation
 */
private void doInstallEgressFlow(final CommandMessage message,String replyToTopic,Destination replyDestination) throws FlowCommandException {
  InstallEgressFlow command=(InstallEgressFlow)message.getData();
  logger.debug("String_Node_Str",command);
  try {
    context.getSwitchManager().installEgressFlow(DatapathId.of(command.getSwitchId()),command.getId(),command.getCookie(),command.getInputPort(),command.getOutputPort(),command.getTransitVlanId(),command.getOutputVlanId(),command.getOutputVlanType());
    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: 37812
Project: 37812
Buggy source:
private void doSyncRulesRequest(final CommandMessage message){
  InstallMissedFlowsRequest request=(InstallMissedFlowsRequest)message.getData();
  final String switchId=request.getSwitchId();
  logger.debug("String_Node_Str",switchId);
}

Fixed version (ground truth):
private void doSyncRulesRequest(final CommandMessage message) throws FlowCommandException {
  InstallMissedFlowsRequest request=(InstallMissedFlowsRequest)message.getData();
  final String switchId=request.getSwitchId();
  logger.debug("String_Node_Str",switchId);
  for (  BaseFlow installCommand : request.getFlowCommands()) {
    logger.debug("String_Node_Str",switchId,installCommand);
    handleCommand(message,installCommand,StringUtils.EMPTY,Destination.TOPOLOGY_ENGINE);
  }
}