Program: 25480
Project: 25480
Buggy source:
/** 
 * reloadConfig - reloads the configuration of FSF disconnects/re-connects/and connects to slices as the FSF config specifies this is only called via the web-service
 */
public boolean reloadConfig(){
  ArrayList<HashMap<Long,Slicer>> newSlices;
  ArrayList<Proxy> toBeRemoved=new ArrayList<Proxy>();
  try {
    newSlices=ConfigParser.parseConfig("String_Node_Str");
    for (    HashMap<Long,Slicer> slice : newSlices) {
      for (      Long dpid : slice.keySet()) {
        this.setSlice(dpid,slice.get(dpid).getSliceName(),slice.get(dpid));
      }
    }
    for (    IOFSwitch sw : this.switches) {
      List<Proxy> proxies=controllerConnector.getSwitchProxies(sw.getId());
      if (proxies == null) {
        logger.error("String_Node_Str");
        continue;
      }
      logger.warn("String_Node_Str" + proxies.size());
      for (      Proxy p : proxies) {
        boolean updated=false;
        for (        HashMap<Long,Slicer> slice : newSlices) {
          logger.error("String_Node_Str" + slice.keySet().size());
          if (slice.containsKey(sw.getId()) && slice.get(sw.getId()).getSliceName().equals(p.getSlicer().getSliceName())) {
            p.setSlicer(slice.get(sw.getId()));
            logger.warn("String_Node_Str" + p.getSlicer().getSliceName() + "String_Node_Str");
            updated=true;
            slice.remove(sw.getId());
          }
        }
        if (!updated) {
          logger.warn("String_Node_Str" + p.getSlicer().getSliceName() + "String_Node_Str"+ sw.getStringId()+ "String_Node_Str");
          p.disconnect();
          toBeRemoved.add(p);
        }
      }
    }
    Iterator<HashMap<Long,Slicer>> sliceIt=newSlices.iterator();
    logger.warn("String_Node_Str" + newSlices.size());
    while (sliceIt.hasNext()) {
      HashMap<Long,Slicer> slice=sliceIt.next();
      if (slice.isEmpty()) {
      }
 else {
        for (        Long dpid : slice.keySet()) {
          if (this.switches.contains(dpid)) {
            IOFSwitch sw=floodlightProvider.getSwitch(dpid);
            Slicer vlanSlicer=slice.get(dpid);
            controllerConnector.addProxy(dpid,new Proxy(sw,vlanSlicer,this));
          }
        }
      }
    }
    for (    Proxy p : toBeRemoved) {
      this.removeProxy(p.getSwitch().getId(),p);
      this.removeSlice(p.getSwitch().getId(),p.getSlicer().getSliceName());
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
catch (  SAXException e) {
    e.printStackTrace();
    return false;
  }
catch (  ParserConfigurationException e) {
    logger.error(e.getMessage());
    return false;
  }
catch (  XPathExpressionException e) {
    logger.error(e.getMessage());
    return false;
  }
  logger.error("String_Node_Str" + this.slices.size());
  return true;
}

Fixed version (ground truth):
/** 
 * reloadConfig - reloads the configuration of FSF disconnects/re-connects/and connects to slices as the FSF config specifies this is only called via the web-service
 */
public boolean reloadConfig(){
  ArrayList<HashMap<Long,Slicer>> newSlices;
  ArrayList<Proxy> toBeRemoved=new ArrayList<Proxy>();
  try {
    newSlices=ConfigParser.parseConfig("String_Node_Str");
    Iterator<HashMap<Long,Slicer>> sliceIt=this.slices.iterator();
    while (sliceIt.hasNext()) {
      @SuppressWarnings("String_Node_Str") HashMap<Long,Slicer> tmp=sliceIt.next();
      sliceIt.remove();
    }
    for (    HashMap<Long,Slicer> slice : newSlices) {
      for (      Long dpid : slice.keySet()) {
        this.setSlice(dpid,slice.get(dpid).getSliceName(),slice.get(dpid));
      }
    }
    for (    IOFSwitch sw : this.switches) {
      List<Proxy> proxies=controllerConnector.getSwitchProxies(sw.getId());
      if (proxies == null) {
        logger.error("String_Node_Str");
        continue;
      }
      logger.warn("String_Node_Str" + proxies.size());
      for (      Proxy p : proxies) {
        boolean updated=false;
        for (        HashMap<Long,Slicer> slice : newSlices) {
          logger.error("String_Node_Str" + slice.keySet().size());
          if (slice.containsKey(sw.getId()) && slice.get(sw.getId()).getSliceName().equals(p.getSlicer().getSliceName())) {
            p.setSlicer(slice.get(sw.getId()));
            logger.warn("String_Node_Str" + p.getSlicer().getSliceName() + "String_Node_Str");
            updated=true;
            slice.remove(sw.getId());
          }
        }
        if (!updated) {
          logger.warn("String_Node_Str" + p.getSlicer().getSliceName() + "String_Node_Str"+ sw.getStringId()+ "String_Node_Str");
          p.disconnect();
          toBeRemoved.add(p);
        }
      }
    }
    Iterator<HashMap<Long,Slicer>> sliceIt2=newSlices.iterator();
    logger.warn("String_Node_Str" + newSlices.size());
    while (sliceIt2.hasNext()) {
      HashMap<Long,Slicer> slice=sliceIt2.next();
      if (slice.isEmpty()) {
      }
 else {
        for (        Long dpid : slice.keySet()) {
          if (this.switches.contains(dpid)) {
            IOFSwitch sw=floodlightProvider.getSwitch(dpid);
            Slicer vlanSlicer=slice.get(dpid);
            controllerConnector.addProxy(dpid,new Proxy(sw,vlanSlicer,this));
          }
        }
      }
    }
    for (    Proxy p : toBeRemoved) {
      this.removeProxy(p.getSwitch().getId(),p);
      this.removeSlice(p.getSwitch().getId(),p.getSlicer().getSliceName());
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
catch (  SAXException e) {
    e.printStackTrace();
    return false;
  }
catch (  ParserConfigurationException e) {
    logger.error(e.getMessage());
    return false;
  }
catch (  XPathExpressionException e) {
    logger.error(e.getMessage());
    return false;
  }
  logger.error("String_Node_Str" + this.slices.size());
  return true;
}