nus-yam/ex-repair huggingface dataset:
Program: 154106
Project: 154106
Buggy source:
protected synchronized void train(){
  PlanarImage source=getSourceImage(0);
  if (roi == null)   roi=new ROIShape(source.getBounds());
  int minTileX=source.getMinTileX();
  int maxTileX=source.getMaxTileX();
  int minTileY=source.getMinTileY();
  int maxTileY=source.getMaxTileY();
  int xStart=source.getMinX();
  int yStart=source.getMinY();
  histogram=new HistogramHash(histogramSize);
  while (true) {
    histogram.init();
    int oldbits=bits;
    mask=(255 << 8 - bits) & 255;
    mask=mask | (mask << 8) | (mask << 16);
    for (int y=minTileY; y <= maxTileY; y++) {
      for (int x=minTileX; x <= maxTileX; x++) {
        Rectangle tileRect=source.getTileRect(x,y);
        if (roi.intersects(tileRect)) {
          if (checkForSkippedTiles && tileRect.x >= xStart && tileRect.y >= yStart) {
            int offsetX=(xPeriod - ((tileRect.x - xStart) % xPeriod)) % xPeriod;
            int offsetY=(yPeriod - ((tileRect.y - yStart) % yPeriod)) % yPeriod;
            if (offsetX >= tileRect.width || offsetY >= tileRect.height) {
              continue;
            }
          }
          computeHistogram(source.getData(tileRect));
          if (histogram.isFull())           break;
        }
      }
      if (histogram.isFull())       break;
    }
    if (oldbits == bits) {
      counts=histogram.getCounts();
      colors=histogram.getColors();
      break;
    }
  }
  medianCut(maxColorNum);
  setProperty("String_Node_Str",colorMap);
}

Fixed version (ground truth):
protected synchronized void train(){
  PlanarImage source=getSourceImage(0);
  if (roi == null)   roi=new ROIShape(source.getBounds());
  int minTileX=source.getMinTileX();
  int maxTileX=source.getMaxTileX();
  int minTileY=source.getMinTileY();
  int maxTileY=source.getMaxTileY();
  int xStart=source.getMinX();
  int yStart=source.getMinY();
  histogram=new HistogramHash(histogramSize);
  while (true) {
    histogram.init();
    int oldbits=bits;
    mask=(255 << 8 - bits) & 255;
    mask=mask | (mask << 8) | (mask << 16);
    for (int y=minTileY; y <= maxTileY; y++) {
      for (int x=minTileX; x <= maxTileX; x++) {
        Rectangle tileRect=source.getTileRect(x,y);
        if (roi.intersects(tileRect)) {
          if (checkForSkippedTiles && tileRect.x >= xStart && tileRect.y >= yStart) {
            int offsetX=(xPeriod - ((tileRect.x - xStart) % xPeriod)) % xPeriod;
            int offsetY=(yPeriod - ((tileRect.y - yStart) % yPeriod)) % yPeriod;
            if (offsetX >= tileRect.width || offsetY >= tileRect.height) {
              continue;
            }
          }
          computeHistogram(source.getData(tileRect));
          if (histogram.isFull())           break;
        }
      }
      if (histogram.isFull())       break;
    }
    if (oldbits == bits) {
      counts=histogram.getCounts();
      colors=histogram.getColors();
      break;
    }
  }
  medianCut(maxColorNum);
  setProperty("String_Node_Str",colorMap);
  setProperty("String_Node_Str",colorMap);
}
Program: 154108
Project: 154108
Buggy source:
protected synchronized void train(){
  Cube cube=new Cube(getSourceImage(0),maxColorNum);
  cube.constructTree();
  cube.reduction();
  cube.assignment();
  colorMap=new LookupTableJAI(cube.colormap);
  setProperty("String_Node_Str",colorMap);
}

Fixed version (ground truth):
protected synchronized void train(){
  Cube cube=new Cube(getSourceImage(0),maxColorNum);
  cube.constructTree();
  cube.reduction();
  cube.assignment();
  colorMap=new LookupTableJAI(cube.colormap);
  setProperty("String_Node_Str",colorMap);
  setProperty("String_Node_Str",colorMap);
}
Program: 154109
Project: 154109
Buggy source:
public double getX();

Fixed version (ground truth):
public int getX();
Program: 154110
Project: 154110
Buggy source:
public void setY(double y);

Fixed version (ground truth):
public void setY(int y);
Program: 154111
Project: 154111
Buggy source:
public double getY();

Fixed version (ground truth):
public int getY();
Program: 154112
Project: 154112
Buggy source:
public void setX(double x);

Fixed version (ground truth):
public void setX(int x);
Program: 154113
Project: 154113
Buggy source:
/** 
 * Set the value of y
 * @param y new value of y
 */
@Override public void setY(double y){
  double oldY=this.y;
  this.y=y;
  this.firePropertyChange(PROP_Y,oldY,y);
}

Fixed version (ground truth):
/** 
 * Set the value of y
 * @param y new value of y
 */
@Override public void setY(int y){
  double oldY=this.y;
  this.y=y;
  this.firePropertyChange(PROP_Y,oldY,y);
}
Program: 154114
Project: 154114
Buggy source:
/** 
 * Get the value of x
 * @return the value of x
 */
@Override public double getX(){
  return x;
}

Fixed version (ground truth):
/** 
 * Get the value of x
 * @return the value of x
 */
@Override public int getX(){
  return x;
}
Program: 154115
Project: 154115
Buggy source:
/** 
 * Get the value of y
 * @return the value of y
 */
@Override public double getY(){
  return y;
}

Fixed version (ground truth):
/** 
 * Get the value of y
 * @return the value of y
 */
@Override public int getY(){
  return y;
}
Program: 154116
Project: 154116
Buggy source:
/** 
 * Set the value of x
 */
@Override public void setX(double x){
  double oldX=this.x;
  this.x=x;
  this.firePropertyChange(PROP_X,oldX,x);
}

Fixed version (ground truth):
/** 
 * Set the value of x
 */
@Override public void setX(int x){
  double oldX=this.x;
  this.x=x;
  this.firePropertyChange(PROP_X,oldX,x);
}
Program: 154117
Project: 154117
Buggy source:
private void addGraphElementsFromTransferable(Transferable transferable,Point point){
  Node[] nodes=NodeTransfer.nodes(transferable,NodeTransfer.DND_COPY_OR_MOVE);
  for (  Node node : nodes) {
    GraphElementType type=node.getLookup().lookup(GraphElementType.class);
    GraphElementFactory factory=Lookup.getDefault().lookup(GraphElementFactory.class);
    GraphElement elem=factory.createGraphElement(type);
    elem.setX(point.getX());
    elem.setY(point.getY());
    version.add(elem);
  }
}

Fixed version (ground truth):
private void addGraphElementsFromTransferable(Transferable transferable,Point point){
  Node[] nodes=NodeTransfer.nodes(transferable,NodeTransfer.DND_COPY_OR_MOVE);
  for (  Node node : nodes) {
    GraphElementType type=node.getLookup().lookup(GraphElementType.class);
    GraphElementFactory factory=Lookup.getDefault().lookup(GraphElementFactory.class);
    GraphElement elem=factory.createGraphElement(type);
    elem.setX(point.x);
    elem.setY(point.y);
    version.add(elem);
  }
}
Program: 154118
Project: 154118
Buggy source:
public void setVersion(CowGraphVersion version){
  this.version=version;
  this.version.addPropertyChangeListener(this);
}

Fixed version (ground truth):
public void setVersion(CowGraphVersion version){
  unsubscribeFromVersionChanges();
  this.version=version;
  subscribeToVersionChanges();
}
Program: 154119
Project: 154119
Buggy source:
@Override protected Widget attachNodeWidget(GraphElement node){
  Widget widget=GraphElementWidgetFactory.createWidget(this,node);
  mainLayer.addChild(widget);
  return widget;
}

Fixed version (ground truth):
@Override protected Widget attachNodeWidget(GraphElement node){
  Widget widget=WidgetFactory.createWidget(this,node);
  mainLayer.addChild(widget);
  return widget;
}
Program: 154120
Project: 154120
Buggy source:
public CircleWidget(Scene scene,Circle element){
  super(scene);
  this.element=element;
  setBorder(BorderFactory.createEmptyBorder());
  getActions().addAction(ActionFactory.createResizeAction(new CircleResizeStrategy(),null));
  getActions().addAction(ActionFactory.createMoveAction());
  getActions().addAction(ActionFactory.createSelectAction(new SelectProvider(){
    @Override public boolean isAimingAllowed(    Widget widget,    Point localLocation,    boolean invertSelection){
      return true;
    }
    @Override public boolean isSelectionAllowed(    Widget widget,    Point localLocation,    boolean invertSelection){
      return true;
    }
    @Override public void select(    Widget widget,    Point localLocation,    boolean invertSelection){
      if (invertSelection) {
        setBorder(BorderFactory.createEmptyBorder());
      }
 else {
        setBorder(BorderFactory.createLineBorder(2));
      }
    }
  }
));
  WidgetAction hoverAction=ActionFactory.createHoverAction(new TwoStateHoverProvider(){
    @Override public void unsetHovering(    Widget widget){
      setBorder(BorderFactory.createEmptyBorder());
    }
    @Override public void setHovering(    Widget widget){
      setBorder(BorderFactory.createResizeBorder(BOUNDS_INSET - 1,Color.BLACK,false));
    }
  }
);
  getActions().addAction(hoverAction);
  getScene().getActions().addAction(hoverAction);
  dependency=new GraphElementWidgetDependency(this,element);
  dependency.updateWidget();
  addDependency(dependency);
}

Fixed version (ground truth):
public CircleWidget(Scene scene,Circle element){
  super(scene);
  this.element=element;
  setBorder(BorderFactory.createEmptyBorder());
  getActions().addAction(ActionFactory.createResizeAction(new CircleResizeStrategy(),null));
  getActions().addAction(ActionFactory.createMoveAction());
  getActions().addAction(ActionFactory.createSelectAction(new SelectProvider(){
    @Override public boolean isAimingAllowed(    Widget widget,    Point localLocation,    boolean invertSelection){
      return true;
    }
    @Override public boolean isSelectionAllowed(    Widget widget,    Point localLocation,    boolean invertSelection){
      return true;
    }
    @Override public void select(    Widget widget,    Point localLocation,    boolean invertSelection){
      if (invertSelection) {
        setBorder(BorderFactory.createEmptyBorder());
      }
 else {
        setBorder(BorderFactory.createLineBorder(2));
      }
    }
  }
));
  WidgetAction hoverAction=ActionFactory.createHoverAction(new TwoStateHoverProvider(){
    @Override public void unsetHovering(    Widget widget){
      setBorder(BorderFactory.createEmptyBorder());
    }
    @Override public void setHovering(    Widget widget){
      setBorder(BorderFactory.createResizeBorder(BOUNDS_INSET - 1,Color.BLACK,false));
    }
  }
);
  getActions().addAction(hoverAction);
  getScene().getActions().addAction(hoverAction);
  dependency=new CircleDependency(this,element);
  dependency.updateWidget();
  addDependency(dependency);
}
Program: 154121
Project: 154121
Buggy source:
public Rectangle boundsSuggested(final Widget widget,final Rectangle originalBounds,final Rectangle suggestedBounds,final ResizeProvider.ControlPoint controlPoint){
  final Rectangle result=new Rectangle(suggestedBounds);
  final double deltaW=Math.abs(suggestedBounds.getWidth() - originalBounds.getWidth());
  final double deltaH=Math.abs(suggestedBounds.getHeight() - originalBounds.getHeight());
  if (deltaW >= deltaH) {
    result.height=result.width;
  }
 else {
    result.width=result.height;
  }
  result.x=0;
  result.y=0;
  return result;
}

Fixed version (ground truth):
@Override public Rectangle boundsSuggested(final Widget widget,final Rectangle originalBounds,final Rectangle suggestedBounds,final ResizeProvider.ControlPoint controlPoint){
  final Rectangle result=new Rectangle(suggestedBounds);
  final double deltaW=Math.abs(suggestedBounds.getWidth() - originalBounds.getWidth());
  final double deltaH=Math.abs(suggestedBounds.getHeight() - originalBounds.getHeight());
  if (deltaW >= deltaH) {
    result.height=result.width;
  }
 else {
    result.width=result.height;
  }
  result.x=0;
  result.y=0;
  return result;
}
Program: 154122
Project: 154122
Buggy source:
public boolean add(CowGraphVersion version){
  firePropertyChange(PROP_VERSIONS,null,version);
  return versions.add(version);
}

Fixed version (ground truth):
public boolean add(CowGraphVersion version){
  boolean added=versions.add(version);
  firePropertyChange(PROP_VERSIONS,null,version);
  return added;
}
Program: 154123
Project: 154123
Buggy source:
public boolean remove(CowGraphVersion version){
  firePropertyChange(PROP_VERSIONS,version,null);
  return versions.remove(version);
}

Fixed version (ground truth):
public boolean remove(CowGraphVersion version){
  boolean removed=versions.remove(version);
  firePropertyChange(PROP_VERSIONS,version,null);
  return removed;
}
Program: 154124
Project: 154124
Buggy source:
@Override protected void notifyAdded(){
  super.notifyAdded();
  subscribeToVersionChanges();
}

Fixed version (ground truth):
@Override protected void notifyAdded(){
  active=true;
  super.notifyAdded();
  subscribeToVersionChanges();
}
Program: 154125
Project: 154125
Buggy source:
@Override protected void notifyRemoved(){
  super.notifyRemoved();
  unsubscribeFromVersionChanges();
}

Fixed version (ground truth):
@Override protected void notifyRemoved(){
  active=false;
  super.notifyRemoved();
  unsubscribeFromVersionChanges();
}
Program: 154126
Project: 154126
Buggy source:
/** 
 * Has to be called before scene gets visible!!!
 */
public void setVersion(CowGraphVersion version){
  unsubscribeFromVersionChanges();
  this.version=version;
  if (isVisible()) {
    subscribeToVersionChanges();
  }
}

Fixed version (ground truth):
/** 
 * Has to be called before scene gets visible!!!
 */
public void setVersion(CowGraphVersion version){
  unsubscribeFromVersionChanges();
  this.version=version;
  if (active) {
    subscribeToVersionChanges();
  }
}
Program: 154127
Project: 154127
Buggy source:
public GraphElement remove(int index){
  GraphElement elem=elements.remove(index);
  firePropertyElementAdded(Property.ELEMENTS_REMOVED.name(),elem);
  return elem;
}

Fixed version (ground truth):
public GraphElement remove(int index){
  GraphElement elem=elements.remove(index);
  firePropertyElementRemoved(Property.ELEMENTS_REMOVED.name(),elem);
  return elem;
}
Program: 154128
Project: 154128
Buggy source:
/** 
 * Return a proper URL with lowercase scheme, lowercase domain, stripped hash - used to compare against other previously seen URLs
 * @param href A relative or absolute URL
 * @param context Null or an absolute URL to use when href is relative
 * @return
 */
public static URL getCanonicalURL(String href,String context){
  try {
    URI normalized;
    if (context != null) {
      normalized=new URI(context);
      if (normalized.getPath().equals("String_Node_Str"))       context+="String_Node_Str";
      normalized=new URI(context).resolve(href);
    }
 else {
      normalized=new URI(href);
    }
    normalized=normalized.normalize();
    return new URI(normalized.getScheme().toLowerCase(),normalized.getUserInfo(),normalized.getHost(),normalized.getPort(),normalized.getPath(),normalized.getQuery(),null).toURL();
  }
 catch (  URISyntaxException e) {
    LogFactory.getLog(URLCanonicalizer.class).error("String_Node_Str" + href + "String_Node_Str"+ context,e);
    return null;
  }
catch (  MalformedURLException e) {
    LogFactory.getLog(URLCanonicalizer.class).error("String_Node_Str" + href + "String_Node_Str"+ context,e);
    return null;
  }
catch (  IllegalArgumentException e) {
    LogFactory.getLog(URLCanonicalizer.class).error("String_Node_Str" + href + "String_Node_Str"+ context,e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Return a proper URL with lowercase scheme, lowercase domain, stripped hash - used to compare against other previously seen URLs
 * @param href A relative or absolute URL
 * @param context Null or an absolute URL to use when href is relative
 * @return
 */
public static URL getCanonicalURL(String href,String context){
  try {
    URI normalized;
    if (context != null) {
      normalized=new URI(context);
      if (normalized.getPath().equals("String_Node_Str"))       context+="String_Node_Str";
      normalized=new URI(context).resolve(href);
    }
 else {
      normalized=new URI(href);
    }
    normalized=normalized.normalize();
    return new URI(normalized.getScheme().toLowerCase(),normalized.getUserInfo(),normalized.getHost(),normalized.getPort(),normalized.getPath().equals("String_Node_Str") ? "String_Node_Str" : normalized.getPath(),normalized.getQuery(),null).toURL();
  }
 catch (  URISyntaxException e) {
    LogFactory.getLog(URLCanonicalizer.class).error("String_Node_Str" + href + "String_Node_Str"+ context,e);
    return null;
  }
catch (  MalformedURLException e) {
    LogFactory.getLog(URLCanonicalizer.class).error("String_Node_Str" + href + "String_Node_Str"+ context,e);
    return null;
  }
catch (  IllegalArgumentException e) {
    LogFactory.getLog(URLCanonicalizer.class).error("String_Node_Str" + href + "String_Node_Str"+ context,e);
    return null;
  }
}
Program: 154129
Project: 154129
Buggy source:
public HTMLParser(ICrawlerSettings config){
  bulletParser=new BulletParser();
  textExtractor=new TextExtractor();
  linkExtractor=new HTMLLinkExtractor();
  maxOutLinks=config.getMaxOutlinks();
  linkExtractor.setIncludeImagesSources(config.getIncludeImages());
}

Fixed version (ground truth):
public HTMLParser(ICrawlerSettings config){
  this.config=config;
  maxOutLinks=config.getMaxOutlinks();
}
Program: 154130
Project: 154130
Buggy source:
@Override public void parse(Page page){
  urls=new HashMap<>();
  String htmlContent=page.getHTML();
  String contextURL=page.getWebURL().getURL();
  char[] chars=htmlContent.toCharArray();
  bulletParser.setCallback(textExtractor);
  bulletParser.parse(chars);
  page.setText(textExtractor.text.toString().trim());
  page.setTitle(textExtractor.title.toString().trim());
  bulletParser.setCallback(linkExtractor);
  bulletParser.parse(chars);
  String href;
  String baseURL=linkExtractor.base();
  if (baseURL != null) {
    contextURL=baseURL;
  }
  int urlCount=0;
  if (linkExtractor.metaRefresh() != null) {
    href=parseLink(linkExtractor.metaRefresh(),contextURL);
    if (href != null) {
      urls.put(href,null);
      urlCount++;
    }
  }
  for (  Map.Entry<String,String> link : linkExtractor.urls.entrySet()) {
    href=parseLink(link.getKey(),contextURL);
    if (href != null) {
      urls.put(href,link.getValue());
      if (++urlCount > maxOutLinks) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void parse(Page page){
  final BulletParser bulletParser=new BulletParser();
  final TextExtractor textExtractor=new TextExtractor();
  final HTMLLinkExtractor linkExtractor=new HTMLLinkExtractor();
  linkExtractor.setIncludeImagesSources(config.getIncludeImages());
  urls=new HashMap<>();
  String htmlContent=page.getHTML();
  String contextURL=page.getWebURL().getURL();
  char[] chars=htmlContent.toCharArray();
  bulletParser.setCallback(textExtractor);
  bulletParser.parse(chars);
  page.setText(textExtractor.text.toString().trim());
  page.setTitle(textExtractor.title.toString().trim());
  bulletParser.setCallback(linkExtractor);
  bulletParser.parse(chars);
  String href;
  String baseURL=linkExtractor.base();
  if (baseURL != null) {
    contextURL=baseURL;
  }
  int urlCount=0;
  if (linkExtractor.metaRefresh() != null) {
    href=parseLink(linkExtractor.metaRefresh(),contextURL);
    if (href != null) {
      urls.put(href,null);
      urlCount++;
    }
  }
  for (  Map.Entry<String,String> link : linkExtractor.urls.entrySet()) {
    href=parseLink(link.getKey(),contextURL);
    if (href != null) {
      urls.put(href,link.getValue());
      if (++urlCount > maxOutLinks) {
        break;
      }
    }
  }
}
Program: 154131
Project: 154131
Buggy source:
public void parse(String htmlContent,String contextURL){
  urls=new HashSet<String>();
  char[] chars=htmlContent.toCharArray();
  bulletParser.setCallback(textExtractor);
  bulletParser.parse(chars);
  text=textExtractor.text.toString().trim();
  title=textExtractor.title.toString().trim();
  bulletParser.setCallback(linkExtractor);
  bulletParser.parse(chars);
  Iterator<String> it=linkExtractor.urls.iterator();
  int urlCount=0;
  while (it.hasNext()) {
    String href=it.next();
    href=href.trim();
    if (href.length() == 0) {
      continue;
    }
    String hrefWithoutProtocol=href.toLowerCase();
    if (href.startsWith("String_Node_Str")) {
      hrefWithoutProtocol=href.substring(7);
    }
    if (hrefWithoutProtocol.indexOf("String_Node_Str") < 0 && hrefWithoutProtocol.indexOf("String_Node_Str") < 0) {
      URL url=URLCanonicalizer.getCanonicalURL(href,contextURL);
      if (url != null) {
        urls.add(url.toExternalForm());
        urlCount++;
        if (urlCount > MAX_OUT_LINKS) {
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
public void parse(String htmlContent,String contextURL){
  urls=new HashSet<String>();
  char[] chars=htmlContent.toCharArray();
  bulletParser.setCallback(textExtractor);
  bulletParser.parse(chars);
  text=textExtractor.text.toString().trim();
  title=textExtractor.title.toString().trim();
  bulletParser.setCallback(linkExtractor);
  bulletParser.parse(chars);
  Iterator<String> it=linkExtractor.urls.iterator();
  String baseURL=linkExtractor.base();
  if (baseURL != null) {
    contextURL=baseURL;
  }
  int urlCount=0;
  while (it.hasNext()) {
    String href=it.next();
    href=href.trim();
    if (href.length() == 0) {
      continue;
    }
    String hrefWithoutProtocol=href.toLowerCase();
    if (href.startsWith("String_Node_Str")) {
      hrefWithoutProtocol=href.substring(7);
    }
    if (hrefWithoutProtocol.indexOf("String_Node_Str") < 0 && hrefWithoutProtocol.indexOf("String_Node_Str") < 0) {
      URL url=URLCanonicalizer.getCanonicalURL(href,contextURL);
      if (url != null) {
        urls.add(url.toExternalForm());
        urlCount++;
        if (urlCount > MAX_OUT_LINKS) {
          break;
        }
      }
    }
  }
}
Program: 154134
Project: 154134
Buggy source:
public static void main(String[] args) throws Exception {
  if (args.length < 2) {
    System.out.println("String_Node_Str");
    return;
  }
  String rootFolder=args[0];
  int numberOfCrawlers=Integer.parseInt(args[1]);
  CrawlController controller=new CrawlController(rootFolder);
  controller.addSeed("String_Node_Str");
  controller.setPolitenessDelay(200);
  controller.setMaximumCrawlDepth(1);
  controller.start(MyCrawler.class,numberOfCrawlers);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length < 2) {
    System.out.println("String_Node_Str");
    return;
  }
  String rootFolder=args[0];
  int numberOfCrawlers=Integer.parseInt(args[1]);
  CrawlController controller=new CrawlController(rootFolder);
  controller.addSeed("String_Node_Str");
  controller.setPolitenessDelay(200);
  controller.setMaximumCrawlDepth(3);
  controller.start(MyCrawler.class,numberOfCrawlers);
}
Program: 154135
Project: 154135
Buggy source:
public void parse(String htmlContent,String contextURL){
  urls=new HashSet<String>();
  char[] chars=htmlContent.toCharArray();
  bulletParser.setCallback(textExtractor);
  bulletParser.parse(chars);
  text=textExtractor.text.toString().trim();
  title=textExtractor.title.toString().trim();
  bulletParser.setCallback(linkExtractor);
  bulletParser.parse(chars);
  Iterator<String> it=linkExtractor.urls.iterator();
  int urlCount=0;
  while (it.hasNext()) {
    String href=it.next();
    href=href.trim();
    if (href.length() == 0) {
      continue;
    }
    String hrefWithoutProtocol=href;
    if (href.startsWith("String_Node_Str")) {
      hrefWithoutProtocol=href.substring(7);
    }
    if (hrefWithoutProtocol.indexOf("String_Node_Str") < 0 && hrefWithoutProtocol.indexOf("String_Node_Str") < 0) {
      urls.add(URLCanonicalizer.getCanonicalURL(href,contextURL).toExternalForm());
      urlCount++;
      if (urlCount > MAX_OUT_LINKS) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
public void parse(String htmlContent,String contextURL){
  urls=new HashSet<String>();
  char[] chars=htmlContent.toCharArray();
  bulletParser.setCallback(textExtractor);
  bulletParser.parse(chars);
  text=textExtractor.text.toString().trim();
  title=textExtractor.title.toString().trim();
  bulletParser.setCallback(linkExtractor);
  bulletParser.parse(chars);
  Iterator<String> it=linkExtractor.urls.iterator();
  int urlCount=0;
  while (it.hasNext()) {
    String href=it.next();
    href=href.trim();
    if (href.length() == 0) {
      continue;
    }
    String hrefWithoutProtocol=href.toLowerCase();
    if (href.startsWith("String_Node_Str")) {
      hrefWithoutProtocol=href.substring(7);
    }
    if (hrefWithoutProtocol.indexOf("String_Node_Str") < 0 && hrefWithoutProtocol.indexOf("String_Node_Str") < 0) {
      URL url=URLCanonicalizer.getCanonicalURL(href,contextURL);
      if (url != null) {
        urls.add(url.toExternalForm());
        urlCount++;
        if (urlCount > MAX_OUT_LINKS) {
          break;
        }
      }
    }
  }
}
Program: 154138
Project: 154138
Buggy source:
private void processFamilyColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    final String familyName=stripDagger(it.getName(KnownField.FAMILY));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.FAMILY));
    if (familyName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(familyName)) {
      if (familyName != null) {
        logger.info("String_Node_Str" + familyName);
        if (target.getTermbyName(familyName) == null) {
          final Term familyTerm=target.addTerm(familyName);
          target.setRankFromName(familyTerm,KnownField.FAMILY.getCannonicalName());
          if (it.hasColumn(KnownField.ORDER) && target.getTermbyName(it.getName(KnownField.ORDER)) != null) {
            final String parentName=it.getName(KnownField.ORDER);
            target.attachParent(familyTerm,target.getTermbyName(parentName));
          }
 else           if (attachTerm != null)           target.attachParent(familyTerm,attachTerm);
          if (isExtinct) {
            target.setExtinct(familyTerm);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void processFamilyColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    final String familyName=stripDagger(it.getName(KnownField.FAMILY));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.FAMILY));
    if (familyName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(familyName)) {
      if (familyName != null) {
        if (target.getTermbyName(familyName) == null) {
          final Term familyTerm=target.addTerm(familyName);
          logger.info("String_Node_Str" + familyName + "String_Node_Str"+ familyTerm.getID());
          target.setRankFromName(familyTerm,KnownField.FAMILY.getCannonicalName());
          if (it.hasColumn(KnownField.ORDER) && target.getTermbyName(it.getName(KnownField.ORDER)) != null) {
            final String parentName=it.getName(KnownField.ORDER);
            target.attachParent(familyTerm,target.getTermbyName(parentName));
          }
 else           if (attachTerm != null)           target.attachParent(familyTerm,attachTerm);
          if (isExtinct) {
            target.setExtinct(familyTerm);
          }
        }
      }
    }
  }
}
Program: 154139
Project: 154139
Buggy source:
@Override public void attach(String attachment,String cladeRoot,String prefix){
  ItemList items=reader.processCatalog(source,true);
  Term attachTerm=null;
  if (!"String_Node_Str".equals(attachment)) {
    attachTerm=target.getTermbyName(attachment);
    if (attachTerm == null) {
      if (!target.isEmpty()) {
        System.err.println("String_Node_Str" + source.getAbsolutePath() + "String_Node_Str"+ attachment+ "String_Node_Str"+ target);
        return;
      }
 else {
        attachTerm=target.addTerm(attachment);
        logger.info("String_Node_Str" + attachment + "String_Node_Str");
      }
    }
  }
  if (items.hasColumn(KnownField.CLASS)) {
    processClassColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.ORDER)) {
    processOrderColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.FAMILY)) {
    processFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SUBFAMILY)) {
    processSubFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.GENUS)) {
    processGenusColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SPECIES)) {
    processSpeciesColumn(items,attachTerm);
  }
}

Fixed version (ground truth):
@Override public void attach(String attachment,String cladeRoot,String prefix){
  ItemList items=reader.processCatalog(source,true);
  Term attachTerm=null;
  if (!"String_Node_Str".equals(attachment)) {
    attachTerm=target.getTermbyName(attachment);
    if (attachTerm == null) {
      if (!target.isEmpty()) {
        System.err.println("String_Node_Str" + source.getAbsolutePath() + "String_Node_Str"+ attachment+ "String_Node_Str"+ target);
        return;
      }
 else {
        attachTerm=target.addTerm(attachment);
        logger.info("String_Node_Str" + attachment + "String_Node_Str");
      }
    }
  }
  if (items.hasColumn(KnownField.CLASS)) {
    processClassColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.ORDER)) {
    processOrderColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.FAMILY)) {
    processFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SUBFAMILY)) {
    processSubFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.GENUS)) {
    processGenusColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SPECIES)) {
    processSpeciesColumn(items,attachTerm);
  }
  logger.info("String_Node_Str" + target.getTermbyName("String_Node_Str").getID());
}
Program: 154140
Project: 154140
Buggy source:
private Term copyTerm(OBOClass sourceClass,String prefix){
  Term targetTerm=null;
  String[] idFields=sourceClass.getID().split("String_Node_Str");
  if (idFields.length == 2) {
    if (idFields[0].equals(prefix)) {
      targetTerm=target.addTermbyID(sourceClass.getID(),sourceClass.getName());
      if (sourceClass.getDbxrefs() != null) {
        for (        Dbxref d : sourceClass.getDbxrefs()) {
          target.addXRefToTerm(targetTerm,d.getDatabase(),d.getDatabaseID());
        }
      }
      if (sourceClass.getSynonyms() != null) {
        for (        Synonym s : sourceClass.getSynonyms()) {
          SynonymI newSyn=null;
          if (s.getXrefs() != null && !s.getXrefs().isEmpty()) {
            Iterator<Dbxref> xIter=s.getXrefs().iterator();
            if (xIter.hasNext()) {
              Dbxref d=xIter.next();
              newSyn=target.makeSynonymWithXref(s.getText(),d.getDatabase(),d.getDatabaseID());
            }
          }
 else {
            newSyn=target.makeSynonym(s.getText());
          }
          if (newSyn != null)           targetTerm.addSynonym(newSyn);
        }
      }
      if (sourceUtils.isExtinct(sourceClass))       sourceUtils.setExtinct(targetTerm.asOBOClass());
    }
 else {
      targetTerm=target.addTerm(sourceClass.getName());
      target.addXRefToTerm(targetTerm,idFields[0],idFields[1]);
    }
  }
 else {
    logger.warn("String_Node_Str" + sourceClass.getID() + "String_Node_Str");
  }
  return targetTerm;
}

Fixed version (ground truth):
private Term copyTerm(OBOClass sourceClass,String prefix){
  Term targetTerm=null;
  if (preserveID) {
    targetTerm=target.addTermbyID(sourceClass.getID(),sourceClass.getName());
  }
 else {
    String[] idFields=sourceClass.getID().split("String_Node_Str");
    if (idFields.length == 2) {
      targetTerm=target.addTerm(sourceClass.getName());
      target.addXRefToTerm(targetTerm,idFields[0],idFields[1]);
    }
 else {
      logger.warn("String_Node_Str" + sourceClass.getID() + "String_Node_Str");
      targetTerm=target.addTerm(sourceClass.getName());
    }
  }
  if (sourceClass.getDbxrefs() != null) {
    for (    Dbxref d : sourceClass.getDbxrefs()) {
      target.addXRefToTerm(targetTerm,d.getDatabase(),d.getDatabaseID());
    }
  }
  if (sourceClass.getSynonyms() != null) {
    for (    Synonym s : sourceClass.getSynonyms()) {
      SynonymI newSyn=null;
      if (s.getXrefs() != null && !s.getXrefs().isEmpty()) {
        Iterator<Dbxref> xIter=s.getXrefs().iterator();
        if (xIter.hasNext()) {
          Dbxref d=xIter.next();
          newSyn=target.makeSynonymWithXref(s.getText(),d.getDatabase(),d.getDatabaseID());
        }
      }
 else {
        newSyn=target.makeSynonym(s.getText());
      }
      if (newSyn != null)       targetTerm.addSynonym(newSyn);
    }
  }
  if (sourceUtils.isExtinct(sourceClass))   sourceUtils.setExtinct(targetTerm.asOBOClass());
  return targetTerm;
}
Program: 154141
Project: 154141
Buggy source:
private void addChildren(OBOClass sourceParent,Term targetParent,TaxonStore target,String prefix){
  final Collection<Link> childLinks=sourceParent.getChildren();
  for (  Link l : childLinks) {
    OBOProperty lType=l.getType();
    if (OBOUtils.ISA_PROPERTY.equals(lType.getID())) {
      OBOClass childClass=(OBOClass)l.getChild();
      Term childTerm=copyTerm(childClass,prefix);
      if (sourceUtils.getRankString(childClass) != null)       target.setRankFromName(childTerm,sourceUtils.getRankString(childClass));
      for (      Synonym syn : childClass.getSynonyms()) {
        String synText=syn.getText();
        Collection<Dbxref> xrefs=syn.getXrefs();
        if (xrefs != null && !xrefs.isEmpty()) {
          for (          Dbxref xref : xrefs) {
            SynonymI newSyn=target.makeSynonymWithXref(synText,xref.getDatabase(),xref.getDatabaseID());
            childTerm.addSynonym(newSyn);
          }
        }
 else {
          SynonymI newSyn=target.makeSynonym(synText);
          childTerm.addSynonym(newSyn);
        }
      }
      target.attachParent(childTerm,targetParent);
      addChildren(childClass,childTerm,target,prefix);
    }
  }
}

Fixed version (ground truth):
private void addChildren(OBOClass sourceParent,Term targetParent,TaxonStore target,String prefix){
  final Collection<Link> childLinks=sourceParent.getChildren();
  for (  Link l : childLinks) {
    OBOProperty lType=l.getType();
    if (OBOUtils.ISA_PROPERTY.equals(lType.getID())) {
      OBOClass childClass=(OBOClass)l.getChild();
      Term childTerm=copyTerm(childClass,prefix);
      if ("String_Node_Str".equals(childTerm.asOBOClass().getName())) {
        System.out.println("String_Node_Str" + target.getTermbyName("String_Node_Str"));
        System.out.println("String_Node_Str" + target.getTermbyName("String_Node_Str"));
      }
      if (sourceUtils.getRankString(childClass) != null)       target.setRankFromName(childTerm,sourceUtils.getRankString(childClass));
      for (      Synonym syn : childClass.getSynonyms()) {
        String synText=syn.getText();
        Collection<Dbxref> xrefs=syn.getXrefs();
        if (xrefs != null && !xrefs.isEmpty()) {
          for (          Dbxref xref : xrefs) {
            SynonymI newSyn=target.makeSynonymWithXref(synText,xref.getDatabase(),xref.getDatabaseID());
            childTerm.addSynonym(newSyn);
          }
        }
 else {
          SynonymI newSyn=target.makeSynonym(synText);
          childTerm.addSynonym(newSyn);
        }
      }
      target.attachParent(childTerm,targetParent);
      addChildren(childClass,childTerm,target,prefix);
    }
  }
}
Program: 154143
Project: 154143
Buggy source:
public OBOClass lookupTermByName(String termName){
  if (dirtyTermSets) {
    terms=TermUtil.getTerms(theSession);
    termNames=getAllTermNamesHash(terms);
    termIDs=getAllTermIDsHash(terms);
    dirtyTermSets=false;
  }
  if (termName == null) {
    throw new RuntimeException("String_Node_Str");
  }
  return termNames.get(termName);
}

Fixed version (ground truth):
public OBOClass lookupTermByName(String termName){
  if (dirtyTermSets) {
    terms=TermUtil.getTerms(theSession);
    termNames=getAllTermNamesHash(terms);
    termIDs=getAllTermIDsHash(terms);
    dirtyTermSets=false;
  }
  if (termName == null) {
    throw new RuntimeException("String_Node_Str");
  }
  OBOClass result;
  result=termNames.get(termName);
  if (result == null)   logger.info("String_Node_Str");
  for (  IdentifiedObject io : theSession.getLinkDatabase().getObjects()) {
    if (io.getName().equals(termName)) {
      logger.info("String_Node_Str" + termName + "String_Node_Str"+ io);
      logger.info("String_Node_Str" + io.getType() + "String_Node_Str"+ ((ObsoletableObject)io).isObsolete());
      termNames.put(termName,((OBOClass)io));
      logger.info("String_Node_Str" + termNames.get(termName));
      return ((OBOClass)io);
    }
  }
  logger.info("String_Node_Str");
  return termNames.get(termName);
}
Program: 154144
Project: 154144
Buggy source:
protected void removeNode(OBOClass target){
  theSession.removeObject(target);
}

Fixed version (ground truth):
protected void removeNode(OBOClass target){
  theSession.removeObject(target);
  dirtyTermSets=true;
}
Program: 154145
Project: 154145
Buggy source:
@Override public void setPreserveID(boolean v){
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
@Override public void setPreserveID(boolean v){
  if (v)   throw new RuntimeException("String_Node_Str");
}
Program: 154146
Project: 154146
Buggy source:
private void processSpeciesColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    if (it.getName(KnownField.SPECIES) != null) {
      if (it.hasColumn(KnownField.GENUS) && target.getTermbyName(it.getName(KnownField.GENUS)) != null) {
        final String parentName=stripDagger(it.getName(KnownField.GENUS));
        final boolean isExtinct=daggerPrefix(it.getName(KnownField.SPECIES));
        final String childName=stripDagger(it.getName(KnownField.SPECIES));
        final String speciesName=parentName + "String_Node_Str" + childName;
        Term speciesTerm;
        if (target.getTermbyName(speciesName) == null) {
          speciesTerm=target.addTerm(speciesName);
          target.setRankFromName(speciesTerm,KnownField.SPECIES.getCannonicalName());
          target.attachParent(speciesTerm,target.getTermbyName(parentName));
        }
 else {
          speciesTerm=target.getTermbyName(speciesName);
        }
        if (isExtinct) {
          target.setExtinct(speciesTerm);
        }
        if (items.hasColumn(KnownField.XREF)) {
        }
        addSpeciesSynonyms(it,speciesTerm);
      }
    }
  }
}

Fixed version (ground truth):
private void processSpeciesColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    if (it.getName(KnownField.SPECIES) != null) {
      if (it.hasColumn(KnownField.GENUS) && target.getTermbyName(stripDagger(it.getName(KnownField.GENUS))) != null) {
        final String parentName=stripDagger(it.getName(KnownField.GENUS));
        final boolean isExtinct=daggerPrefix(it.getName(KnownField.SPECIES));
        final String childName=stripDagger(it.getName(KnownField.SPECIES));
        final String speciesName=parentName + "String_Node_Str" + childName;
        Term speciesTerm;
        if (target.getTermbyName(speciesName) == null) {
          speciesTerm=target.addTerm(speciesName);
          target.setRankFromName(speciesTerm,KnownField.SPECIES.getCannonicalName());
          target.attachParent(speciesTerm,target.getTermbyName(parentName));
        }
 else {
          speciesTerm=target.getTermbyName(speciesName);
        }
        if (isExtinct) {
          target.setExtinct(speciesTerm);
        }
        if (items.hasColumn(KnownField.XREF)) {
        }
        addSpeciesSynonyms(it,speciesTerm);
      }
    }
  }
}
Program: 154147
Project: 154147
Buggy source:
private void processSubFamilyColumn(ItemList items,Term attachTerm){
  for (  Item it : items.getContents()) {
    final String subFamilyName=stripDagger(it.getName(KnownField.SUBFAMILY));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.SUBFAMILY));
    if (subFamilyName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(subFamilyName)) {
      if (target.getTermbyName(subFamilyName) == null) {
        final Term subFamilyTerm=target.addTerm(subFamilyName);
        target.setRankFromName(subFamilyTerm,KnownField.SUBFAMILY.getCannonicalName());
        if (it.hasColumn(KnownField.FAMILY) && target.getTermbyName(it.getName(KnownField.FAMILY)) != null) {
          final String parentName=it.getName(KnownField.FAMILY);
          target.attachParent(subFamilyTerm,target.getTermbyName(parentName));
        }
 else         if (it.hasColumn(KnownField.ORDER) && target.getTermbyName(it.getName(KnownField.ORDER)) != null) {
          final String parentName=it.getName(KnownField.ORDER);
          target.attachParent(subFamilyTerm,target.getTermbyName(parentName));
        }
 else         if (attachTerm != null)         target.attachParent(subFamilyTerm,attachTerm);
        if (isExtinct) {
          target.setExtinct(subFamilyTerm);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void processSubFamilyColumn(ItemList items,Term attachTerm){
  for (  Item it : items.getContents()) {
    final String subFamilyName=stripDagger(it.getName(KnownField.SUBFAMILY));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.SUBFAMILY));
    if (subFamilyName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(subFamilyName)) {
      if (target.getTermbyName(subFamilyName) == null) {
        final Term subFamilyTerm=target.addTerm(subFamilyName);
        target.setRankFromName(subFamilyTerm,KnownField.SUBFAMILY.getCannonicalName());
        if (it.hasColumn(KnownField.FAMILY) && target.getTermbyName(stripDagger(it.getName(KnownField.FAMILY))) != null) {
          final String parentName=stripDagger(it.getName(KnownField.FAMILY));
          target.attachParent(subFamilyTerm,target.getTermbyName(parentName));
        }
 else         if (it.hasColumn(KnownField.ORDER) && target.getTermbyName(stripDagger(it.getName(KnownField.ORDER))) != null) {
          final String parentName=stripDagger(it.getName(KnownField.ORDER));
          target.attachParent(subFamilyTerm,target.getTermbyName(parentName));
        }
 else         if (attachTerm != null)         target.attachParent(subFamilyTerm,attachTerm);
        if (isExtinct) {
          target.setExtinct(subFamilyTerm);
        }
      }
    }
  }
}
Program: 154148
Project: 154148
Buggy source:
private void processOrderColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    final String orderName=stripDagger(it.getName(KnownField.ORDER));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.FAMILY));
    if (orderName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(orderName)) {
      Term orderTerm=target.getTermbyName(orderName);
      if (orderTerm == null) {
        orderTerm=target.addTerm(orderName);
        target.setRankFromName(orderTerm,KnownField.ORDER.getCannonicalName());
        if (it.hasColumn(KnownField.CLASS) && target.getTermbyName(it.getName(KnownField.CLASS)) != null) {
          final String parentName=it.getName(KnownField.CLASS);
          target.attachParent(orderTerm,target.getTermbyName(parentName));
        }
 else         if (attachTerm != null)         target.attachParent(orderTerm,attachTerm);
        if (isExtinct) {
          target.setExtinct(orderTerm);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void processOrderColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    final String orderName=stripDagger(it.getName(KnownField.ORDER));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.FAMILY));
    if (orderName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(orderName)) {
      Term orderTerm=target.getTermbyName(orderName);
      if (orderTerm == null) {
        orderTerm=target.addTerm(orderName);
        target.setRankFromName(orderTerm,KnownField.ORDER.getCannonicalName());
        if (it.hasColumn(KnownField.CLASS) && target.getTermbyName(stripDagger(it.getName(KnownField.CLASS))) != null) {
          final String parentName=stripDagger(it.getName(KnownField.CLASS));
          target.attachParent(orderTerm,target.getTermbyName(parentName));
        }
 else         if (attachTerm != null)         target.attachParent(orderTerm,attachTerm);
        if (isExtinct) {
          target.setExtinct(orderTerm);
        }
      }
    }
  }
}
Program: 154149
Project: 154149
Buggy source:
private void processFamilyColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    final String familyName=stripDagger(it.getName(KnownField.FAMILY));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.FAMILY));
    if (familyName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(familyName)) {
      if (familyName != null) {
        if (target.getTermbyName(familyName) == null) {
          final Term familyTerm=target.addTerm(familyName);
          logger.info("String_Node_Str" + familyName + "String_Node_Str"+ familyTerm.getID());
          target.setRankFromName(familyTerm,KnownField.FAMILY.getCannonicalName());
          if (it.hasColumn(KnownField.ORDER) && target.getTermbyName(it.getName(KnownField.ORDER)) != null) {
            final String parentName=it.getName(KnownField.ORDER);
            target.attachParent(familyTerm,target.getTermbyName(parentName));
          }
 else           if (attachTerm != null)           target.attachParent(familyTerm,attachTerm);
          if (isExtinct) {
            target.setExtinct(familyTerm);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void processFamilyColumn(ItemList items,Term attachTerm){
  for (  final Item it : items.getContents()) {
    final String familyName=stripDagger(it.getName(KnownField.FAMILY));
    final boolean isExtinct=daggerPrefix(it.getName(KnownField.FAMILY));
    if (familyName.length() > 0 && !INCERTAESEDIS.equalsIgnoreCase(familyName)) {
      if (familyName != null) {
        if (target.getTermbyName(familyName) == null) {
          final Term familyTerm=target.addTerm(familyName);
          logger.info("String_Node_Str" + familyName + "String_Node_Str"+ familyTerm.getID());
          target.setRankFromName(familyTerm,KnownField.FAMILY.getCannonicalName());
          if (it.hasColumn(KnownField.ORDER) && target.getTermbyName(stripDagger(it.getName(KnownField.ORDER))) != null) {
            final String parentName=stripDagger(it.getName(KnownField.ORDER));
            target.attachParent(familyTerm,target.getTermbyName(parentName));
          }
 else           if (attachTerm != null)           target.attachParent(familyTerm,attachTerm);
          if (isExtinct) {
            target.setExtinct(familyTerm);
          }
        }
      }
    }
  }
}