nus-yam/ex-repair huggingface dataset:
Program: 31516
Project: 31516
Buggy source:
/** 
 * 错误处理
 * @param rBody
 * @param rCode
 * @throws InvalidRequestException
 * @throws AuthenticationException
 * @throws APIException
 */
private static void handleAPIError(String rBody,int rCode) throws InvalidRequestException, AuthenticationException, APIException, ChannelException, RateLimitException, ConnectException {
  APIResource.Error error=getGson().fromJson(rBody,APIResource.ErrorContainer.class).error;
switch (rCode) {
case 400:
    throw new InvalidRequestException(error.toString(),error.param,null);
case 404:
  throw new InvalidRequestException(error.toString(),error.param,null);
case 403:
throw new RateLimitException(error.toString(),null);
case 402:
throw new ChannelException(error.toString(),error.param,null);
case 401:
throw new AuthenticationException(error.toString());
case 502:
throw new ConnectException(error.toString());
default :
throw new APIException(error.toString(),null);
}
}

Fixed version (ground truth):
/** 
 * 错误处理
 * @param rBody
 * @param rCode
 * @throws InvalidRequestException
 * @throws AuthenticationException
 * @throws APIException
 */
private static void handleAPIError(String rBody,int rCode) throws InvalidRequestException, AuthenticationException, APIException, ChannelException, RateLimitException, ConnectException {
  Error error=null;
  try {
    error=getGson().fromJson(rBody,ErrorContainer.class).error;
  }
 catch (  JsonSyntaxException e) {
    error=new Error();
    error.message=rBody;
    error.code=String.valueOf(rCode);
  }
switch (rCode) {
case 400:
    throw new InvalidRequestException(error.toString(),error.param,null);
case 404:
  throw new InvalidRequestException(error.toString(),error.param,null);
case 403:
throw new RateLimitException(error.toString(),null);
case 402:
throw new ChannelException(error.toString(),error.param,null);
case 401:
throw new AuthenticationException(error.toString());
case 502:
throw new ConnectException(error.toString());
default :
throw new APIException(error.toString(),null);
}
}
Program: 31517
Project: 31517
Buggy source:
public MappingsPanel(String srcPath,String dstPath,TreeContext src,TreeContext dst,Matcher m){
  super(new GridLayout(1,0));
  this.src=src;
  this.dst=dst;
  this.classifyTrees=new RootsClassifier(src,dst,m);
  this.mappings=new MappingStore(m.getMappingsAsSet());
  this.panSrc=new TreePanel(this.src,new MappingsCellRenderer(true));
  this.panSrc.getJTree().addTreeSelectionListener(this);
  this.panDst=new TreePanel(this.dst,new MappingsCellRenderer(false));
  this.panDst.getJTree().addTreeSelectionListener(this);
  this.txtSrc=new JTextArea();
  this.txtDst=new JTextArea();
  JPanel top=new JPanel();
  top.setLayout(new GridLayout(1,2));
  top.add(panSrc);
  top.add(panDst);
  JPanel bottom=new JPanel();
  bottom.setLayout(new GridLayout(1,2));
  bottom.add(new JScrollPane(txtSrc));
  bottom.add(new JScrollPane(txtDst));
  JSplitPane split=new JSplitPane(JSplitPane.VERTICAL_SPLIT,top,bottom);
  split.setDividerLocation(650);
  add(split);
  try {
    txtSrc.getUI().getEditorKit(txtSrc).read(new FileReader(srcPath),txtSrc.getDocument(),0);
    txtDst.getUI().getEditorKit(txtDst).read(new FileReader(dstPath),txtDst.getDocument(),0);
  }
 catch (  IOException|BadLocationException e) {
    e.printStackTrace();
  }
  setPreferredSize(new Dimension(1024,768));
  openNodes();
}

Fixed version (ground truth):
public MappingsPanel(String srcPath,String dstPath,TreeContext src,TreeContext dst,Matcher m){
  super(new GridLayout(1,0));
  this.src=src;
  this.dst=dst;
  this.classifyTrees=new RootsClassifier(src,dst,m);
  this.mappings=new MappingStore(m.getMappingsAsSet());
  this.panSrc=new TreePanel(this.src,new MappingsCellRenderer(true));
  this.panSrc.getJTree().addTreeSelectionListener(this);
  this.panDst=new TreePanel(this.dst,new MappingsCellRenderer(false));
  this.panDst.getJTree().addTreeSelectionListener(this);
  this.txtSrc=new JTextArea();
  this.txtDst=new JTextArea();
  JPanel top=new JPanel();
  top.setLayout(new GridLayout(1,2));
  top.add(panSrc);
  top.add(panDst);
  JPanel bottom=new JPanel();
  bottom.setLayout(new GridLayout(1,2));
  bottom.add(new JScrollPane(txtSrc));
  bottom.add(new JScrollPane(txtDst));
  JSplitPane split=new JSplitPane(JSplitPane.VERTICAL_SPLIT,top,bottom);
  split.setDividerLocation(650);
  add(split);
  try {
    txtSrc.getUI().getEditorKit(txtSrc).read(Files.newBufferedReader(Paths.get(srcPath),Charset.forName("String_Node_Str")),txtSrc.getDocument(),0);
    txtDst.getUI().getEditorKit(txtDst).read(Files.newBufferedReader(Paths.get(dstPath),Charset.forName("String_Node_Str")),txtDst.getDocument(),0);
  }
 catch (  IOException|BadLocationException e) {
    e.printStackTrace();
  }
  setPreferredSize(new Dimension(1024,768));
  openNodes();
}
Program: 31518
Project: 31518
Buggy source:
public void run(){
  JFrame frame=new JFrame("String_Node_Str");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.add(new MappingsPanel(opts.src,opts.dst,getSrcTreeContext(),getDstTreeContext(),matcher));
  frame.pack();
  frame.setVisible(true);
}

Fixed version (ground truth):
@Override public void run(){
  JFrame frame=new JFrame("String_Node_Str");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.add(new MappingsPanel(opts.src,opts.dst,getSrcTreeContext(),getDstTreeContext(),matcher));
  frame.pack();
  frame.setVisible(true);
}
Program: 31519
Project: 31519
Buggy source:
public static void main(String[] args) throws IOException {
  final TreeContext t=Generators.getInstance().getTree(args[0]);
  javax.swing.SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      createAndShow(t);
    }
  }
);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  final TreeContext t=Generators.getInstance().getTree(args[0]);
  javax.swing.SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      createAndShow(t);
    }
  }
);
}
Program: 31520
Project: 31520
Buggy source:
public void run(){
  createAndShow(t);
}

Fixed version (ground truth):
@Override public void run(){
  createAndShow(t);
}
Program: 31521
Project: 31521
Buggy source:
public String convertValueToText(Object value,boolean selected,boolean expanded,boolean leaf,int row,boolean hasFocus){
  if (value != null) {
    ITree node=((ITree)((DefaultMutableTreeNode)value).getUserObject());
    return node.toPrettyString(tree);
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String convertValueToText(Object value,boolean selected,boolean expanded,boolean leaf,int row,boolean hasFocus){
  if (value != null) {
    ITree node=((ITree)((DefaultMutableTreeNode)value).getUserObject());
    return node.toPrettyString(tree);
  }
  return "String_Node_Str";
}
Program: 31523
Project: 31523
Buggy source:
public void writeComment(String data) throws XMLStreamException {
  beforeMarkup();
  out.writeComment(data);
  afterMarkup();
}

Fixed version (ground truth):
@Override public void writeComment(String data) throws XMLStreamException {
  beforeMarkup();
  out.writeComment(data);
  afterMarkup();
}
Program: 31524
Project: 31524
Buggy source:
public void setNewLine(String newLine){
  if (!newLine.equals(this.newLine)) {
    this.newLine=newLine;
    linePrefix=null;
  }
}

Fixed version (ground truth):
@Override public void setNewLine(String newLine){
  if (!newLine.equals(this.newLine)) {
    this.newLine=newLine;
    linePrefix=null;
  }
}
Program: 31525
Project: 31525
Buggy source:
public void writeDTD(String dtd) throws XMLStreamException {
  beforeMarkup();
  out.writeDTD(dtd);
  afterMarkup();
}

Fixed version (ground truth):
@Override public void writeDTD(String dtd) throws XMLStreamException {
  beforeMarkup();
  out.writeDTD(dtd);
  afterMarkup();
}
Program: 31526
Project: 31526
Buggy source:
public void writeProcessingInstruction(String target,String data) throws XMLStreamException {
  beforeMarkup();
  out.writeProcessingInstruction(target,data);
  afterMarkup();
}

Fixed version (ground truth):
@Override public void writeProcessingInstruction(String target,String data) throws XMLStreamException {
  beforeMarkup();
  out.writeProcessingInstruction(target,data);
  afterMarkup();
}
Program: 31527
Project: 31527
Buggy source:
public void setIndent(String indent){
  if (!indent.equals(this.indent)) {
    this.indent=indent;
    linePrefix=null;
  }
}

Fixed version (ground truth):
@Override public void setIndent(String indent){
  if (!indent.equals(this.indent)) {
    this.indent=indent;
    linePrefix=null;
  }
}
Program: 31528
Project: 31528
Buggy source:
public void writeEndElement() throws XMLStreamException {
  beforeEndElement();
  out.writeEndElement();
  afterEndElement();
}

Fixed version (ground truth):
@Override public void writeEndElement() throws XMLStreamException {
  beforeEndElement();
  out.writeEndElement();
  afterEndElement();
}
Program: 31529
Project: 31529
Buggy source:
public void writeEndDocument() throws XMLStreamException {
  try {
    while (depth > 0) {
      writeEndElement();
    }
  }
 catch (  Exception ignored) {
    ignored.printStackTrace();
  }
  out.writeEndDocument();
  afterEndDocument();
}

Fixed version (ground truth):
@Override public void writeEndDocument() throws XMLStreamException {
  try {
    while (depth > 0) {
      writeEndElement();
    }
  }
 catch (  Exception ignored) {
    ignored.printStackTrace();
  }
  out.writeEndDocument();
  afterEndDocument();
}
Program: 31530
Project: 31530
Buggy source:
public String getIndent(){
  return indent;
}

Fixed version (ground truth):
@Override public String getIndent(){
  return indent;
}
Program: 31531
Project: 31531
Buggy source:
public void writeEmptyElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  beforeMarkup();
  out.writeEmptyElement(prefix,localName,namespaceURI);
  afterMarkup();
}

Fixed version (ground truth):
@Override public void writeEmptyElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  beforeMarkup();
  out.writeEmptyElement(prefix,localName,namespaceURI);
  afterMarkup();
}
Program: 31532
Project: 31532
Buggy source:
public void writeEntityRef(String name) throws XMLStreamException {
  out.writeEntityRef(name);
  afterData();
}

Fixed version (ground truth):
@Override public void writeEntityRef(String name) throws XMLStreamException {
  out.writeEntityRef(name);
  afterData();
}
Program: 31533
Project: 31533
Buggy source:
public void writeCharacters(char[] text,int start,int len) throws XMLStreamException {
  out.writeCharacters(text,start,len);
  afterData();
}

Fixed version (ground truth):
@Override public void writeCharacters(char[] text,int start,int len) throws XMLStreamException {
  out.writeCharacters(text,start,len);
  afterData();
}
Program: 31534
Project: 31534
Buggy source:
public String getNewLine(){
  return newLine;
}

Fixed version (ground truth):
@Override public String getNewLine(){
  return newLine;
}
Program: 31535
Project: 31535
Buggy source:
public void writeStartDocument(String encoding,String version) throws XMLStreamException {
  beforeMarkup();
  out.writeStartDocument(encoding,version);
  afterMarkup();
}

Fixed version (ground truth):
@Override public void writeStartDocument(String encoding,String version) throws XMLStreamException {
  beforeMarkup();
  out.writeStartDocument(encoding,version);
  afterMarkup();
}
Program: 31536
Project: 31536
Buggy source:
public void writeCData(String data) throws XMLStreamException {
  out.writeCData(data);
  afterData();
}

Fixed version (ground truth):
@Override public void writeCData(String data) throws XMLStreamException {
  out.writeCData(data);
  afterData();
}
Program: 31537
Project: 31537
Buggy source:
public void writeStartElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  beforeStartElement();
  out.writeStartElement(prefix,localName,namespaceURI);
  afterStartElement();
}

Fixed version (ground truth):
@Override public void writeStartElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  beforeStartElement();
  out.writeStartElement(prefix,localName,namespaceURI);
  afterStartElement();
}
Program: 31538
Project: 31538
Buggy source:
@Override public Exception getCause(){
  return cause;
}

Fixed version (ground truth):
@Override public synchronized Exception getCause(){
  return cause;
}
Program: 31539
Project: 31539
Buggy source:
@Override protected TreeContext generate(Reader source) throws IOException {
  XMLInputFactory fact=XMLInputFactory.newInstance();
  TreeContext context=new TreeContext();
  try {
    Stack<ITree> trees=new Stack<>();
    XMLEventReader r=fact.createXMLEventReader(source);
    while (r.hasNext()) {
      XMLEvent e=r.nextEvent();
      if (e instanceof StartElement) {
        StartElement s=(StartElement)e;
        if (!s.getName().getLocalPart().equals("String_Node_Str"))         continue;
        int type=Integer.parseInt(s.getAttributeByName(TYPE).getValue());
        ITree t=context.createTree(type,labelForAttribute(s,LABEL),labelForAttribute(s,TYPE_LABEL));
        Iterator<?> it=s.getAttributes();
        while (it.hasNext()) {
          Attribute a=(Attribute)it.next();
          unserializers.load(t,a.getName().getLocalPart(),a.getValue());
        }
        if (trees.isEmpty())         context.setRoot(t);
 else         t.setParentAndUpdateChildren(trees.peek());
        trees.push(t);
      }
 else       if (e instanceof EndElement) {
        if (!((EndElement)e).getName().getLocalPart().equals("String_Node_Str"))         continue;
        trees.pop();
      }
    }
    context.validate();
    return context;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override protected TreeContext generate(Reader source) throws IOException {
  XMLInputFactory fact=XMLInputFactory.newInstance();
  TreeContext context=new TreeContext();
  try {
    ArrayDeque<ITree> trees=new ArrayDeque<>();
    XMLEventReader r=fact.createXMLEventReader(source);
    while (r.hasNext()) {
      XMLEvent e=r.nextEvent();
      if (e instanceof StartElement) {
        StartElement s=(StartElement)e;
        if (!s.getName().getLocalPart().equals("String_Node_Str"))         continue;
        int type=Integer.parseInt(s.getAttributeByName(TYPE).getValue());
        ITree t=context.createTree(type,labelForAttribute(s,LABEL),labelForAttribute(s,TYPE_LABEL));
        Iterator<?> it=s.getAttributes();
        while (it.hasNext()) {
          Attribute a=(Attribute)it.next();
          unserializers.load(t,a.getName().getLocalPart(),a.getValue());
        }
        if (trees.isEmpty())         context.setRoot(t);
 else         t.setParentAndUpdateChildren(trees.peekFirst());
        trees.addFirst(t);
      }
 else       if (e instanceof EndElement) {
        if (!((EndElement)e).getName().getLocalPart().equals("String_Node_Str"))         continue;
        trees.removeFirst();
      }
    }
    context.validate();
    return context;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 31540
Project: 31540
Buggy source:
public void writeTo(Writer writer) throws Exception {
  TreeFormatter formatter=newFormatter(context,serializers,writer);
  try {
    writeTree(formatter,context.getRoot());
  }
  finally {
    formatter.close();
  }
}

Fixed version (ground truth):
@Override public void writeTo(Writer writer) throws Exception {
  TreeFormatter formatter=newFormatter(context,serializers,writer);
  try {
    writeTree(formatter,context.getRoot());
  }
  finally {
    formatter.close();
  }
}
Program: 31541
Project: 31541
Buggy source:
@Override public void match(){
  List<Mapping> leavesMappings=new LinkedList<>();
  List<ITree> dstLeaves=retainLeaves(TreeUtils.postOrder(dst));
  for (Iterator<ITree> srcLeaves=TreeUtils.leafIterator(TreeUtils.postOrderIterator(src)); srcLeaves.hasNext(); ) {
    ITree srcLeaf=srcLeaves.next();
    for (    ITree dstLeaf : dstLeaves) {
      if (isMappingAllowed(srcLeaf,dstLeaf)) {
        double sim=StringMetrics.qGramsDistance().compare(srcLeaf.getLabel(),dstLeaf.getLabel());
        if (sim > LABEL_SIM_THRESHOLD)         leavesMappings.add(new Mapping(srcLeaf,dstLeaf));
      }
    }
  }
  Set<ITree> ignoredSrcTrees=new HashSet<>();
  Set<ITree> ignoredDstTrees=new HashSet<>();
  Collections.sort(leavesMappings,new LeafMappingComparator());
  while (leavesMappings.size() > 0) {
    Mapping bestMapping=leavesMappings.remove(0);
    if (!(ignoredSrcTrees.contains(bestMapping.getFirst()) || ignoredDstTrees.contains(bestMapping.getSecond()))) {
      addMapping(bestMapping.getFirst(),bestMapping.getSecond());
      ignoredSrcTrees.add(bestMapping.getFirst());
      ignoredDstTrees.add(bestMapping.getSecond());
    }
  }
}

Fixed version (ground truth):
@Override public void match(){
  List<Mapping> leavesMappings=new ArrayList<>();
  List<ITree> dstLeaves=retainLeaves(TreeUtils.postOrder(dst));
  for (Iterator<ITree> srcLeaves=TreeUtils.leafIterator(TreeUtils.postOrderIterator(src)); srcLeaves.hasNext(); ) {
    ITree srcLeaf=srcLeaves.next();
    for (    ITree dstLeaf : dstLeaves) {
      if (isMappingAllowed(srcLeaf,dstLeaf)) {
        double sim=StringMetrics.qGramsDistance().compare(srcLeaf.getLabel(),dstLeaf.getLabel());
        if (sim > LABEL_SIM_THRESHOLD)         leavesMappings.add(new Mapping(srcLeaf,dstLeaf));
      }
    }
  }
  Set<ITree> ignoredSrcTrees=new HashSet<>();
  Set<ITree> ignoredDstTrees=new HashSet<>();
  Collections.sort(leavesMappings,new LeafMappingComparator());
  while (leavesMappings.size() > 0) {
    Mapping bestMapping=leavesMappings.remove(0);
    if (!(ignoredSrcTrees.contains(bestMapping.getFirst()) || ignoredDstTrees.contains(bestMapping.getSecond()))) {
      addMapping(bestMapping.getFirst(),bestMapping.getSecond());
      ignoredSrcTrees.add(bestMapping.getFirst());
      ignoredDstTrees.add(bestMapping.getSecond());
    }
  }
}
Program: 31542
Project: 31542
Buggy source:
public int compare(Mapping m1,Mapping m2){
  double[] sims1=simMap.get(m1);
  double[] sims2=simMap.get(m2);
  for (int i=0; i < sims1.length; i++) {
    if (sims1[i] != sims2[i])     return -1 * Double.compare(sims2[i],sims2[i]);
  }
  return 0;
}

Fixed version (ground truth):
@Override public int compare(Mapping m1,Mapping m2){
  double[] sims1=simMap.get(m1);
  double[] sims2=simMap.get(m2);
  for (int i=0; i < sims1.length; i++) {
    if (sims1[i] != sims2[i])     return -1 * Double.compare(sims2[i],sims2[i]);
  }
  return 0;
}
Program: 31543
Project: 31543
Buggy source:
public String toString(){
  return key;
}

Fixed version (ground truth):
@Override public String toString(){
  return key;
}
Program: 31544
Project: 31544
Buggy source:
public void classify(){
  for (  Action a : actions) {
    if (a instanceof Delete)     srcDelTrees.add(a.getNode());
 else     if (a instanceof Insert)     dstAddTrees.add(a.getNode());
 else     if (a instanceof Update) {
      srcUpdTrees.add(a.getNode());
      dstUpdTrees.add(mappings.getDst(a.getNode()));
    }
 else     if (a instanceof Move) {
      srcMvTrees.add(a.getNode());
      dstMvTrees.add(mappings.getDst(a.getNode()));
    }
  }
}

Fixed version (ground truth):
@Override public void classify(){
  for (  Action a : actions) {
    if (a instanceof Delete)     srcDelTrees.add(a.getNode());
 else     if (a instanceof Insert)     dstAddTrees.add(a.getNode());
 else     if (a instanceof Update) {
      srcUpdTrees.add(a.getNode());
      dstUpdTrees.add(mappings.getDst(a.getNode()));
    }
 else     if (a instanceof Move) {
      srcMvTrees.add(a.getNode());
      dstMvTrees.add(mappings.getDst(a.getNode()));
    }
  }
}
Program: 31545
Project: 31545
Buggy source:
public TreeContext generateFromFile(File file) throws IOException {
  return generateFromReader(new FileReader(file));
}

Fixed version (ground truth):
public TreeContext generateFromFile(File file) throws IOException {
  return generateFromReader(Files.newBufferedReader(file.toPath(),Charset.forName("String_Node_Str")));
}
Program: 31546
Project: 31546
Buggy source:
public TreeContext generateFromStream(InputStream stream) throws IOException {
  return generateFromReader(new InputStreamReader(stream));
}

Fixed version (ground truth):
public TreeContext generateFromStream(InputStream stream) throws IOException {
  return generateFromReader(new InputStreamReader(stream,"String_Node_Str"));
}
Program: 31547
Project: 31547
Buggy source:
public void writeComment(String data) throws XMLStreamException {
  out.writeComment(data);
}

Fixed version (ground truth):
@Override public void writeComment(String data) throws XMLStreamException {
  out.writeComment(data);
}
Program: 31548
Project: 31548
Buggy source:
public void writeNamespace(String prefix,String namespaceURI) throws XMLStreamException {
  out.writeNamespace(prefix,namespaceURI);
}

Fixed version (ground truth):
@Override public void writeNamespace(String prefix,String namespaceURI) throws XMLStreamException {
  out.writeNamespace(prefix,namespaceURI);
}
Program: 31549
Project: 31549
Buggy source:
public void writeEndDocument() throws XMLStreamException {
  out.writeEndDocument();
}

Fixed version (ground truth):
@Override public void writeEndDocument() throws XMLStreamException {
  out.writeEndDocument();
}
Program: 31550
Project: 31550
Buggy source:
public Object getProperty(String name) throws IllegalArgumentException {
  return out.getProperty(name);
}

Fixed version (ground truth):
@Override public Object getProperty(String name) throws IllegalArgumentException {
  return out.getProperty(name);
}
Program: 31551
Project: 31551
Buggy source:
public String getPrefix(String uri) throws XMLStreamException {
  return out.getPrefix(uri);
}

Fixed version (ground truth):
@Override public String getPrefix(String uri) throws XMLStreamException {
  return out.getPrefix(uri);
}
Program: 31552
Project: 31552
Buggy source:
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
  out.setNamespaceContext(context);
}

Fixed version (ground truth):
@Override public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
  out.setNamespaceContext(context);
}
Program: 31553
Project: 31553
Buggy source:
public void writeDTD(String dtd) throws XMLStreamException {
  out.writeDTD(dtd);
}

Fixed version (ground truth):
@Override public void writeDTD(String dtd) throws XMLStreamException {
  out.writeDTD(dtd);
}
Program: 31554
Project: 31554
Buggy source:
public void writeEmptyElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  out.writeEmptyElement(prefix,localName,namespaceURI);
}

Fixed version (ground truth):
@Override public void writeEmptyElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  out.writeEmptyElement(prefix,localName,namespaceURI);
}
Program: 31555
Project: 31555
Buggy source:
public void writeEntityRef(String name) throws XMLStreamException {
  out.writeEntityRef(name);
}

Fixed version (ground truth):
@Override public void writeEntityRef(String name) throws XMLStreamException {
  out.writeEntityRef(name);
}
Program: 31556
Project: 31556
Buggy source:
public void writeCharacters(char[] text,int start,int len) throws XMLStreamException {
  out.writeCharacters(text,start,len);
}

Fixed version (ground truth):
@Override public void writeCharacters(char[] text,int start,int len) throws XMLStreamException {
  out.writeCharacters(text,start,len);
}
Program: 31557
Project: 31557
Buggy source:
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
  out.writeDefaultNamespace(namespaceURI);
}

Fixed version (ground truth):
@Override public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
  out.writeDefaultNamespace(namespaceURI);
}
Program: 31558
Project: 31558
Buggy source:
public void setDefaultNamespace(String uri) throws XMLStreamException {
  out.setDefaultNamespace(uri);
}

Fixed version (ground truth):
@Override public void setDefaultNamespace(String uri) throws XMLStreamException {
  out.setDefaultNamespace(uri);
}
Program: 31559
Project: 31559
Buggy source:
public void writeProcessingInstruction(String target,String data) throws XMLStreamException {
  out.writeProcessingInstruction(target,data);
}

Fixed version (ground truth):
@Override public void writeProcessingInstruction(String target,String data) throws XMLStreamException {
  out.writeProcessingInstruction(target,data);
}
Program: 31560
Project: 31560
Buggy source:
public void flush() throws XMLStreamException {
  out.flush();
}

Fixed version (ground truth):
@Override public void flush() throws XMLStreamException {
  out.flush();
}
Program: 31561
Project: 31561
Buggy source:
public void setPrefix(String prefix,String uri) throws XMLStreamException {
  out.setPrefix(prefix,uri);
}

Fixed version (ground truth):
@Override public void setPrefix(String prefix,String uri) throws XMLStreamException {
  out.setPrefix(prefix,uri);
}
Program: 31562
Project: 31562
Buggy source:
public void writeStartDocument(String encoding,String version) throws XMLStreamException {
  out.writeStartDocument(encoding,version);
}

Fixed version (ground truth):
@Override public void writeStartDocument(String encoding,String version) throws XMLStreamException {
  out.writeStartDocument(encoding,version);
}
Program: 31563
Project: 31563
Buggy source:
public void writeCData(String data) throws XMLStreamException {
  out.writeCData(data);
}

Fixed version (ground truth):
@Override public void writeCData(String data) throws XMLStreamException {
  out.writeCData(data);
}
Program: 31564
Project: 31564
Buggy source:
public NamespaceContext getNamespaceContext(){
  return out.getNamespaceContext();
}

Fixed version (ground truth):
@Override public NamespaceContext getNamespaceContext(){
  return out.getNamespaceContext();
}
Program: 31565
Project: 31565
Buggy source:
public void writeStartElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  out.writeStartElement(prefix,localName,namespaceURI);
}

Fixed version (ground truth):
@Override public void writeStartElement(String prefix,String localName,String namespaceURI) throws XMLStreamException {
  out.writeStartElement(prefix,localName,namespaceURI);
}
Program: 31566
Project: 31566
Buggy source:
public void writeEndElement() throws XMLStreamException {
  out.writeEndElement();
}

Fixed version (ground truth):
@Override public void writeEndElement() throws XMLStreamException {
  out.writeEndElement();
}
Program: 31567
Project: 31567
Buggy source:
public void close() throws XMLStreamException {
  out.close();
}

Fixed version (ground truth):
@Override public void close() throws XMLStreamException {
  out.close();
}
Program: 31568
Project: 31568
Buggy source:
public void writeAttribute(String prefix,String namespaceURI,String localName,String value) throws XMLStreamException {
  out.writeAttribute(prefix,namespaceURI,localName,value);
}

Fixed version (ground truth):
@Override public void writeAttribute(String prefix,String namespaceURI,String localName,String value) throws XMLStreamException {
  out.writeAttribute(prefix,namespaceURI,localName,value);
}
Program: 31569
Project: 31569
Buggy source:
public void match(){
  for (  Matcher matcher : matchers) {
    matcher.match();
  }
}

Fixed version (ground truth):
@Override public void match(){
  for (  Matcher matcher : matchers) {
    matcher.match();
  }
}
Program: 31570
Project: 31570
Buggy source:
public void match(){
  for (  ITree src : this.src.postOrder()) {
    if (src.isRoot()) {
      addMapping(src,this.dst);
      lastChanceMatch(src,this.dst);
    }
 else     if (!(mappings.hasSrc(src) || src.isLeaf())) {
      Set<ITree> candidates=getDstCandidates(src);
      ITree best=null;
      double max=-1D;
      for (      ITree cand : candidates) {
        double sim=jaccardSimilarity(src,cand);
        if (sim > max && sim >= SIM_THRESHOLD) {
          max=sim;
          best=cand;
        }
      }
      if (best != null) {
        lastChanceMatch(src,best);
        addMapping(src,best);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void match(){
  for (  ITree src : this.src.postOrder()) {
    if (src.isRoot()) {
      addMapping(src,this.dst);
      lastChanceMatch(src,this.dst);
    }
 else     if (!(mappings.hasSrc(src) || src.isLeaf())) {
      Set<ITree> candidates=getDstCandidates(src);
      ITree best=null;
      double max=-1D;
      for (      ITree cand : candidates) {
        double sim=jaccardSimilarity(src,cand);
        if (sim > max && sim >= SIM_THRESHOLD) {
          max=sim;
          best=cand;
        }
      }
      if (best != null) {
        lastChanceMatch(src,best);
        addMapping(src,best);
      }
    }
  }
}
Program: 31571
Project: 31571
Buggy source:
protected void addMapping(ITree src,ITree dst){
  mappedSrc.putTree(src);
  mappedDst.putTree(dst);
  super.addMapping(src,dst);
}

Fixed version (ground truth):
@Override protected void addMapping(ITree src,ITree dst){
  mappedSrc.putTree(src);
  mappedDst.putTree(dst);
  super.addMapping(src,dst);
}
Program: 31572
Project: 31572
Buggy source:
public int compare(Mapping m1,Mapping m2){
  if (similarities.get(m2).compareTo(similarities.get(m1)) != 0) {
    return Double.compare(similarities.get(m2),similarities.get(m1));
  }
  if (m1.first.getId() != m2.first.getId()) {
    return Integer.compare(m1.first.getId(),m2.first.getId());
  }
  return Integer.compare(m1.second.getId(),m2.second.getId());
}

Fixed version (ground truth):
@Override public int compare(Mapping m1,Mapping m2){
  if (similarities.get(m2).compareTo(similarities.get(m1)) != 0) {
    return Double.compare(similarities.get(m2),similarities.get(m1));
  }
  if (m1.first.getId() != m2.first.getId()) {
    return Integer.compare(m1.first.getId(),m2.first.getId());
  }
  return Integer.compare(m1.second.getId(),m2.second.getId());
}
Program: 31573
Project: 31573
Buggy source:
public void match(){
  MultiMappingStore multiMappings=new MultiMappingStore();
  PriorityTreeList srcTrees=new PriorityTreeList(src);
  PriorityTreeList dstTrees=new PriorityTreeList(dst);
  while (srcTrees.peekHeight() != -1 && dstTrees.peekHeight() != -1) {
    while (srcTrees.peekHeight() != dstTrees.peekHeight())     popLarger(srcTrees,dstTrees);
    List<ITree> currentHeightSrcTrees=srcTrees.pop();
    List<ITree> currentHeightDstTrees=dstTrees.pop();
    boolean[] marksForSrcTrees=new boolean[currentHeightSrcTrees.size()];
    boolean[] marksForDstTrees=new boolean[currentHeightDstTrees.size()];
    for (int i=0; i < currentHeightSrcTrees.size(); i++) {
      for (int j=0; j < currentHeightDstTrees.size(); j++) {
        ITree src=currentHeightSrcTrees.get(i);
        ITree dst=currentHeightDstTrees.get(j);
        if (src.isIsomorphicTo(dst)) {
          multiMappings.link(src,dst);
          marksForSrcTrees[i]=true;
          marksForDstTrees[j]=true;
        }
      }
    }
    for (int i=0; i < marksForSrcTrees.length; i++)     if (marksForSrcTrees[i] == false)     srcTrees.open(currentHeightSrcTrees.get(i));
    for (int j=0; j < marksForDstTrees.length; j++)     if (marksForDstTrees[j] == false)     dstTrees.open(currentHeightDstTrees.get(j));
    srcTrees.updateHeight();
    dstTrees.updateHeight();
  }
  filterMappings(multiMappings);
}

Fixed version (ground truth):
@Override public void match(){
  MultiMappingStore multiMappings=new MultiMappingStore();
  PriorityTreeList srcTrees=new PriorityTreeList(src);
  PriorityTreeList dstTrees=new PriorityTreeList(dst);
  while (srcTrees.peekHeight() != -1 && dstTrees.peekHeight() != -1) {
    while (srcTrees.peekHeight() != dstTrees.peekHeight())     popLarger(srcTrees,dstTrees);
    List<ITree> currentHeightSrcTrees=srcTrees.pop();
    List<ITree> currentHeightDstTrees=dstTrees.pop();
    boolean[] marksForSrcTrees=new boolean[currentHeightSrcTrees.size()];
    boolean[] marksForDstTrees=new boolean[currentHeightDstTrees.size()];
    for (int i=0; i < currentHeightSrcTrees.size(); i++) {
      for (int j=0; j < currentHeightDstTrees.size(); j++) {
        ITree src=currentHeightSrcTrees.get(i);
        ITree dst=currentHeightDstTrees.get(j);
        if (src.isIsomorphicTo(dst)) {
          multiMappings.link(src,dst);
          marksForSrcTrees[i]=true;
          marksForDstTrees[j]=true;
        }
      }
    }
    for (int i=0; i < marksForSrcTrees.length; i++)     if (marksForSrcTrees[i] == false)     srcTrees.open(currentHeightSrcTrees.get(i));
    for (int j=0; j < marksForDstTrees.length; j++)     if (marksForDstTrees[j] == false)     dstTrees.open(currentHeightDstTrees.get(j));
    srcTrees.updateHeight();
    dstTrees.updateHeight();
  }
  filterMappings(multiMappings);
}
Program: 31574
Project: 31574
Buggy source:
public void match(){
  for (  ITree t : src.postOrder()) {
    if (t.isRoot()) {
      addMapping(t,this.dst);
      lastChanceMatch(t,this.dst);
      break;
    }
 else     if (!(isSrcMatched(t) || t.isLeaf())) {
      List<ITree> srcCandidates=t.getParents().stream().filter(p -> p.getType() == t.getType()).collect(Collectors.toList());
      List<ITree> dstCandidates=getDstCandidates(t);
      ITree srcBest=null;
      ITree dstBest=null;
      double max=-1D;
      for (      ITree srcCand : srcCandidates) {
        for (        ITree dstCand : dstCandidates) {
          double sim=jaccardSimilarity(srcCand,dstCand);
          if (sim > max && sim >= SIM_THRESHOLD) {
            max=sim;
            srcBest=srcCand;
            dstBest=dstCand;
          }
        }
      }
      if (srcBest != null) {
        lastChanceMatch(srcBest,dstBest);
        addMapping(srcBest,dstBest);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void match(){
  for (  ITree t : src.postOrder()) {
    if (t.isRoot()) {
      addMapping(t,this.dst);
      lastChanceMatch(t,this.dst);
      break;
    }
 else     if (!(isSrcMatched(t) || t.isLeaf())) {
      List<ITree> srcCandidates=t.getParents().stream().filter(p -> p.getType() == t.getType()).collect(Collectors.toList());
      List<ITree> dstCandidates=getDstCandidates(t);
      ITree srcBest=null;
      ITree dstBest=null;
      double max=-1D;
      for (      ITree srcCand : srcCandidates) {
        for (        ITree dstCand : dstCandidates) {
          double sim=jaccardSimilarity(srcCand,dstCand);
          if (sim > max && sim >= SIM_THRESHOLD) {
            max=sim;
            srcBest=srcCand;
            dstBest=dstCand;
          }
        }
      }
      if (srcBest != null) {
        lastChanceMatch(srcBest,dstBest);
        addMapping(srcBest,dstBest);
      }
    }
  }
}
Program: 31575
Project: 31575
Buggy source:
public void match(){
  for (  ITree t : src.postOrder()) {
    if (t.isRoot()) {
      addMapping(t,this.dst);
      lastChanceMatch(t,this.dst);
      break;
    }
 else     if (!(isSrcMatched(t) || t.isLeaf())) {
      List<ITree> candidates=getDstCandidates(t);
      ITree best=null;
      double max=-1D;
      for (      ITree cand : candidates) {
        double sim=jaccardSimilarity(t,cand);
        if (sim > max && sim >= SIM_THRESHOLD) {
          max=sim;
          best=cand;
        }
      }
      if (best != null) {
        lastChanceMatch(t,best);
        addMapping(t,best);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void match(){
  for (  ITree t : src.postOrder()) {
    if (t.isRoot()) {
      addMapping(t,this.dst);
      lastChanceMatch(t,this.dst);
      break;
    }
 else     if (!(isSrcMatched(t) || t.isLeaf())) {
      List<ITree> candidates=getDstCandidates(t);
      ITree best=null;
      double max=-1D;
      for (      ITree cand : candidates) {
        double sim=jaccardSimilarity(t,cand);
        if (sim > max && sim >= SIM_THRESHOLD) {
          max=sim;
          best=cand;
        }
      }
      if (best != null) {
        lastChanceMatch(t,best);
        addMapping(t,best);
      }
    }
  }
}
Program: 31576
Project: 31576
Buggy source:
public void filterMappings(MultiMappingStore multiMappings){
  List<Mapping> ambiguousList=new LinkedList<>();
  Set<ITree> ignored=new HashSet<>();
  for (  ITree src : multiMappings.getSrcs()) {
    if (multiMappings.isSrcUnique(src))     addMappingRecursively(src,multiMappings.getDst(src).iterator().next());
 else     if (!ignored.contains(src)) {
      Set<ITree> adsts=multiMappings.getDst(src);
      Set<ITree> asrcs=multiMappings.getSrc(multiMappings.getDst(src).iterator().next());
      for (      ITree asrc : asrcs)       for (      ITree adst : adsts)       ambiguousList.add(new Mapping(asrc,adst));
      ignored.addAll(asrcs);
    }
  }
  Set<ITree> srcIgnored=new HashSet<>();
  Set<ITree> dstIgnored=new HashSet<>();
  Collections.sort(ambiguousList,new SiblingsMappingComparator(ambiguousList,mappings,getMaxTreeSize()));
  retainBestMapping(ambiguousList,srcIgnored,dstIgnored);
}

Fixed version (ground truth):
@Override public void filterMappings(MultiMappingStore multiMappings){
  List<Mapping> ambiguousList=new ArrayList<>();
  Set<ITree> ignored=new HashSet<>();
  for (  ITree src : multiMappings.getSrcs()) {
    if (multiMappings.isSrcUnique(src))     addMappingRecursively(src,multiMappings.getDst(src).iterator().next());
 else     if (!ignored.contains(src)) {
      Set<ITree> adsts=multiMappings.getDst(src);
      Set<ITree> asrcs=multiMappings.getSrc(multiMappings.getDst(src).iterator().next());
      for (      ITree asrc : asrcs)       for (      ITree adst : adsts)       ambiguousList.add(new Mapping(asrc,adst));
      ignored.addAll(asrcs);
    }
  }
  Set<ITree> srcIgnored=new HashSet<>();
  Set<ITree> dstIgnored=new HashSet<>();
  Collections.sort(ambiguousList,new SiblingsMappingComparator(ambiguousList,mappings,getMaxTreeSize()));
  retainBestMapping(ambiguousList,srcIgnored,dstIgnored);
}
Program: 31577
Project: 31577
Buggy source:
public void filterMappings(MultiMappingStore multiMappings){
  List<MultiMappingStore> ambiguousList=new ArrayList<>();
  Set<ITree> ignored=new HashSet<>();
  for (  ITree src : multiMappings.getSrcs())   if (multiMappings.isSrcUnique(src))   addMappingRecursively(src,multiMappings.getDst(src).iterator().next());
 else   if (!ignored.contains(src)) {
    MultiMappingStore ambiguous=new MultiMappingStore();
    Set<ITree> adsts=multiMappings.getDst(src);
    Set<ITree> asrcs=multiMappings.getSrc(multiMappings.getDst(src).iterator().next());
    for (    ITree asrc : asrcs)     for (    ITree adst : adsts)     ambiguous.link(asrc,adst);
    ambiguousList.add(ambiguous);
    ignored.addAll(asrcs);
  }
  Collections.sort(ambiguousList,new MultiMappingComparator());
  for (  MultiMappingStore ambiguous : ambiguousList) {
    System.out.println("String_Node_Str");
    List<ITree> lstSrcs=new ArrayList<>(ambiguous.getSrcs());
    List<ITree> lstDsts=new ArrayList<>(ambiguous.getDsts());
    double[][] matrix=new double[lstSrcs.size()][lstDsts.size()];
    for (int i=0; i < lstSrcs.size(); i++)     for (int j=0; j < lstDsts.size(); j++)     matrix[i][j]=cost(lstSrcs.get(i),lstDsts.get(j));
    HungarianAlgorithm hgAlg=new HungarianAlgorithm(matrix);
    int[] solutions=hgAlg.execute();
    for (int i=0; i < solutions.length; i++) {
      int dstIdx=solutions[i];
      if (dstIdx != -1)       addMappingRecursively(lstSrcs.get(i),lstDsts.get(dstIdx));
    }
  }
}

Fixed version (ground truth):
@Override public void filterMappings(MultiMappingStore multiMappings){
  List<MultiMappingStore> ambiguousList=new ArrayList<>();
  Set<ITree> ignored=new HashSet<>();
  for (  ITree src : multiMappings.getSrcs())   if (multiMappings.isSrcUnique(src))   addMappingRecursively(src,multiMappings.getDst(src).iterator().next());
 else   if (!ignored.contains(src)) {
    MultiMappingStore ambiguous=new MultiMappingStore();
    Set<ITree> adsts=multiMappings.getDst(src);
    Set<ITree> asrcs=multiMappings.getSrc(multiMappings.getDst(src).iterator().next());
    for (    ITree asrc : asrcs)     for (    ITree adst : adsts)     ambiguous.link(asrc,adst);
    ambiguousList.add(ambiguous);
    ignored.addAll(asrcs);
  }
  Collections.sort(ambiguousList,new MultiMappingComparator());
  for (  MultiMappingStore ambiguous : ambiguousList) {
    System.out.println("String_Node_Str");
    List<ITree> lstSrcs=new ArrayList<>(ambiguous.getSrcs());
    List<ITree> lstDsts=new ArrayList<>(ambiguous.getDsts());
    double[][] matrix=new double[lstSrcs.size()][lstDsts.size()];
    for (int i=0; i < lstSrcs.size(); i++)     for (int j=0; j < lstDsts.size(); j++)     matrix[i][j]=cost(lstSrcs.get(i),lstDsts.get(j));
    HungarianAlgorithm hgAlg=new HungarianAlgorithm(matrix);
    int[] solutions=hgAlg.execute();
    for (int i=0; i < solutions.length; i++) {
      int dstIdx=solutions[i];
      if (dstIdx != -1)       addMappingRecursively(lstSrcs.get(i),lstDsts.get(dstIdx));
    }
  }
}
Program: 31578
Project: 31578
Buggy source:
protected double similarity(ITree src,ITree dst){
  return 100D * parentsJaccardSimilarity(src,dst) + 10D * posInParentSimilarity(src,dst) + numberingSimilarity(src,dst);
}

Fixed version (ground truth):
@Override protected double similarity(ITree src,ITree dst){
  return 100D * parentsJaccardSimilarity(src,dst) + 10D * posInParentSimilarity(src,dst) + numberingSimilarity(src,dst);
}
Program: 31579
Project: 31579
Buggy source:
protected double similarity(ITree src,ITree dst){
  return 100D * siblingsJaccardSimilarity(src.getParent(),dst.getParent()) + 10D * posInParentSimilarity(src,dst) + numberingSimilarity(src,dst);
}

Fixed version (ground truth):
@Override protected double similarity(ITree src,ITree dst){
  return 100D * siblingsJaccardSimilarity(src.getParent(),dst.getParent()) + 10D * posInParentSimilarity(src,dst) + numberingSimilarity(src,dst);
}
Program: 31580
Project: 31580
Buggy source:
public int compare(Mapping m1,Mapping m2){
  return Double.compare(similarities.get(m2),similarities.get(m1));
}

Fixed version (ground truth):
public int compare(Mapping m1,Mapping m2){
  if (similarities.get(m2).compareTo(similarities.get(m1)) != 0) {
    return Double.compare(similarities.get(m2),similarities.get(m1));
  }
  if (m1.first.getId() != m2.first.getId()) {
    return Integer.compare(m1.first.getId(),m2.first.getId());
  }
  return Integer.compare(m1.second.getId(),m2.second.getId());
}
Program: 31581
Project: 31581
Buggy source:
@Override public ITree next(){
  ITree val=current;
  while (it.hasNext()) {
    current=it.next();
    if (current.isLeaf())     break;
  }
  return val;
}

Fixed version (ground truth):
@Override public ITree next(){
  ITree val=current;
  while (it.hasNext()) {
    current=it.next();
    if (current.isLeaf())     break;
  }
  if (!it.hasNext()) {
    current=null;
  }
  return val;
}
Program: 31582
Project: 31582
Buggy source:
public static Iterator<ITree> leafIterator(final Iterator<ITree> it){
  return new Iterator<ITree>(){
    ITree current=it.hasNext() ? it.next() : null;
    @Override public boolean hasNext(){
      return current != null;
    }
    @Override public ITree next(){
      ITree val=current;
      while (it.hasNext()) {
        current=it.next();
        if (current.isLeaf())         break;
      }
      return val;
    }
    @Override public void remove(){
      throw new RuntimeException("String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
public static Iterator<ITree> leafIterator(final Iterator<ITree> it){
  return new Iterator<ITree>(){
    ITree current=it.hasNext() ? it.next() : null;
    @Override public boolean hasNext(){
      return current != null;
    }
    @Override public ITree next(){
      ITree val=current;
      while (it.hasNext()) {
        current=it.next();
        if (current.isLeaf())         break;
      }
      if (!it.hasNext()) {
        current=null;
      }
      return val;
    }
    @Override public void remove(){
      throw new RuntimeException("String_Node_Str");
    }
  }
;
}
Program: 31583
Project: 31583
Buggy source:
@Override public void match(){
  List<Mapping> leavesMappings=new LinkedList<>();
  List<ITree> dstLeaves=retainLeaves(TreeUtils.postOrder(dst));
  for (Iterator<ITree> srcLeaves=TreeUtils.leafIterator(TreeUtils.postOrderIterator(src)); srcLeaves.hasNext(); ) {
    for (    ITree dstLeaf : dstLeaves) {
      ITree srcLeaf=srcLeaves.next();
      if (isMappingAllowed(srcLeaf,dstLeaf)) {
        double sim=StringMetrics.qGramsDistance().compare(srcLeaf.getLabel(),dstLeaf.getLabel());
        if (sim > LABEL_SIM_THRESHOLD)         leavesMappings.add(new Mapping(srcLeaf,dstLeaf));
      }
    }
  }
  Set<ITree> ignoredSrcTrees=new HashSet<>();
  Set<ITree> ignoredDstTrees=new HashSet<>();
  Collections.sort(leavesMappings,new LeafMappingComparator());
  while (leavesMappings.size() > 0) {
    Mapping bestMapping=leavesMappings.remove(0);
    if (!(ignoredSrcTrees.contains(bestMapping.getFirst()) || ignoredDstTrees.contains(bestMapping.getSecond()))) {
      addMapping(bestMapping.getFirst(),bestMapping.getSecond());
      ignoredSrcTrees.add(bestMapping.getFirst());
      ignoredDstTrees.add(bestMapping.getSecond());
    }
  }
}

Fixed version (ground truth):
@Override public void match(){
  List<Mapping> leavesMappings=new LinkedList<>();
  List<ITree> dstLeaves=retainLeaves(TreeUtils.postOrder(dst));
  for (Iterator<ITree> srcLeaves=TreeUtils.leafIterator(TreeUtils.postOrderIterator(src)); srcLeaves.hasNext(); ) {
    ITree srcLeaf=srcLeaves.next();
    for (    ITree dstLeaf : dstLeaves) {
      if (isMappingAllowed(srcLeaf,dstLeaf)) {
        double sim=StringMetrics.qGramsDistance().compare(srcLeaf.getLabel(),dstLeaf.getLabel());
        if (sim > LABEL_SIM_THRESHOLD)         leavesMappings.add(new Mapping(srcLeaf,dstLeaf));
      }
    }
  }
  Set<ITree> ignoredSrcTrees=new HashSet<>();
  Set<ITree> ignoredDstTrees=new HashSet<>();
  Collections.sort(leavesMappings,new LeafMappingComparator());
  while (leavesMappings.size() > 0) {
    Mapping bestMapping=leavesMappings.remove(0);
    if (!(ignoredSrcTrees.contains(bestMapping.getFirst()) || ignoredDstTrees.contains(bestMapping.getSecond()))) {
      addMapping(bestMapping.getFirst(),bestMapping.getSecond());
      ignoredSrcTrees.add(bestMapping.getFirst());
      ignoredDstTrees.add(bestMapping.getSecond());
    }
  }
}
Program: 31584
Project: 31584
Buggy source:
public int compare(Mapping m1,Mapping m2){
  return Double.compare(similarities.get(m2),similarities.get(m1));
}

Fixed version (ground truth):
public int compare(Mapping m1,Mapping m2){
  if (similarities.get(m2).compareTo(similarities.get(m1)) != 0) {
    return Double.compare(similarities.get(m2),similarities.get(m1));
  }
  if (m1.first.getId() != m2.first.getId()) {
    return Integer.compare(m1.first.getId(),m2.first.getId());
  }
  return Integer.compare(m1.second.getId(),m2.second.getId());
}
Program: 31585
Project: 31585
Buggy source:
@Override public ITree next(){
  ITree val=current;
  while (it.hasNext()) {
    current=it.next();
    if (current.isLeaf())     break;
  }
  return val;
}

Fixed version (ground truth):
@Override public ITree next(){
  ITree val=current;
  while (it.hasNext()) {
    current=it.next();
    if (current.isLeaf())     break;
  }
  if (!it.hasNext()) {
    current=null;
  }
  return val;
}
Program: 31586
Project: 31586
Buggy source:
public static Iterator<ITree> leafIterator(final Iterator<ITree> it){
  return new Iterator<ITree>(){
    ITree current=it.hasNext() ? it.next() : null;
    @Override public boolean hasNext(){
      return current != null;
    }
    @Override public ITree next(){
      ITree val=current;
      while (it.hasNext()) {
        current=it.next();
        if (current.isLeaf())         break;
      }
      return val;
    }
    @Override public void remove(){
      throw new RuntimeException("String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
public static Iterator<ITree> leafIterator(final Iterator<ITree> it){
  return new Iterator<ITree>(){
    ITree current=it.hasNext() ? it.next() : null;
    @Override public boolean hasNext(){
      return current != null;
    }
    @Override public ITree next(){
      ITree val=current;
      while (it.hasNext()) {
        current=it.next();
        if (current.isLeaf())         break;
      }
      if (!it.hasNext()) {
        current=null;
      }
      return val;
    }
    @Override public void remove(){
      throw new RuntimeException("String_Node_Str");
    }
  }
;
}