nus-yam/ex-repair huggingface dataset:
Program: 37710
Project: 37710
Buggy source:
/** 
 * This helper function is used with getPath(hint) to confirm the hint path exists 
 */
private SearchNode confirmIsls(List<SimpleIsl> srcIsls){
  int totalCost=0;
  LinkedList<SimpleIsl> confirmedIsls=new LinkedList<>();
  boolean validPath=true;
  for (  SimpleIsl i : srcIsls) {
    boolean foundThisOne=false;
    SimpleSwitch srcSwitch=network.getSimpleSwitch(i.src_dpid);
    if (srcSwitch != null) {
      Set<SimpleIsl> pathsToDst=safeSet(srcSwitch.outbound.get(i.dst_dpid));
      if (pathsToDst.equals(Collections.EMPTY_SET))       logger.debug("String_Node_Str",i.src_dpid,i.dst_dpid);
      for (      SimpleIsl orig : pathsToDst) {
        if (i.equals(orig)) {
          foundThisOne=true;
          confirmedIsls.add(orig);
          totalCost+=orig.cost;
          break;
        }
      }
    }
 else {
      logger.warn("String_Node_Str",i.src_dpid);
    }
    if (!foundThisOne) {
      validPath=false;
      break;
    }
  }
  if (validPath) {
    return new SearchNode(this.allowedDepth - confirmedIsls.size(),totalCost,network.getSimpleSwitch(confirmedIsls.peekLast().dst_dpid),confirmedIsls);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This helper function is used with getPath(hint) to confirm the hint path exists. 
 */
private SearchNode confirmIsls(List<SimpleIsl> srcIsls){
  int totalCost=0;
  LinkedList<SimpleIsl> confirmedIsls=new LinkedList<>();
  boolean validPath=true;
  for (  SimpleIsl i : srcIsls) {
    boolean foundThisOne=false;
    SimpleSwitch srcSwitch=network.getSimpleSwitch(i.getSrcDpid());
    if (srcSwitch != null) {
      Set<SimpleIsl> pathsToDst=srcSwitch.outbound.get(i.getDstDpid());
      for (      SimpleIsl orig : pathsToDst) {
        if (i.equals(orig)) {
          foundThisOne=true;
          confirmedIsls.add(orig);
          totalCost+=orig.getCost();
          break;
        }
      }
    }
 else {
      logger.warn("String_Node_Str",i.getSrcDpid());
    }
    if (!foundThisOne) {
      validPath=false;
      break;
    }
  }
  if (validPath) {
    return new SearchNode(this.allowedDepth - confirmedIsls.size(),totalCost,network.getSimpleSwitch(confirmedIsls.peekLast().getDstDpid()),confirmedIsls);
  }
  return null;
}
Program: 37711
Project: 37711
Buggy source:
/** 
 * This helper function is used with getPath(hint) and will swap the src and dst of each isl in the list 
 */
private List<SimpleIsl> swapSrcDst(List<SimpleIsl> originalIsls){
  List<SimpleIsl> mirrorIsls=new ArrayList<>();
  for (  SimpleIsl original : originalIsls) {
    mirrorIsls.add(new SimpleIsl(original.dst_dpid,original.src_dpid,original.dst_port,original.src_port,original.cost,original.latency));
  }
  return mirrorIsls;
}

Fixed version (ground truth):
/** 
 * This helper function is used with getPath(hint) and will swap the src and dst of each isl in the list. 
 */
private List<SimpleIsl> swapSrcDst(List<SimpleIsl> originalIsls){
  List<SimpleIsl> mirrorIsls=new ArrayList<>();
  for (  SimpleIsl original : originalIsls) {
    mirrorIsls.add(new SimpleIsl(original.getDstDpid(),original.getSrcDpid(),original.getDstPort(),original.getSrcPort(),original.getCost(),original.getLatency()));
  }
  return mirrorIsls;
}
Program: 37712
Project: 37712
Buggy source:
public SearchNode addNode(SimpleIsl nextIsl){
  SearchNode newNode=this.clone();
  newNode.parentPath.add(nextIsl);
  newNode.dst_sw=network.getSimpleSwitch(nextIsl.dst_dpid);
  newNode.allowedDepth--;
  newNode.parentCost+=nextIsl.cost;
  return newNode;
}

Fixed version (ground truth):
SearchNode addNode(SimpleIsl nextIsl){
  SearchNode newNode=this.clone();
  newNode.parentPath.add(nextIsl);
  newNode.dstSw=network.getSimpleSwitch(nextIsl.getDstDpid());
  newNode.allowedDepth--;
  newNode.parentCost+=nextIsl.getCost();
  return newNode;
}
Program: 37714
Project: 37714
Buggy source:
@Override @SuppressWarnings("String_Node_Str") protected SearchNode clone(){
  return new SearchNode(allowedDepth,parentCost,dst_sw,(LinkedList<SimpleIsl>)parentPath.clone());
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") protected SearchNode clone(){
  return new SearchNode(allowedDepth,parentCost,dstSw,(LinkedList<SimpleIsl>)parentPath.clone());
}
Program: 37715
Project: 37715
Buggy source:
public SearchNode(int allowedDepth,int parentCost,SimpleSwitch dst_sw,LinkedList<SimpleIsl> parentPath){
  this.dst_sw=dst_sw;
  this.allowedDepth=allowedDepth;
  this.parentCost=parentCost;
  this.parentPath=parentPath;
}

Fixed version (ground truth):
SearchNode(int allowedDepth,int parentCost,SimpleSwitch dstSw,LinkedList<SimpleIsl> parentPath){
  this.dstSw=dstSw;
  this.allowedDepth=allowedDepth;
  this.parentCost=parentCost;
  this.parentPath=parentPath;
}
Program: 37716
Project: 37716
Buggy source:
public SimpleGetShortestPath(AvailableNetwork network,String src_dpid,String dst_dpid,int allowedDepth){
  this.network=network;
  this.start=network.getSwitches().get(src_dpid);
  this.end=network.getSwitches().get(dst_dpid);
  this.allowedDepth=allowedDepth;
  if (this.start == null)   logger.warn("String_Node_Str",src_dpid);
  if (this.end == null)   logger.warn("String_Node_Str",dst_dpid);
}

Fixed version (ground truth):
public SimpleGetShortestPath(AvailableNetwork network,String srcDpid,String dstDpid,int allowedDepth){
  this.network=network;
  this.start=network.getSwitches().get(srcDpid);
  this.end=network.getSwitches().get(dstDpid);
  this.allowedDepth=allowedDepth;
  if (this.start == null) {
    logger.warn("String_Node_Str",srcDpid);
  }
  if (this.end == null) {
    logger.warn("String_Node_Str",dstDpid);
  }
}
Program: 37717
Project: 37717
Buggy source:
/** 
 * Use this comparison if very strong equality is needed (most likely rare; probably only testing)
 * @return true if every field is the same.
 */
public boolean identical(Object o){
  if (this.equals(o)) {
    SimpleIsl simpleIsl=(SimpleIsl)o;
    return cost == simpleIsl.cost && latency == simpleIsl.latency;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Use this comparison if very strong equality is needed (most likely rare; probably only testing).
 * @return true if every field is the same.
 */
public boolean identical(Object o){
  if (this.equals(o)) {
    SimpleIsl simpleIsl=(SimpleIsl)o;
    return cost == simpleIsl.cost && latency == simpleIsl.latency;
  }
  return false;
}
Program: 37718
Project: 37718
Buggy source:
public SimpleIsl(String src_dpid,String dst_dpid,int src_port,int dst_port,int cost,int latency){
  this.src_dpid=src_dpid;
  this.dst_dpid=dst_dpid;
  this.src_port=src_port;
  this.dst_port=dst_port;
  this.cost=(cost == 0) ? DEFAULT_COST : cost;
  this.latency=latency;
}

Fixed version (ground truth):
public SimpleIsl(String srcDpid,String dstDpid,int srcPort,int dstPort,int cost,int latency){
  this.srcDpid=srcDpid;
  this.dstDpid=dstDpid;
  this.srcPort=srcPort;
  this.dstPort=dstPort;
  this.cost=(cost == 0) ? DEFAULT_COST : cost;
  this.latency=latency;
}
Program: 37719
Project: 37719
Buggy source:
public SimpleSwitch addOutbound(SimpleIsl isl){
  outbound.computeIfAbsent(isl.dst_dpid,newSet -> new HashSet<>()).add(isl);
  return this;
}

Fixed version (ground truth):
public SimpleSwitch addOutbound(SimpleIsl isl){
  outbound.computeIfAbsent(isl.getDstDpid(),newSet -> new HashSet<>()).add(isl);
  return this;
}
Program: 37720
Project: 37720
Buggy source:
@Builder @JsonCreator public LinkProps(@JsonProperty("String_Node_Str") NetworkEndpoint source,@JsonProperty("String_Node_Str") NetworkEndpoint dest,@JsonProperty("String_Node_Str") Map<String,String> props){
  this.source=source;
  this.dest=dest;
  this.props=props;
}

Fixed version (ground truth):
public LinkProps(NetworkEndpoint source,NetworkEndpoint dest,Map<String,String> props){
  this.source=source;
  this.dest=dest;
  this.props=props;
  this.created=null;
  this.modified=null;
}
Program: 37721
Project: 37721
Buggy source:
public boolean isReadRequest(){
  return this.getClass().isAnnotationPresent(ReadRequest.class);
}

Fixed version (ground truth):
@JsonIgnore public boolean isReadRequest(){
  return this.getClass().isAnnotationPresent(ReadRequest.class);
}
Program: 37722
Project: 37722
Buggy source:
public LinkPropsData(@JsonProperty("String_Node_Str") NetworkEndpoint source,@JsonProperty("String_Node_Str") NetworkEndpoint destination,@JsonProperty("String_Node_Str") Map<String,String> props){
  this.source=source;
  this.destination=destination;
  this.props=props;
}

Fixed version (ground truth):
public LinkPropsData(@JsonProperty("String_Node_Str") LinkProps linkProps){
  this.linkProps=linkProps;
}
Program: 37723
Project: 37723
Buggy source:
/** 
 * Produce   {@link LinkProps} object with predefined data.
 */
public static LinkProps makeSubject(){
  NetworkEndpoint source=new NetworkEndpoint("String_Node_Str",8);
  NetworkEndpoint dest=new NetworkEndpoint("String_Node_Str",9);
  HashMap<String,String> props=new HashMap<>();
  props.put("String_Node_Str","String_Node_Str");
  return new LinkProps(source,dest,props);
}

Fixed version (ground truth):
/** 
 * Produce   {@link LinkProps} object with predefined data.
 */
public static LinkProps makeSubject(){
  NetworkEndpoint source=new NetworkEndpoint("String_Node_Str",8);
  NetworkEndpoint dest=new NetworkEndpoint("String_Node_Str",9);
  HashMap<String,String> props=new HashMap<>();
  props.put("String_Node_Str","String_Node_Str");
  long created=System.currentTimeMillis();
  return new LinkProps(source,dest,props,created,created);
}
Program: 37724
Project: 37724
Buggy source:
/** 
 * Converts link properties to   {@link LinkPropsDto}.
 */
default LinkPropsDto toDto(LinkPropsData data){
  NetworkEndpoint source=data.getSource();
  NetworkEndpoint destination=data.getDestination();
  return new LinkPropsDto(source.getDatapath(),source.getPortNumber(),destination.getDatapath(),destination.getPortNumber(),data.getProps());
}

Fixed version (ground truth):
/** 
 * Converts link properties to   {@link LinkPropsDto}.
 */
default LinkPropsDto toDto(LinkPropsData data){
  requireNonNull(data.getLinkProps(),"String_Node_Str");
  NetworkEndpoint source=data.getLinkProps().getSource();
  NetworkEndpoint destination=data.getLinkProps().getDest();
  return new LinkPropsDto(source.getDatapath(),source.getPortNumber(),destination.getDatapath(),destination.getPortNumber(),data.getLinkProps().getProps());
}
Program: 37725
Project: 37725
Buggy source:
@Test public void shouldGetPropsList(){
  final String correlationId="String_Node_Str";
  LinkPropsData linkProps=new LinkPropsData(new NetworkEndpoint("String_Node_Str",1),new NetworkEndpoint("String_Node_Str",2),Collections.singletonMap("String_Node_Str","String_Node_Str"));
  Message message=new ChunkedInfoMessage(linkProps,0,correlationId,null);
  messageExchanger.mockResponse(message);
  RequestCorrelationId.create(correlationId);
  List<LinkPropsDto> result=linkService.getLinkProps(null,0,null,0);
  assertFalse("String_Node_Str",result.isEmpty());
  LinkPropsDto dto=result.get(0);
  assertThat(dto.getSrcSwitch(),is(linkProps.getSource().getDatapath()));
  assertThat(dto.getSrcPort(),is(linkProps.getSource().getPortNumber()));
  assertThat(dto.getDstSwitch(),is(linkProps.getDestination().getDatapath()));
  assertThat(dto.getDstPort(),is(linkProps.getDestination().getPortNumber()));
}

Fixed version (ground truth):
@Test public void shouldGetPropsList(){
  final String correlationId="String_Node_Str";
  LinkProps linkProps=new LinkProps(new NetworkEndpoint("String_Node_Str",1),new NetworkEndpoint("String_Node_Str",2),Collections.singletonMap("String_Node_Str","String_Node_Str"));
  LinkPropsData linkPropsData=new LinkPropsData(linkProps);
  Message message=new ChunkedInfoMessage(linkPropsData,0,correlationId,null);
  messageExchanger.mockResponse(message);
  RequestCorrelationId.create(correlationId);
  List<LinkPropsDto> result=linkService.getLinkProps(null,0,null,0);
  assertFalse("String_Node_Str",result.isEmpty());
  LinkPropsDto dto=result.get(0);
  assertThat(dto.getSrcSwitch(),is(linkPropsData.getLinkProps().getSource().getDatapath()));
  assertThat(dto.getSrcPort(),is(linkPropsData.getLinkProps().getSource().getPortNumber()));
  assertThat(dto.getDstSwitch(),is(linkPropsData.getLinkProps().getDest().getDatapath()));
  assertThat(dto.getDstPort(),is(linkPropsData.getLinkProps().getDest().getPortNumber()));
}
Program: 37726
Project: 37726
Buggy source:
private Set<String> availablePermissions(final UserInfo userInfo){
  Set<String> availablePermissions=new HashSet<>();
  Set<String> roles=userInfo.getRoles();
  if (roles != null && roles.size() > 0) {
    List<Role> roleList=roleService.getRoleByName(roles);
    for (    Role role : roleList) {
      if (role.getPermissions() != null) {
        for (        Permission permission : role.getPermissions()) {
          if (Status.ACTIVE.getStatusEntity().getStatus().equalsIgnoreCase(permission.getStatus())) {
            availablePermissions.add(permission.getName());
          }
        }
      }
    }
  }
  return availablePermissions;
}

Fixed version (ground truth):
private Set<String> availablePermissions(final UserInfo userInfo){
  Set<String> availablePermissions=new HashSet<>();
  if (userInfo.getUserId() != 1) {
    Set<String> roles=userInfo.getRoles();
    if (roles != null && roles.size() > 0) {
      List<Role> roleList=roleService.getRoleByName(roles);
      for (      Role role : roleList) {
        if (role.getPermissions() != null) {
          for (          Permission permission : role.getPermissions()) {
            if (Status.ACTIVE.getStatusEntity().getStatus().equalsIgnoreCase(permission.getStatus())) {
              availablePermissions.add(permission.getName());
            }
          }
        }
      }
    }
  }
 else {
    List<Permission> permissions=permissionService.getAllPermission(userInfo.getUserId());
    for (    Permission permission : permissions) {
      availablePermissions.add(permission.getName());
    }
  }
  userInfo.setPermissions(availablePermissions);
  return availablePermissions;
}
Program: 37727
Project: 37727
Buggy source:
private void validateAndPopulatePermisssion(final UserInfo userInfo,final Permissions permissions) throws Exception {
  if (!permissions.checkObjectAccessPermissions()) {
    if (!hasPermissions(userInfo,permissions.values())) {
      throw new AccessDeniedException(messageUtils.getUnauthorizedMessage());
    }
  }
}

Fixed version (ground truth):
private void validateAndPopulatePermisssion(final UserInfo userInfo,final Permissions permissions) throws Exception {
  if (!permissions.checkObjectAccessPermissions()) {
    if (!hasPermissions(userInfo,permissions.values())) {
      LOGGER.error("String_Node_Str" + userInfo.getUserId() + "String_Node_Str"+ permissions.values());
      throw new AccessDeniedException(messageUtils.getUnauthorizedMessage());
    }
  }
}
Program: 37728
Project: 37728
Buggy source:
@Override public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) throws Exception {
  String correlationId=request.getParameter(CORRELATION_ID);
  correlationId=correlationId == null ? UUID.randomUUID().toString() : correlationId;
  try {
    MDC.put(CORRELATION_ID,correlationId);
    HttpSession session=request.getSession();
    UserInfo userInfo=null;
    userInfo=(UserInfo)session.getAttribute(IConstants.SESSION_OBJECT);
    if (userInfo != null) {
      if (handler instanceof HandlerMethod) {
        HandlerMethod handlerMethod=(HandlerMethod)handler;
        Permissions permissions=handlerMethod.getMethod().getAnnotation(Permissions.class);
        LOGGER.info("String_Node_Str");
        if (permissions != null) {
          LOGGER.info("String_Node_Str" + permissions.values());
          validateAndPopulatePermisssion(userInfo,permissions);
        }
      }
      updateRequestContext(correlationId,request,userInfo);
    }
  }
 catch (  IllegalStateException ex) {
    LOGGER.info("String_Node_Str" + ex.getLocalizedMessage(),ex);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) throws Exception {
  String correlationId=request.getParameter(CORRELATION_ID);
  correlationId=correlationId == null ? UUID.randomUUID().toString() : correlationId;
  try {
    MDC.put(CORRELATION_ID,correlationId);
    HttpSession session=request.getSession();
    UserInfo userInfo=null;
    userInfo=(UserInfo)session.getAttribute(IConstants.SESSION_OBJECT);
    if (userInfo != null) {
      if (handler instanceof HandlerMethod) {
        HandlerMethod handlerMethod=(HandlerMethod)handler;
        Permissions permissions=handlerMethod.getMethod().getAnnotation(Permissions.class);
        if (permissions != null) {
          validateAndPopulatePermisssion(userInfo,permissions);
        }
      }
      updateRequestContext(correlationId,request,userInfo);
    }
  }
 catch (  IllegalStateException ex) {
    LOGGER.info("String_Node_Str" + ex.getLocalizedMessage(),ex);
  }
  return true;
}
Program: 37729
Project: 37729
Buggy source:
/** 
 * Sets request payload.
 * @param payload request payload
 */
public void setPayload(final FlowIdStatusPayload payload){
  if (payload == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.payload=payload;
}

Fixed version (ground truth):
/** 
 * Sets request payload.
 * @param payload request payload
 */
public void setPayload(final FlowIdStatusPayload payload){
  this.payload=payload;
}
Program: 37730
Project: 37730
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public List<FlowPayload> getFlows(){
  final String correlationId=RequestCorrelationId.getId();
  LOGGER.debug("String_Node_Str",CORRELATION_ID,correlationId);
  FlowsGetRequest data=new FlowsGetRequest(new FlowIdStatusPayload());
  CommandMessage request=new CommandMessage(data,System.currentTimeMillis(),correlationId,Destination.WFM);
  messageConsumer.clear();
  messageProducer.send(topic,request);
  Message message=(Message)messageConsumer.poll(correlationId);
  FlowsResponse response=(FlowsResponse)validateInfoMessage(request,message,correlationId);
  List<FlowPayload> result=collectFlows(response.getFlowIds(),correlationId);
  logger.debug("String_Node_Str",CORRELATION_ID,correlationId,result.size());
  return result;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public List<FlowPayload> getFlows(){
  final String correlationId=RequestCorrelationId.getId();
  LOGGER.debug("String_Node_Str");
  FlowGetRequest data=new FlowGetRequest();
  CommandMessage request=new CommandMessage(data,System.currentTimeMillis(),correlationId,Destination.WFM);
  messageProducer.send(topic,request);
  List<FlowResponse> result=flowsCollector.getResult(correlationId);
  logger.debug("String_Node_Str",result.size());
  return result.stream().map(FlowResponse::getPayload).map(FlowPayloadToFlowConverter::buildFlowPayloadByFlow).collect(Collectors.toList());
}
Program: 37731
Project: 37731
Buggy source:
/** 
 * Chooses response by request.
 * @param data received from kafka CommandData message payload
 * @return InfoMassage to be send as response payload
 */
private Message formatResponse(final String correlationId,final CommandData data){
  if (data instanceof FlowCreateRequest) {
    return new InfoMessage(flowResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowDeleteRequest) {
    return new InfoMessage(flowResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowUpdateRequest) {
    return new InfoMessage(flowResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowGetRequest) {
    if (ERROR_FLOW_ID.equals(((FlowGetRequest)data).getPayload().getId())) {
      return new ErrorMessage(new ErrorData(ErrorType.NOT_FOUND,"String_Node_Str",ERROR_FLOW_ID),0,correlationId,Destination.NORTHBOUND);
    }
 else {
      return new InfoMessage(flowResponse,0,correlationId,Destination.NORTHBOUND);
    }
  }
 else   if (data instanceof FlowsGetRequest) {
    return new InfoMessage(flowsResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowStatusRequest) {
    return new InfoMessage(flowStatusResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowPathRequest) {
    return new InfoMessage(flowPathResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof SwitchRulesDeleteRequest) {
    return new InfoMessage(switchRulesResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Chooses response by request.
 * @param data received from kafka CommandData message payload
 * @return InfoMassage to be send as response payload
 */
private Message formatResponse(final String correlationId,final CommandData data){
  if (data instanceof FlowCreateRequest) {
    return new InfoMessage(flowResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowDeleteRequest) {
    return new InfoMessage(flowResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowUpdateRequest) {
    return new InfoMessage(flowResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowGetRequest) {
    FlowIdStatusPayload request=((FlowGetRequest)data).getPayload();
    return getFlowResponse(request,correlationId);
  }
 else   if (data instanceof FlowStatusRequest) {
    return new InfoMessage(flowStatusResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof FlowPathRequest) {
    return new InfoMessage(flowPathResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else   if (data instanceof SwitchRulesDeleteRequest) {
    return new InfoMessage(switchRulesResponse,0,correlationId,Destination.NORTHBOUND);
  }
 else {
    return null;
  }
}
Program: 37732
Project: 37732
Buggy source:
private boolean hasPermissions(final UserInfo userInfo,final String... permissions){
  LOGGER.info("String_Node_Str");
  boolean hasPermission=true;
  Set<String> availablePermissions=availablePermissions(userInfo);
  if (!availablePermissions.isEmpty()) {
    for (    String permission : permissions) {
      if (!availablePermissions.contains(permission)) {
        hasPermission=false;
        break;
      }
    }
  }
 else {
    hasPermission=false;
  }
  LOGGER.info("String_Node_Str");
  return hasPermission;
}

Fixed version (ground truth):
private boolean hasPermissions(final UserInfo userInfo,final String... permissions){
  boolean hasPermission=true;
  Set<String> availablePermissions=availablePermissions(userInfo);
  if (!availablePermissions.isEmpty()) {
    for (    String permission : permissions) {
      if (!availablePermissions.contains(permission)) {
        hasPermission=false;
        break;
      }
    }
  }
 else {
    hasPermission=false;
  }
  return hasPermission;
}
Program: 37733
Project: 37733
Buggy source:
private void validateAndPopulatePermisssion(final UserInfo userInfo,final Permissions permissions) throws Exception {
  if (!permissions.checkObjectAccessPermissions()) {
    if (!hasPermissions(userInfo,permissions.values())) {
      throw new AccessDeniedException(messageUtils.getUnauthorizedMessage());
    }
  }
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
private void validateAndPopulatePermisssion(final UserInfo userInfo,final Permissions permissions) throws Exception {
  if (!permissions.checkObjectAccessPermissions()) {
    if (!hasPermissions(userInfo,permissions.values())) {
      throw new AccessDeniedException(messageUtils.getUnauthorizedMessage());
    }
  }
}
Program: 37734
Project: 37734
Buggy source:
@Override public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) throws Exception {
  String correlationId=request.getParameter(CORRELATION_ID);
  correlationId=correlationId == null ? UUID.randomUUID().toString() : correlationId;
  try {
    MDC.put(CORRELATION_ID,correlationId);
    HttpSession session=request.getSession();
    UserInfo userInfo=null;
    userInfo=(UserInfo)session.getAttribute(IConstants.SESSION_OBJECT);
    if (userInfo != null) {
      if (handler instanceof HandlerMethod) {
        HandlerMethod handlerMethod=(HandlerMethod)handler;
        Permissions permissions=handlerMethod.getMethod().getAnnotation(Permissions.class);
        LOGGER.info("String_Node_Str");
        if (permissions != null) {
          LOGGER.info("String_Node_Str" + permissions.values());
          validateAndPopulatePermisssion(userInfo,permissions);
        }
      }
      updateRequestContext(correlationId,request,userInfo);
      LOGGER.info("String_Node_Str");
    }
  }
 catch (  IllegalStateException ex) {
    LOGGER.info("String_Node_Str" + ex.getLocalizedMessage(),ex);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean preHandle(final HttpServletRequest request,final HttpServletResponse response,final Object handler) throws Exception {
  String correlationId=request.getParameter(CORRELATION_ID);
  correlationId=correlationId == null ? UUID.randomUUID().toString() : correlationId;
  try {
    MDC.put(CORRELATION_ID,correlationId);
    HttpSession session=request.getSession();
    UserInfo userInfo=null;
    userInfo=(UserInfo)session.getAttribute(IConstants.SESSION_OBJECT);
    if (userInfo != null) {
      if (handler instanceof HandlerMethod) {
        HandlerMethod handlerMethod=(HandlerMethod)handler;
        Permissions permissions=handlerMethod.getMethod().getAnnotation(Permissions.class);
        LOGGER.info("String_Node_Str");
        if (permissions != null) {
          LOGGER.info("String_Node_Str" + permissions.values());
          validateAndPopulatePermisssion(userInfo,permissions);
        }
      }
      updateRequestContext(correlationId,request,userInfo);
    }
  }
 catch (  IllegalStateException ex) {
    LOGGER.info("String_Node_Str" + ex.getLocalizedMessage(),ex);
  }
  return true;
}
Program: 37735
Project: 37735
Buggy source:
/** 
 * Return logged in user information.
 * @param request HttpServletRequest to retrieve logged in user information.
 * @return logged in user information.
 */
protected UserInfo getLoggedInUser(final HttpServletRequest request){
  LOGGER.info("String_Node_Str");
  HttpSession session=request.getSession();
  UserInfo userInfo=null;
  try {
    userInfo=(UserInfo)session.getAttribute(IConstants.SESSION_OBJECT);
  }
 catch (  IllegalStateException ex) {
    LOGGER.info("String_Node_Str" + ex.getLocalizedMessage(),ex);
  }
 finally {
    if (userInfo == null) {
      session=request.getSession(false);
      userInfo=new UserInfo();
      session.setAttribute(IConstants.SESSION_OBJECT,userInfo);
    }
  }
  return userInfo;
}

Fixed version (ground truth):
/** 
 * Return logged in user information.
 * @param request HttpServletRequest to retrieve logged in user information.
 * @return logged in user information.
 */
protected UserInfo getLoggedInUser(final HttpServletRequest request){
  HttpSession session=request.getSession();
  UserInfo userInfo=null;
  try {
    userInfo=(UserInfo)session.getAttribute(IConstants.SESSION_OBJECT);
  }
 catch (  IllegalStateException ex) {
    LOGGER.info("String_Node_Str" + ex.getLocalizedMessage(),ex);
  }
 finally {
    if (userInfo == null) {
      session=request.getSession(false);
      userInfo=new UserInfo();
      session.setAttribute(IConstants.SESSION_OBJECT,userInfo);
    }
  }
  return userInfo;
}
Program: 37736
Project: 37736
Buggy source:
/** 
 * Sending message.
 * @param receivers the list of receivers.
 * @param subject mail subject.
 * @param template template.
 * @param context Map with context values for velocity template.
 */
public void send(final String receiver,final String subject,final TemplateService.Template template,final Map<String,Object> context){
  MimeMessage mimeMessage=javaMailSender.createMimeMessage();
  MimeMessageHelper msg=new MimeMessageHelper(mimeMessage);
  if (!StringUtil.isNullOrEmpty(receiver)) {
    try {
      msg.setSubject(subject);
      msg.setTo(receiver);
      msg.setText(templateService.mergeTemplateToString(template,context),true);
    }
 catch (    MessagingException e) {
      e.printStackTrace();
    }
    javaMailSender.send(mimeMessage);
  }
}

Fixed version (ground truth):
/** 
 * Sending message.
 * @param receivers the list of receivers.
 * @param subject mail subject.
 * @param template template.
 * @param context Map with context values for velocity template.
 */
public void send(final String receiver,final String subject,final TemplateService.Template template,final Map<String,Object> context){
  MimeMessage mimeMessage=javaMailSender.createMimeMessage();
  MimeMessageHelper msg=new MimeMessageHelper(mimeMessage);
  if (!StringUtil.isNullOrEmpty(receiver)) {
    try {
      msg.setSubject(subject);
      msg.setTo(receiver);
      msg.setText(templateService.mergeTemplateToString(template,context),true);
      javaMailSender.send(mimeMessage);
      LOGGER.info("String_Node_Str" + subject);
    }
 catch (    MessagingException e) {
      LOGGER.error("String_Node_Str" + e.getMessage(),e);
    }
  }
}
Program: 37737
Project: 37737
Buggy source:
@Override public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException {
  LOGGER.info("String_Node_Str");
  UserEntity user=userRepository.findByUsername(username);
  Set<GrantedAuthority> authorities=new HashSet<GrantedAuthority>(0);
  if (user == null) {
    throw new UsernameNotFoundException(username);
  }
  return new org.springframework.security.core.userdetails.User(username,user.getPassword(),authorities);
}

Fixed version (ground truth):
@Override public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException {
  UserEntity user=userRepository.findByUsername(username);
  Set<GrantedAuthority> authorities=new HashSet<GrantedAuthority>(0);
  if (user == null) {
    throw new UsernameNotFoundException(username);
  }
  return new org.springframework.security.core.userdetails.User(username,user.getPassword(),authorities);
}
Program: 37739
Project: 37739
Buggy source:
private void handleIslEvent(IslInfoData isl,Tuple tuple,String correlationId){
  logger.debug("String_Node_Str",isl.getId(),isl.getState());
  Set<ImmutablePair<Flow,Flow>> affectedFlows;
switch (isl.getState()) {
case DISCOVERED:
    if (networkCache.cacheContainsIsl(isl.getId())) {
      networkCache.updateIsl(isl);
    }
 else {
      networkCache.createIsl(isl);
    }
  break;
case FAILED:
case MOVED:
try {
  networkCache.deleteIsl(isl.getId());
}
 catch (CacheException exception) {
  logger.warn("String_Node_Str",exception.getErrorMessage(),exception.getErrorDescription());
}
affectedFlows=flowCache.getActiveFlowsWithAffectedPath(isl);
String reason=String.format("String_Node_Str",isl.getId());
emitRerouteCommands(affectedFlows,tuple,correlationId,FlowOperation.UPDATE,reason);
break;
case OTHER_UPDATE:
break;
case CACHED:
break;
default :
logger.warn("String_Node_Str");
break;
}
}

Fixed version (ground truth):
private void handleIslEvent(IslInfoData isl,Tuple tuple,String correlationId){
  logger.debug("String_Node_Str",isl.getId(),isl.getState());
  Set<ImmutablePair<Flow,Flow>> affectedFlows;
switch (isl.getState()) {
case DISCOVERED:
    if (networkCache.cacheContainsIsl(isl.getId())) {
      networkCache.updateIsl(isl);
    }
 else {
      if (networkCache.isSelfLoopedIsl(isl)) {
        logger.warn("String_Node_Str",isl);
      }
 else {
        networkCache.createIsl(isl);
      }
    }
  break;
case FAILED:
case MOVED:
try {
  networkCache.deleteIsl(isl.getId());
}
 catch (CacheException exception) {
  logger.warn("String_Node_Str",exception.getErrorMessage(),exception.getErrorDescription());
}
affectedFlows=flowCache.getActiveFlowsWithAffectedPath(isl);
String reason=String.format("String_Node_Str",isl.getId());
emitRerouteCommands(affectedFlows,tuple,correlationId,FlowOperation.UPDATE,reason);
break;
case OTHER_UPDATE:
break;
case CACHED:
break;
default :
logger.warn("String_Node_Str");
break;
}
}
Program: 37740
Project: 37740
Buggy source:
private void initNetwork(){
  logger.info("String_Node_Str");
  Set<SwitchInfoData> switches=new HashSet<>(pathComputer.getSwitches());
  Set<IslInfoData> links=new HashSet<>(pathComputer.getIsls());
  logger.info("String_Node_Str",switches.size());
  logger.info("String_Node_Str",links.size());
  switches.forEach(networkCache::createOrUpdateSwitch);
  for (  IslInfoData isl : links) {
    try {
      networkCache.createOrUpdateIsl(isl);
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",isl,e);
    }
  }
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
private void initNetwork(){
  logger.info("String_Node_Str");
  Set<SwitchInfoData> switches=new HashSet<>(pathComputer.getSwitches());
  Set<IslInfoData> links=new HashSet<>(pathComputer.getIsls());
  logger.info("String_Node_Str",switches.size());
  logger.info("String_Node_Str",links.size());
  switches.forEach(networkCache::createOrUpdateSwitch);
  for (  IslInfoData isl : links) {
    try {
      if (networkCache.isSelfLoopedIsl(isl)) {
        logger.warn("String_Node_Str",isl);
      }
 else {
        networkCache.createOrUpdateIsl(isl);
      }
    }
 catch (    Exception e) {
      logger.error("String_Node_Str",isl,e);
    }
  }
  logger.info("String_Node_Str");
}
Program: 37741
Project: 37741
Buggy source:
/** 
 * Gets the switch ports.
 * @return the switch ports
 * @throws IntegrationException
 */
public List<PortInfo> getSwitchPorts(final String switchId) throws IntegrationException {
  HttpResponse response=null;
  try {
    if (RestClientManager.isValidResponse(response)) {
      String responseEntity=IoUtil.toString(response.getEntity().getContent());
      JSONObject jsonObject=JsonUtil.toObject(responseEntity,JSONObject.class);
      return PortConverter.toPortsInfo(jsonObject,switchId);
    }
  }
 catch (  IOException exception) {
    LOGGER.error("String_Node_Str" + exception.getMessage(),exception);
    throw new IntegrationException(exception);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the switch ports.
 * @return the switch ports
 * @throws IntegrationException
 */
public List<PortInfo> getSwitchPorts(final String switchId) throws IntegrationException {
  HttpResponse response=null;
  try {
    if (response != null && RestClientManager.isValidResponse(response)) {
      String responseEntity=IoUtil.toString(response.getEntity().getContent());
      JSONObject jsonObject=JsonUtil.toObject(responseEntity,JSONObject.class);
      return PortConverter.toPortsInfo(jsonObject,switchId);
    }
  }
 catch (  IOException exception) {
    LOGGER.error("String_Node_Str" + exception.getMessage(),exception);
    throw new IntegrationException(exception);
  }
  return null;
}
Program: 37742
Project: 37742
Buggy source:
/** 
 * Gets the isl link cost.
 * @return the isl link cost
 */
public List<LinkProps> getIslLinkProps(LinkProps keys){
  UriComponentsBuilder builder=UriComponentsBuilder.fromHttpUrl(applicationProperties.getLinkProps());
  builder=setLinkProps(keys,builder);
  String fullUri=builder.build().toUriString();
  HttpResponse response=restClientManager.invoke(fullUri,HttpMethod.GET,"String_Node_Str","String_Node_Str",applicationService.getAuthHeader());
  if (RestClientManager.isValidResponse(response)) {
    List<LinkProps> linkPropsResponses=restClientManager.getResponseList(response,LinkProps.class);
    if (CollectionUtil.isEmpty(linkPropsResponses)) {
      throw new ContentNotFoundException();
    }
 else {
      return linkPropsResponses;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the isl link cost.
 * @return the isl link cost
 */
public List<LinkProps> getIslLinkProps(LinkProps keys){
  UriComponentsBuilder builder=UriComponentsBuilder.fromHttpUrl(applicationProperties.getLinkProps());
  builder=setLinkProps(keys,builder);
  String fullUri=builder.build().toUriString();
  HttpResponse response=restClientManager.invoke(fullUri,HttpMethod.GET,"String_Node_Str","String_Node_Str",applicationService.getAuthHeader());
  if (RestClientManager.isValidResponse(response)) {
    List<LinkProps> linkPropsResponses=restClientManager.getResponseList(response,LinkProps.class);
    if (!CollectionUtil.isEmpty(linkPropsResponses)) {
      return linkPropsResponses;
    }
  }
  return null;
}
Program: 37743
Project: 37743
Buggy source:
private Map<String,String> islCostMap(){
  List<LinkProps> linkProps=getIslLinkProps(null);
  Map<String,String> islCostMap=new HashMap<>();
  linkProps.forEach(linkProp -> {
    String key=linkProp.getSrc_switch() + "String_Node_Str" + linkProp.getSrc_port()+ "String_Node_Str"+ linkProp.getDst_switch()+ "String_Node_Str"+ linkProp.getDst_port();
    String value=linkProp.getProperty("String_Node_Str");
    islCostMap.put(key,value);
  }
);
  return islCostMap;
}

Fixed version (ground truth):
private Map<String,String> islCostMap(){
  List<LinkProps> linkProps=getIslLinkProps(null);
  Map<String,String> islCostMap=new HashMap<>();
  if (linkProps != null) {
    linkProps.forEach(linkProp -> {
      String key=linkProp.getSrc_switch() + "String_Node_Str" + linkProp.getSrc_port()+ "String_Node_Str"+ linkProp.getDst_switch()+ "String_Node_Str"+ linkProp.getDst_port();
      String value=linkProp.getProperty("String_Node_Str");
      islCostMap.put(key,value);
    }
);
  }
  return islCostMap;
}
Program: 37745
Project: 37745
Buggy source:
public IslInfoData(@JsonProperty("String_Node_Str") List<PathNode> path,@JsonProperty("String_Node_Str") IslChangeType state){
  this.path=path;
  this.state=state;
  this.id=String.format("String_Node_Str",path.get(0).getSwitchId(),String.valueOf(path.get(0).getPortNo()));
}

Fixed version (ground truth):
/** 
 * Simple constructor for an ISL with only path and state.
 * @param path path of ISL.
 * @param state current state.
 */
public IslInfoData(@JsonProperty("String_Node_Str") List<PathNode> path,@JsonProperty("String_Node_Str") IslChangeType state){
  this.path=path;
  this.state=state;
  this.id=String.format("String_Node_Str",path.get(0).getSwitchId(),String.valueOf(path.get(0).getPortNo()));
}
Program: 37746
Project: 37746
Buggy source:
@JsonCreator public DiscoveryLink(@JsonProperty("String_Node_Str") final String srcSwitch,@JsonProperty("String_Node_Str") final int srcPort,@JsonProperty("String_Node_Str") final String dstSwitch,@JsonProperty("String_Node_Str") final int dstPort,@JsonProperty("String_Node_Str") final int attempts,@JsonProperty("String_Node_Str") final int timeCounter,@JsonProperty("String_Node_Str") final int checkInterval,@JsonProperty("String_Node_Str") final int consecutiveFailure,@JsonProperty("String_Node_Str") final int consecutiveSuccess,@JsonProperty("String_Node_Str") final int maxAttempts){
  this.srcEndpoint=new NetworkEndpoint(srcSwitch,srcPort);
  this.dstEndpoint=new NetworkEndpoint(dstSwitch,dstPort);
  this.attempts=attempts;
  this.timeCounter=timeCounter;
  this.checkInterval=checkInterval;
  this.maxAttempts=maxAttempts;
  this.consecutiveFailure=consecutiveFailure;
  this.consecutiveSuccess=consecutiveSuccess;
}

Fixed version (ground truth):
/** 
 * Main constructor using for deserialization by jackson.
 */
@JsonCreator public DiscoveryLink(@JsonProperty("String_Node_Str") final String srcSwitch,@JsonProperty("String_Node_Str") final int srcPort,@JsonProperty("String_Node_Str") final String dstSwitch,@JsonProperty("String_Node_Str") final int dstPort,@JsonProperty("String_Node_Str") final int attempts,@JsonProperty("String_Node_Str") final int timeCounter,@JsonProperty("String_Node_Str") final int checkInterval,@JsonProperty("String_Node_Str") final int consecutiveFailure,@JsonProperty("String_Node_Str") final int consecutiveSuccess,@JsonProperty("String_Node_Str") final int maxAttempts,@JsonProperty("String_Node_Str") final boolean active){
  this.srcEndpoint=new NetworkEndpoint(srcSwitch,srcPort);
  this.dstEndpoint=new NetworkEndpoint(dstSwitch,dstPort);
  this.attempts=attempts;
  this.timeCounter=timeCounter;
  this.checkInterval=checkInterval;
  this.maxAttempts=maxAttempts;
  this.consecutiveFailure=consecutiveFailure;
  this.consecutiveSuccess=consecutiveSuccess;
  this.active=active;
}
Program: 37747
Project: 37747
Buggy source:
/** 
 * @return true if link should be excluded from discovery plan and discovery packets should not be sent.
 */
public boolean isExcludedFromDiscovery(){
  if (maxAttempts == ENDLESS_ATTEMPTS) {
    return false;
  }
  return consecutiveFailure > maxAttempts;
}

Fixed version (ground truth):
/** 
 * Checks if ISL should be excluded from discovery.
 * @return true if link should be excluded from discovery plan and discovery packets should not be sent.
 */
public boolean isExcludedFromDiscovery(){
  if (maxAttempts == ENDLESS_ATTEMPTS) {
    return false;
  }
  return consecutiveFailure > maxAttempts;
}
Program: 37748
Project: 37748
Buggy source:
/** 
 * @return true if attempts is greater than attemptLimit.
 */
public boolean maxAttempts(Integer attemptLimit){
  return attemptLimit < attempts;
}

Fixed version (ground truth):
/** 
 * Check if we should stop to verify ISL.
 * @return true if attempts is greater than attemptLimit.
 */
public boolean maxAttempts(Integer attemptLimit){
  return attemptLimit < attempts;
}
Program: 37749
Project: 37749
Buggy source:
public boolean isDestinationChanged(String dstSwitch,int dstPort){
  if (this.dstEndpoint == null) {
    return false;
  }
  return !Objects.equals(this.dstEndpoint,new NetworkEndpoint(dstSwitch,dstPort));
}

Fixed version (ground truth):
/** 
 * Checks whether destination switch/port of that link differs.
 * @param dstSwitch destination switch.
 * @param dstPort destination port.
 * @return true if destination changed.
 */
public boolean isDestinationChanged(String dstSwitch,int dstPort){
  if (this.dstEndpoint == null) {
    return false;
  }
  return !Objects.equals(this.dstEndpoint,new NetworkEndpoint(dstSwitch,dstPort));
}
Program: 37750
Project: 37750
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  IslLinkInfo other=(IslLinkInfo)obj;
  if (dstPort != other.dstPort && dstPort != other.srcPort)   return false;
  if (dstSwitch == null) {
    if (other.dstSwitch != null && other.srcSwitch != null)     return false;
  }
 else   if (!dstSwitch.equals(other.dstSwitch) && !dstSwitch.equals(other.srcSwitch))   return false;
  if (srcPort != other.srcPort && srcPort != other.dstPort)   return false;
  if (srcSwitch == null) {
    if (other.srcSwitch != null && other.dstSwitch != null)     return false;
  }
 else   if (!srcSwitch.equals(other.srcSwitch) && !srcSwitch.equals(other.dstSwitch))   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  IslLinkInfo other=(IslLinkInfo)obj;
  if (dstSwitch.equals(other.srcSwitch) && srcPort == other.dstPort && srcSwitch.equals(other.dstSwitch) && dstPort == other.srcPort) {
    return true;
  }
 else {
    return false;
  }
}
Program: 37751
Project: 37751
Buggy source:
@JsonCreator public DiscoveryFilterEntity(@JsonProperty("String_Node_Str") String switchId,@JsonProperty("String_Node_Str") String portId){
  this.switchId=switchId;
  this.portId=portId;
}

Fixed version (ground truth):
@JsonCreator public DiscoveryFilterEntity(@JsonProperty("String_Node_Str") String switchId,@JsonProperty("String_Node_Str") int portId){
  this.switchId=switchId;
  this.portId=portId;
}
Program: 37752
Project: 37752
Buggy source:
@JsonCreator public OFELinkBoltState(@JsonProperty("String_Node_Str") List<DiscoveryNode> discovery,@JsonProperty("String_Node_Str") Set<?> filtered){
  this.discovery=discovery;
  this.filtered=filtered;
}

Fixed version (ground truth):
@JsonCreator public OFELinkBoltState(@JsonProperty("String_Node_Str") List<DiscoveryLink> discovery,@JsonProperty("String_Node_Str") Set<?> filtered){
  this.discovery=discovery;
  this.filtered=filtered;
}
Program: 37753
Project: 37753
Buggy source:
public static String createIslFail(String switchId,String portId) throws IOException {
  PathNode node=new PathNode(switchId,Integer.parseInt(portId),0,0L);
  InfoData data=new IslInfoData(0L,Collections.singletonList(node),0L,IslChangeType.FAILED,0L);
  InfoMessage message=new InfoMessage(data,System.currentTimeMillis(),UUID.randomUUID().toString());
  return MAPPER.writeValueAsString(message);
}

Fixed version (ground truth):
public static String createIslFail(String switchId,int portId) throws IOException {
  PathNode node=new PathNode(switchId,portId,0,0L);
  InfoData data=new IslInfoData(0L,Collections.singletonList(node),0L,IslChangeType.FAILED,0L);
  InfoMessage message=new InfoMessage(data,System.currentTimeMillis(),UUID.randomUUID().toString());
  return MAPPER.writeValueAsString(message);
}
Program: 37754
Project: 37754
Buggy source:
/** 
 * @return a JSON string that can be used to for link event
 */
public static String createIslDiscovery(String switchID,String portID) throws IOException {
  CommandMessage message=new CommandMessage(new DiscoverIslCommandData(switchID,Integer.valueOf(portID)),System.currentTimeMillis(),"String_Node_Str",Destination.CONTROLLER);
  return MAPPER.writeValueAsString(message);
}

Fixed version (ground truth):
/** 
 * @return a JSON string that can be used to for link event
 */
public static String createIslDiscovery(String switchId,int portId) throws IOException {
  CommandMessage message=new CommandMessage(new DiscoverIslCommandData(switchId,portId),System.currentTimeMillis(),"String_Node_Str",Destination.CONTROLLER);
  return MAPPER.writeValueAsString(message);
}