nus-yam/ex-repair huggingface dataset:
Program: 37936
Project: 37936
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());
    pathNodes.add(src);
    PathNode dst=new PathNode();
    dst.setSwitchId(record.get("String_Node_Str").asString());
    dst.setPortNo(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()) {
    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;
}
Program: 37937
Project: 37937
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: 37939
Project: 37939
Buggy source:
/** 
 * Gets path between source and destination switch.
 * @param flow {@link Flow} instances
 * @return {@link PathInfoData} instances
 */
ImmutablePair<PathInfoData,PathInfoData> getPath(Flow flow,Strategy strategy) throws UnroutablePathException ;

Fixed version (ground truth):
/** 
 * Gets path between source and destination switch.
 * @param flow {@link Flow} instances
 * @return {@link PathInfoData} instances
 */
ImmutablePair<PathInfoData,PathInfoData> getPath(Flow flow,Strategy strategy) throws UnroutablePathException, RecoverableException ;
Program: 37941
Project: 37941
Buggy source:
private void handleRestoreRequest(CommandMessage message,Tuple tuple) throws IOException {
  ImmutablePair<Flow,Flow> requestedFlow=((FlowRestoreRequest)message.getData()).getPayload();
  try {
    ImmutablePair<PathInfoData,PathInfoData> path=pathComputer.getPath(requestedFlow.getLeft(),Strategy.COST);
    logger.info("String_Node_Str",path);
    ImmutablePair<Flow,Flow> flow;
    if (flowCache.cacheContainsFlow(requestedFlow.getLeft().getFlowId())) {
      flow=flowCache.updateFlow(requestedFlow,path);
    }
 else {
      flow=flowCache.createFlow(requestedFlow,path);
    }
    logger.info("String_Node_Str",flow);
    Values topology=new Values(Utils.MAPPER.writeValueAsString(new FlowInfoData(requestedFlow.getLeft().getFlowId(),flow,UPDATE,message.getCorrelationId())));
    outputCollector.emit(StreamType.UPDATE.toString(),tuple,topology);
  }
 catch (  UnroutablePathException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.CREATION_FAILURE,"String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private void handleRestoreRequest(CommandMessage message,Tuple tuple) throws IOException, RecoverableException {
  ImmutablePair<Flow,Flow> requestedFlow=((FlowRestoreRequest)message.getData()).getPayload();
  try {
    ImmutablePair<PathInfoData,PathInfoData> path=pathComputer.getPath(requestedFlow.getLeft(),Strategy.COST);
    logger.info("String_Node_Str",path);
    ImmutablePair<Flow,Flow> flow;
    if (flowCache.cacheContainsFlow(requestedFlow.getLeft().getFlowId())) {
      flow=flowCache.updateFlow(requestedFlow,path);
    }
 else {
      flow=flowCache.createFlow(requestedFlow,path);
    }
    logger.info("String_Node_Str",flow);
    Values topology=new Values(Utils.MAPPER.writeValueAsString(new FlowInfoData(requestedFlow.getLeft().getFlowId(),flow,UPDATE,message.getCorrelationId())));
    outputCollector.emit(StreamType.UPDATE.toString(),tuple,topology);
  }
 catch (  UnroutablePathException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.CREATION_FAILURE,"String_Node_Str","String_Node_Str");
  }
}
Program: 37943
Project: 37943
Buggy source:
private void handleUpdateRequest(CommandMessage message,Tuple tuple) throws IOException {
  Flow requestedFlow=((FlowUpdateRequest)message.getData()).getPayload();
  ImmutablePair<PathInfoData,PathInfoData> path;
  try {
    new FlowValidator(flowCache).checkFlowForEndpointConflicts(requestedFlow);
    path=pathComputer.getPath(requestedFlow,Strategy.COST);
    logger.info("String_Node_Str",path);
  }
 catch (  FlowValidationException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.UPDATE_FAILURE,"String_Node_Str",e.getMessage());
  }
catch (  UnroutablePathException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.UPDATE_FAILURE,"String_Node_Str","String_Node_Str");
  }
  ImmutablePair<Flow,Flow> flow=flowCache.updateFlow(requestedFlow,path);
  logger.info("String_Node_Str",flow);
  FlowInfoData data=new FlowInfoData(requestedFlow.getFlowId(),flow,UPDATE,message.getCorrelationId());
  InfoMessage infoMessage=new InfoMessage(data,System.currentTimeMillis(),message.getCorrelationId());
  Values topology=new Values(MAPPER.writeValueAsString(infoMessage));
  outputCollector.emit(StreamType.UPDATE.toString(),tuple,topology);
  Values northbound=new Values(new InfoMessage(new FlowResponse(buildFlowResponse(flow)),message.getTimestamp(),message.getCorrelationId(),Destination.NORTHBOUND));
  outputCollector.emit(StreamType.RESPONSE.toString(),tuple,northbound);
}

Fixed version (ground truth):
private void handleUpdateRequest(CommandMessage message,Tuple tuple) throws IOException, RecoverableException {
  Flow requestedFlow=((FlowUpdateRequest)message.getData()).getPayload();
  ImmutablePair<PathInfoData,PathInfoData> path;
  try {
    new FlowValidator(flowCache).checkFlowForEndpointConflicts(requestedFlow);
    path=pathComputer.getPath(requestedFlow,Strategy.COST);
    logger.info("String_Node_Str",path);
  }
 catch (  FlowValidationException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.UPDATE_FAILURE,"String_Node_Str",e.getMessage());
  }
catch (  UnroutablePathException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.UPDATE_FAILURE,"String_Node_Str","String_Node_Str");
  }
  ImmutablePair<Flow,Flow> flow=flowCache.updateFlow(requestedFlow,path);
  logger.info("String_Node_Str",flow);
  FlowInfoData data=new FlowInfoData(requestedFlow.getFlowId(),flow,UPDATE,message.getCorrelationId());
  InfoMessage infoMessage=new InfoMessage(data,System.currentTimeMillis(),message.getCorrelationId());
  Values topology=new Values(MAPPER.writeValueAsString(infoMessage));
  outputCollector.emit(StreamType.UPDATE.toString(),tuple,topology);
  Values northbound=new Values(new InfoMessage(new FlowResponse(buildFlowResponse(flow)),message.getTimestamp(),message.getCorrelationId(),Destination.NORTHBOUND));
  outputCollector.emit(StreamType.RESPONSE.toString(),tuple,northbound);
}
Program: 37944
Project: 37944
Buggy source:
private void handleCreateRequest(CommandMessage message,Tuple tuple) throws IOException {
  Flow requestedFlow=((FlowCreateRequest)message.getData()).getPayload();
  ImmutablePair<PathInfoData,PathInfoData> path;
  try {
    new FlowValidator(flowCache).checkFlowForEndpointConflicts(requestedFlow);
    path=pathComputer.getPath(requestedFlow,Strategy.COST);
    logger.info("String_Node_Str",path);
  }
 catch (  FlowValidationException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.CREATION_FAILURE,"String_Node_Str",e.getMessage());
  }
catch (  UnroutablePathException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.CREATION_FAILURE,"String_Node_Str","String_Node_Str");
  }
  ImmutablePair<Flow,Flow> flow=flowCache.createFlow(requestedFlow,path);
  logger.info("String_Node_Str",flow);
  FlowInfoData data=new FlowInfoData(requestedFlow.getFlowId(),flow,FlowOperation.CREATE,message.getCorrelationId());
  InfoMessage infoMessage=new InfoMessage(data,System.currentTimeMillis(),message.getCorrelationId());
  Values topology=new Values(MAPPER.writeValueAsString(infoMessage));
  outputCollector.emit(StreamType.CREATE.toString(),tuple,topology);
  Values northbound=new Values(new InfoMessage(new FlowResponse(buildFlowResponse(flow)),message.getTimestamp(),message.getCorrelationId(),Destination.NORTHBOUND));
  outputCollector.emit(StreamType.RESPONSE.toString(),tuple,northbound);
}

Fixed version (ground truth):
private void handleCreateRequest(CommandMessage message,Tuple tuple) throws IOException, RecoverableException {
  Flow requestedFlow=((FlowCreateRequest)message.getData()).getPayload();
  ImmutablePair<PathInfoData,PathInfoData> path;
  try {
    new FlowValidator(flowCache).checkFlowForEndpointConflicts(requestedFlow);
    path=pathComputer.getPath(requestedFlow,Strategy.COST);
    logger.info("String_Node_Str",path);
  }
 catch (  FlowValidationException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.CREATION_FAILURE,"String_Node_Str",e.getMessage());
  }
catch (  UnroutablePathException e) {
    throw new MessageException(message.getCorrelationId(),System.currentTimeMillis(),ErrorType.CREATION_FAILURE,"String_Node_Str","String_Node_Str");
  }
  ImmutablePair<Flow,Flow> flow=flowCache.createFlow(requestedFlow,path);
  logger.info("String_Node_Str",flow);
  FlowInfoData data=new FlowInfoData(requestedFlow.getFlowId(),flow,FlowOperation.CREATE,message.getCorrelationId());
  InfoMessage infoMessage=new InfoMessage(data,System.currentTimeMillis(),message.getCorrelationId());
  Values topology=new Values(MAPPER.writeValueAsString(infoMessage));
  outputCollector.emit(StreamType.CREATE.toString(),tuple,topology);
  Values northbound=new Values(new InfoMessage(new FlowResponse(buildFlowResponse(flow)),message.getTimestamp(),message.getCorrelationId(),Destination.NORTHBOUND));
  outputCollector.emit(StreamType.RESPONSE.toString(),tuple,northbound);
}
Program: 37945
Project: 37945
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: 37946
Project: 37946
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: 37947
Project: 37947
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: 37948
Project: 37948
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: 37949
Project: 37949
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: 37950
Project: 37950
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: 37951
Project: 37951
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: 37952
Project: 37952
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: 37953
Project: 37953
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: 37954
Project: 37954
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: 37955
Project: 37955
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: 37956
Project: 37956
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: 37957
Project: 37957
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: 37958
Project: 37958
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: 37959
Project: 37959
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: 37960
Project: 37960
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: 37961
Project: 37961
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: 37962
Project: 37962
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: 37963
Project: 37963
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: 37964
Project: 37964
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;
}