nus-yam/ex-repair huggingface dataset:
Program: 170214
Project: 170214
Buggy source:
private void popQueueFragment(){
  mActivity.getSupportFragmentManager().beginTransaction().remove(mActivity.getSupportFragmentManager().findFragmentByTag("String_Node_Str")).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE).commit();
  onQueueVisibilityChanged(false);
}

Fixed version (ground truth):
public void popQueueFragment(){
  mActivity.getSupportFragmentManager().beginTransaction().remove(mActivity.getSupportFragmentManager().findFragmentByTag("String_Node_Str")).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE).commit();
  onQueueVisibilityChanged(false);
}
Program: 170215
Project: 170215
Buggy source:
public void transitionToClosed(){
  mBackground.reverseTransition(TRANSITION_DURATION * 2);
  flipit();
}

Fixed version (ground truth):
public void transitionToClosed(){
  if (isOpen) {
    mBackground.reverseTransition(TRANSITION_DURATION * 2);
    flipit();
    isOpen=false;
  }
}
Program: 170216
Project: 170216
Buggy source:
public void transitionToOpen(){
  mBackground.startTransition(TRANSITION_DURATION * 2);
  flipit();
}

Fixed version (ground truth):
public void transitionToOpen(){
  if (!isOpen) {
    mBackground.startTransition(TRANSITION_DURATION * 2);
    flipit();
    isOpen=true;
  }
}
Program: 170217
Project: 170217
Buggy source:
@Override protected void onFinishInflate(){
  super.onFinishInflate();
  mButtonBarClosed=findViewById(R.id.header_closed_button_bar);
  mButtonBarOpen=findViewById(R.id.header_open_button_bar);
  mButtonBarOpen.setVisibility(GONE);
}

Fixed version (ground truth):
@Override protected void onFinishInflate(){
  super.onFinishInflate();
  mButtonBarClosed=findViewById(R.id.header_closed_button_bar);
  mButtonBarOpen=findViewById(R.id.header_open_button_bar);
  mButtonBarOpen.setVisibility(GONE);
  isOpen=false;
}
Program: 170219
Project: 170219
Buggy source:
static String makeAbsFileName(String current,String parent){
  if (current.equals("String_Node_Str"))   return parent;
  if (current.startsWith("String_Node_Str"))   return current;
  if (current.length() < 2 || current.substring(1,2).equals("String_Node_Str"))   return current;
  String cur=current.replace('\\','/');
  String par=parent.replace('\\','/');
  int k=0;
  int m=0;
  while (true) {
    if (cur.length() >= 3 && cur.substring(k,k + 3).equals("String_Node_Str")) {
      k+=3;
      m++;
      continue;
    }
    if (cur.length() >= 2 && cur.substring(k,k + 2).equals("String_Node_Str")) {
      k+=2;
      m++;
      continue;
    }
    break;
  }
  for (int n=0; n < m; n++) {
    int j=par.lastIndexOf("String_Node_Str");
    if (j == -1)     return current;
    par=par.substring(0,j);
  }
  return par + "String_Node_Str" + cur.substring(k);
}

Fixed version (ground truth):
static String makeAbsFileName(String current,String parent){
  if (current.equals("String_Node_Str"))   return parent;
  if (current.startsWith("String_Node_Str"))   return current;
  if (current.length() > 1 && current.substring(1,2).equals("String_Node_Str"))   return current;
  String cur=current.replace('\\','/');
  String par=parent.replace('\\','/');
  int k=0;
  int m=0;
  while (true) {
    if (cur.length() >= 3 && cur.substring(k,k + 3).equals("String_Node_Str")) {
      k+=3;
      m++;
      continue;
    }
    if (cur.length() >= 2 && cur.substring(k,k + 2).equals("String_Node_Str")) {
      k+=2;
      m++;
      continue;
    }
    break;
  }
  for (int n=0; n < m; n++) {
    int j=par.lastIndexOf("String_Node_Str");
    if (j == -1)     return current;
    par=par.substring(0,j);
  }
  return par + "String_Node_Str" + cur.substring(k);
}
Program: 170222
Project: 170222
Buggy source:
boolean matchArrow(int x,int y,Arrow arrow){
  int x1=arrow.fromX;
  int y1=arrow.fromY;
  int x2, y2;
  if (arrow.bends != null) {
    for (    Bend bend : arrow.bends) {
      x2=bend.x;
      y2=bend.y;
      if (driver.nearpln(x,y,x1,y1,x2,y2)) {
        return true;
      }
 else {
        x1=bend.x;
        y1=bend.y;
      }
    }
  }
  x2=arrow.toX;
  y2=arrow.toY;
  return driver.nearpln(x,y,x1,y1,x2,y2);
}

Fixed version (ground truth):
boolean matchArrow(int x,int y,Arrow arrow){
  int x1=arrow.fromX;
  int y1=arrow.fromY;
  int x2, y2;
  if (arrow.bends != null) {
    for (    Bend bend : arrow.bends) {
      x2=bend.x;
      y2=bend.y;
      if (driver.nearpln(x,y,x1,y1,x2,y2))       return true;
      x1=x2;
      y1=y2;
    }
  }
  x2=arrow.toX;
  y2=arrow.toY;
  return driver.nearpln(x,y,x1,y1,x2,y2);
}
Program: 170225
Project: 170225
Buggy source:
public void componentResized(ComponentEvent e){
}

Fixed version (ground truth):
public void componentResized(ComponentEvent e){
  Dimension dim=this.getSize();
  Dimension dim2=new Dimension(dim.width / but.length,dim.height);
  int no=but.length;
  for (int j=0; j < no; j++) {
    box21.remove(0);
    but[j].setMaximumSize(dim2);
    box21.add(but[j]);
  }
  box21.repaint();
}
Program: 170226
Project: 170226
Buggy source:
public void paintList(){
  if (selComp instanceof JList) {
    String s=list.getSelectedValue();
    if (s == null || s.equals("String_Node_Str"))     s="String_Node_Str";
    String fn=DrawFBP.makeAbsFileName(s,listHead);
    if (currentNode == null) {
      File h=new File(fn);
      t_dirName.setText(listHead);
    }
 else {
      DefaultMutableTreeNode ch=currentNode;
      if (ch.getChildCount() > 0) {
        t_dirName.setText(listHead);
      }
 else {
        t_dirName.setText(listHead);
      }
    }
  }
  repaint();
}

Fixed version (ground truth):
public void paintList(){
  if (selComp instanceof JList) {
    String s=list.getSelectedValue();
    if (s == null || s.equals("String_Node_Str"))     s="String_Node_Str";
    String fn=DrawFBP.makeAbsFileName(s,listHead);
    if (currentNode == null) {
      File h=new File(fn);
      t_dirName.setText(listHead);
    }
 else {
      DefaultMutableTreeNode ch=currentNode;
      if (ch.getChildCount() > 0) {
        t_dirName.setText(listHead);
      }
 else {
        t_fileName.setText(list.getSelectedValue());
        t_dirName.setText(listHead);
        selComp=t_fileName;
      }
    }
  }
  repaint();
}
Program: 170227
Project: 170227
Buggy source:
public void keyPressed(KeyEvent ev){
  if (ev.getKeyCode() == KeyEvent.VK_ESCAPE) {
    popup.dispose();
  }
}

Fixed version (ground truth):
public void keyPressed(KeyEvent ev){
  if (ev.getKeyCode() == KeyEvent.VK_ESCAPE) {
    jDialog.dispose();
  }
}
Program: 170228
Project: 170228
Buggy source:
public void valueChanged(ListSelectionEvent e){
  @SuppressWarnings("String_Node_Str") JList<String> l=(JList<String>)e.getSource();
  int i=l.getSelectedIndex();
  if (i > -1) {
    if (l == jlF) {
      fixedFont=fixedFonts[i];
      fFChanged=true;
      MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str" + fixedFont + "String_Node_Str");
      lb1.setText("String_Node_Str" + fixedFont + "String_Node_Str");
      lb1.repaint();
    }
 else {
      generalFont=generalFonts[i];
      gFChanged=true;
      MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str" + generalFont + "String_Node_Str");
      lb2.setText("String_Node_Str" + generalFont + "String_Node_Str");
      lb2.repaint();
    }
    popup.repaint();
  }
}

Fixed version (ground truth):
public void valueChanged(ListSelectionEvent e){
  @SuppressWarnings("String_Node_Str") JList<String> l=(JList<String>)e.getSource();
  int i=l.getSelectedIndex();
  if (i > -1) {
    if (l == jlF) {
      fixedFont=fixedFonts[i];
      fFChanged=true;
      MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str" + fixedFont + "String_Node_Str");
      lb1.setText("String_Node_Str" + fixedFont + "String_Node_Str");
      lb1.repaint();
    }
 else {
      generalFont=generalFonts[i];
      gFChanged=true;
      MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str" + generalFont + "String_Node_Str");
      lb2.setText("String_Node_Str" + generalFont + "String_Node_Str");
      lb2.repaint();
    }
    jDialog.repaint();
  }
}
Program: 170229
Project: 170229
Buggy source:
void done(){
  popup.setVisible(false);
  driver.frame.repaint();
}

Fixed version (ground truth):
void done(){
  jDialog.setVisible(false);
  driver.frame.repaint();
}
Program: 170231
Project: 170231
Buggy source:
public void windowClosed(WindowEvent arg0){
  popup.setVisible(false);
}

Fixed version (ground truth):
public void windowClosed(WindowEvent arg0){
  jDialog.setVisible(false);
}
Program: 170233
Project: 170233
Buggy source:
public void windowClosing(WindowEvent e){
  popup.setVisible(false);
}

Fixed version (ground truth):
public void windowClosing(WindowEvent e){
  jDialog.setVisible(false);
}
Program: 170235
Project: 170235
Buggy source:
void drawIn(Graphics2D g,int ctr,int w){
  int ptx[]=new int[7];
  int pty[]=new int[7];
  int left=ctr - w / 2;
  int right=ctr + w / 2;
  int top=cy - height / 2;
  int bottom=cy + height / 2;
  ptx[0]=left;
  pty[0]=top;
  ptx[1]=right - 10;
  pty[1]=top;
  ptx[2]=right;
  pty[2]=cy;
  ptx[3]=right - 10;
  pty[3]=bottom;
  ptx[4]=left;
  pty[4]=bottom;
  ptx[5]=left;
  pty[5]=bottom - 6;
  ptx[6]=left;
  pty[6]=top + 6;
  g.setColor(Color.BLACK);
  g.drawPolygon(ptx,pty,7);
  if (this == driver.selBlock)   g.setColor(new Color(255,255,200));
 else   g.setColor(new Color(200,255,255));
  ptx[0]+=1;
  pty[0]+=1;
  ptx[1]-=1;
  pty[1]+=1;
  ptx[2]-=1;
  ptx[3]-=1;
  ptx[4]+=1;
  ptx[5]+=1;
  ptx[6]+=1;
  g.fillPolygon(ptx,pty,7);
  if (substreamSensitive) {
    int ptx2[]=new int[3];
    int pty2[]=new int[3];
    ptx2[0]=right - 10;
    ptx2[1]=right;
    ptx2[2]=right - 10;
    pty2[0]=top;
    pty2[1]=cy;
    pty2[2]=bottom;
    g.setColor(Color.RED);
    g.drawPolygon(ptx2,pty2,3);
    g.fillPolygon(ptx2,pty2,3);
  }
  g.setColor(Color.BLACK);
  g.drawLine(left,cy - height,left,cy + height);
  calcDiagMaxAndMin(left,right,top,bottom);
}

Fixed version (ground truth):
void drawIn(Graphics2D g,int ctr,int w){
  int ptx[]=new int[7];
  int pty[]=new int[7];
  int left=ctr - w / 2;
  int right=ctr + w / 2;
  int top=cy - height / 2;
  int bottom=cy + height / 2;
  ptx[0]=left;
  pty[0]=top;
  ptx[1]=right - 10;
  pty[1]=top;
  ptx[2]=right;
  pty[2]=cy;
  ptx[3]=right - 10;
  pty[3]=bottom;
  ptx[4]=left;
  pty[4]=bottom;
  ptx[5]=left;
  pty[5]=bottom - 6;
  ptx[6]=left;
  pty[6]=top + 6;
  g.setColor(Color.BLACK);
  g.drawPolygon(ptx,pty,7);
  if (this == driver.selBlock)   g.setColor(ly);
 else   g.setColor(lb);
  ptx[0]+=1;
  pty[0]+=1;
  ptx[1]-=1;
  pty[1]+=1;
  ptx[2]-=1;
  ptx[3]-=1;
  ptx[4]+=1;
  ptx[5]+=1;
  ptx[6]+=1;
  g.fillPolygon(ptx,pty,7);
  if (substreamSensitive) {
    int ptx2[]=new int[3];
    int pty2[]=new int[3];
    ptx2[0]=right - 10;
    ptx2[1]=right;
    ptx2[2]=right - 10;
    pty2[0]=top;
    pty2[1]=cy;
    pty2[2]=bottom;
    g.setColor(Color.BLUE);
    g.drawPolygon(ptx2,pty2,3);
    g.fillPolygon(ptx2,pty2,3);
  }
  g.setColor(Color.BLACK);
  g.drawLine(left,cy - height,left,cy + height);
  calcDiagMaxAndMin(left,right,top,bottom);
}
Program: 170236
Project: 170236
Buggy source:
void drawOut(Graphics2D g,int ctr,int w){
  int ptx[]=new int[7];
  int pty[]=new int[7];
  int left=ctr - w / 2;
  int right=ctr + w / 2;
  int top=cy - height / 2;
  int bottom=cy + height / 2;
  ptx[0]=right;
  pty[0]=top;
  ptx[1]=right;
  pty[1]=top + 6;
  ptx[2]=right;
  pty[2]=bottom - 6;
  ptx[3]=right;
  pty[3]=bottom;
  ptx[4]=left + 10;
  pty[4]=bottom;
  ptx[5]=left;
  pty[5]=cy;
  ptx[6]=left + 10;
  pty[6]=top;
  g.setColor(Color.BLACK);
  g.drawPolygon(ptx,pty,7);
  if (this == driver.selBlock)   g.setColor(new Color(255,255,200));
 else   g.setColor(new Color(200,255,255));
  ptx[0]-=1;
  pty[0]+=1;
  ptx[1]-=1;
  pty[1]+=1;
  ptx[2]-=1;
  ptx[3]-=1;
  ptx[4]+=1;
  ptx[5]+=1;
  ptx[6]+=1;
  pty[6]+=1;
  g.fillPolygon(ptx,pty,7);
  if (substreamSensitive) {
    g.setColor(Color.RED);
    int ptx2[]=new int[3];
    int pty2[]=new int[3];
    ptx2[0]=left + 10;
    ptx2[1]=left;
    ptx2[2]=left + 10;
    pty2[0]=top;
    pty2[1]=cy;
    pty2[2]=bottom;
    g.setColor(Color.RED);
    g.drawPolygon(ptx2,pty2,3);
    g.fillPolygon(ptx2,pty2,3);
  }
  g.setColor(Color.BLACK);
  if (!type.equals(Block.Types.EXTPORT_OUTIN_BLOCK))   g.drawLine(right,cy - height,right,cy + height);
  calcDiagMaxAndMin(left,right,top,bottom);
}

Fixed version (ground truth):
void drawOut(Graphics2D g,int ctr,int w){
  int ptx[]=new int[7];
  int pty[]=new int[7];
  int left=ctr - w / 2;
  int right=ctr + w / 2;
  int top=cy - height / 2;
  int bottom=cy + height / 2;
  ptx[0]=right;
  pty[0]=top;
  ptx[1]=right;
  pty[1]=top + 6;
  ptx[2]=right;
  pty[2]=bottom - 6;
  ptx[3]=right;
  pty[3]=bottom;
  ptx[4]=left + 10;
  pty[4]=bottom;
  ptx[5]=left;
  pty[5]=cy;
  ptx[6]=left + 10;
  pty[6]=top;
  g.setColor(Color.BLACK);
  g.drawPolygon(ptx,pty,7);
  if (this == driver.selBlock)   g.setColor(ly);
 else   g.setColor(lb);
  ptx[0]-=1;
  pty[0]+=1;
  ptx[1]-=1;
  pty[1]+=1;
  ptx[2]-=1;
  ptx[3]-=1;
  ptx[4]+=1;
  ptx[5]+=1;
  ptx[6]+=1;
  pty[6]+=1;
  g.fillPolygon(ptx,pty,7);
  if (substreamSensitive) {
    int ptx2[]=new int[3];
    int pty2[]=new int[3];
    ptx2[0]=left + 10;
    ptx2[1]=left;
    ptx2[2]=left + 10;
    pty2[0]=top;
    pty2[1]=cy;
    pty2[2]=bottom;
    g.setColor(Color.BLUE);
    g.drawPolygon(ptx2,pty2,3);
    g.fillPolygon(ptx2,pty2,3);
  }
  g.setColor(Color.BLACK);
  if (!type.equals(Block.Types.EXTPORT_OUTIN_BLOCK))   g.drawLine(right,cy - height,right,cy + height);
  calcDiagMaxAndMin(left,right,top,bottom);
}
Program: 170237
Project: 170237
Buggy source:
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  GeneralPath gp=new GeneralPath();
  g.setColor(Color.BLACK);
  int x=cx - width / 2;
  int y=cy - height / 2 + 4;
  gp.moveTo(x,y);
  x+=width;
  gp.quadTo(x - width / 2,y - 10,x,y);
  y+=height - 8;
  gp.lineTo(x,y);
  x-=width;
  gp.quadTo(x + width / 2,y + 10,x,y);
  gp.closePath();
  if (this == driver.selBlock)   g.setColor(new Color(255,255,200));
 else   g.setColor(new Color(200,255,255));
  g.fill(gp);
  g.setColor(Color.BLACK);
  g.draw(gp);
  y=cy - height + height / 2 - 8;
  x=cx - width / 2;
  g.drawArc(x,y,width,20,190,160);
  if (description != null) {
    centreDesc(g);
  }
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
}

Fixed version (ground truth):
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  GeneralPath gp=new GeneralPath();
  g.setColor(Color.BLACK);
  int x=cx - width / 2;
  int y=cy - height / 2 + 4;
  gp.moveTo(x,y);
  x+=width;
  gp.quadTo(x - width / 2,y - 10,x,y);
  y+=height - 8;
  gp.lineTo(x,y);
  x-=width;
  gp.quadTo(x + width / 2,y + 10,x,y);
  gp.closePath();
  if (this == driver.selBlock)   g.setColor(ly);
 else   g.setColor(lb);
  g.fill(gp);
  g.setColor(Color.BLACK);
  g.draw(gp);
  y=cy - height + height / 2 - 8;
  x=cx - width / 2;
  g.drawArc(x,y,width,20,190,160);
  if (description != null) {
    centreDesc(g);
  }
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
}
Program: 170238
Project: 170238
Buggy source:
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  Font fontsave=g.getFont();
  g.setFont(driver.fontf);
  g.setColor(Color.GRAY);
  if (description != null) {
    FontMetrics metrics=g.getFontMetrics(g.getFont());
    width=4;
    for (int j=0; j < description.length(); j++) {
      width+=metrics.charWidth(description.charAt(j));
    }
  }
  g.drawRoundRect(cx - width / 2,cy - height / 2,width,height,6,6);
  if (this == driver.selBlock)   g.setColor(new Color(255,255,200));
 else   g.setColor(new Color(200,255,255));
  g.fillRoundRect(cx - width / 2 + 1,cy - height / 2 + 1,width - 1,height - 1,6,6);
  g.setColor(Color.GRAY);
  if (description != null) {
    g.setColor(Color.GRAY);
    g.drawString(description,cx - width / 2 + 4,cy + 4);
  }
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
  g.setFont(fontsave);
}

Fixed version (ground truth):
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  Font fontsave=g.getFont();
  g.setFont(driver.fontf);
  g.setColor(Color.GRAY);
  if (description != null) {
    FontMetrics metrics=g.getFontMetrics(g.getFont());
    width=4;
    for (int j=0; j < description.length(); j++) {
      width+=metrics.charWidth(description.charAt(j));
    }
  }
  g.drawRoundRect(cx - width / 2,cy - height / 2,width,height,6,6);
  if (this == driver.selBlock)   g.setColor(ly);
 else   g.setColor(lb);
  g.fillRoundRect(cx - width / 2 + 1,cy - height / 2 + 1,width - 1,height - 1,6,6);
  g.setColor(Color.GRAY);
  if (description != null) {
    g.setColor(Color.GRAY);
    g.drawString(description,cx - width / 2 + 4,cy + 4);
  }
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
  g.setFont(fontsave);
}
Program: 170239
Project: 170239
Buggy source:
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  g.setColor(Color.LIGHT_GRAY);
  g.fillRect(cx - width / 2,cy - height / 2,width,height);
  g.setColor(Color.BLACK);
  g.drawOval(cx - 8,cy - height / 2 + 2,16,20);
  if (this == driver.selBlock)   g.setColor(new Color(255,255,200));
 else   g.setColor(new Color(200,255,255));
  g.fillOval(cx - 7,cy - height / 2 + 3,14,18);
  g.setColor(Color.BLACK);
  g.drawLine(cx,cy - height / 2 + 20,cx,cy + 4);
  g.drawLine(cx,cy + 4,cx - 12,cy + height / 2);
  g.drawLine(cx,cy + 4,cx + 12,cy + height / 2);
  g.drawLine(cx,cy - 2,cx - 14,cy + 5);
  g.drawLine(cx,cy - 2,cx + 14,cy + 5);
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
  if (description != null) {
    centreDesc(g);
  }
}

Fixed version (ground truth):
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  g.setColor(Color.LIGHT_GRAY);
  g.fillRect(cx - width / 2,cy - height / 2,width,height);
  g.setColor(Color.BLACK);
  g.drawOval(cx - 8,cy - height / 2 + 2,16,20);
  if (this == driver.selBlock)   g.setColor(ly);
 else   g.setColor(lb);
  g.fillOval(cx - 7,cy - height / 2 + 3,14,18);
  g.setColor(Color.BLACK);
  g.drawLine(cx,cy - height / 2 + 20,cx,cy + 4);
  g.drawLine(cx,cy + 4,cx - 12,cy + height / 2);
  g.drawLine(cx,cy + 4,cx + 12,cy + height / 2);
  g.drawLine(cx,cy - 2,cx - 14,cy + 5);
  g.drawLine(cx,cy - 2,cx + 14,cy + 5);
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
  if (description != null) {
    centreDesc(g);
  }
}
Program: 170240
Project: 170240
Buggy source:
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  int ptx[]=new int[11];
  int pty[]=new int[11];
  int left, right, top, bottom;
  left=cx - width / 2;
  right=cx + width / 2;
  top=cy - height / 2;
  bottom=cy + height / 2;
  ptx[0]=left;
  pty[0]=bottom;
  ptx[1]=left;
  pty[1]=top;
  ptx[2]=right;
  pty[2]=top;
  int xt=right;
  int yt=bottom - height / 4;
  ptx[3]=xt;
  pty[3]=yt;
  xt-=width / 4;
  yt+=height / 32;
  ptx[4]=xt;
  pty[4]=yt;
  xt-=width / 8;
  yt+=height / 24;
  ptx[5]=xt;
  pty[5]=yt;
  xt-=width / 8;
  yt+=height / 16;
  ptx[6]=xt;
  pty[6]=yt;
  xt-=width / 8;
  yt+=height / 16;
  ptx[7]=xt;
  pty[7]=yt;
  xt-=width / 12;
  yt+=height / 20;
  ptx[8]=xt;
  pty[8]=yt;
  xt-=width / 16;
  yt+=1;
  ptx[9]=xt;
  pty[9]=yt;
  xt-=width / 16;
  yt+=1;
  ptx[10]=xt;
  pty[10]=yt;
  g.setColor(Color.BLACK);
  g.drawPolygon(ptx,pty,11);
  if (this == driver.selBlock)   g.setColor(new Color(255,255,200));
 else   g.setColor(new Color(200,255,255));
  ptx[0]+=1;
  ptx[1]+=1;
  pty[1]+=1;
  pty[2]+=1;
  for (int i=3; i < 11; i++)   pty[i]-=1;
  g.fillPolygon(ptx,pty,11);
  if (description != null) {
    centreDesc(g);
  }
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
}

Fixed version (ground truth):
@Override void draw(Graphics2D g){
  if (!visible && this != driver.selBlock) {
    showZones(g);
    return;
  }
  int ptx[]=new int[11];
  int pty[]=new int[11];
  int left, right, top, bottom;
  left=cx - width / 2;
  right=cx + width / 2;
  top=cy - height / 2;
  bottom=cy + height / 2;
  ptx[0]=left;
  pty[0]=bottom;
  ptx[1]=left;
  pty[1]=top;
  ptx[2]=right;
  pty[2]=top;
  int xt=right;
  int yt=bottom - height / 4;
  ptx[3]=xt;
  pty[3]=yt;
  xt-=width / 4;
  yt+=height / 32;
  ptx[4]=xt;
  pty[4]=yt;
  xt-=width / 8;
  yt+=height / 24;
  ptx[5]=xt;
  pty[5]=yt;
  xt-=width / 8;
  yt+=height / 16;
  ptx[6]=xt;
  pty[6]=yt;
  xt-=width / 8;
  yt+=height / 16;
  ptx[7]=xt;
  pty[7]=yt;
  xt-=width / 12;
  yt+=height / 20;
  ptx[8]=xt;
  pty[8]=yt;
  xt-=width / 16;
  yt+=1;
  ptx[9]=xt;
  pty[9]=yt;
  xt-=width / 16;
  yt+=1;
  ptx[10]=xt;
  pty[10]=yt;
  g.setColor(Color.BLACK);
  g.drawPolygon(ptx,pty,11);
  if (this == driver.selBlock)   g.setColor(ly);
 else   g.setColor(lb);
  ptx[0]+=1;
  ptx[1]+=1;
  pty[1]+=1;
  pty[2]+=1;
  for (int i=3; i < 11; i++)   pty[i]-=1;
  g.fillPolygon(ptx,pty,11);
  if (description != null) {
    centreDesc(g);
  }
  calcDiagMaxAndMin(cx - width / 2,cx + width / 2,cy - height / 2,cy + height / 2);
}
Program: 170242
Project: 170242
Buggy source:
public boolean askAboutSaving(){
  String fileString=null;
  String name;
  if (changed) {
    if (title == null)     name="String_Node_Str";
 else {
      name=title;
      if (!name.toLowerCase().endsWith("String_Node_Str"))       name+="String_Node_Str";
    }
    int answer=MyOptionPane.showConfirmDialog(driver.frame,"String_Node_Str" + name + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);
    File file=null;
    if (answer == JOptionPane.YES_OPTION) {
      if (diagFile == null) {
        file=genSave(null,fCPArr[DrawFBP.DIAGRAM],name);
        if (file == null) {
          MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str");
          return false;
        }
      }
 else {
        file=diagFile;
        fileString=buildFile();
        writeFile(file,fileString);
      }
      File currentDiagramDir=file.getParentFile();
      driver.properties.put("String_Node_Str",currentDiagramDir.getAbsolutePath());
      driver.propertiesChanged=true;
      return true;
    }
    if (answer == JOptionPane.NO_OPTION)     return true;
 else     return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean askAboutSaving(){
  String fileString=null;
  String name;
  boolean res=true;
  if (changed) {
    if (title == null)     name="String_Node_Str";
 else {
      name=title;
      if (!name.toLowerCase().endsWith("String_Node_Str"))       name+="String_Node_Str";
    }
    int answer=MyOptionPane.showConfirmDialog(driver.frame,"String_Node_Str" + name + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);
    File file=null;
    if (answer == JOptionPane.YES_OPTION) {
      if (diagFile == null) {
        file=genSave(null,fCPArr[DrawFBP.DIAGRAM],name);
        if (file == null) {
          MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str");
          res=false;
        }
      }
 else {
        file=diagFile;
        fileString=buildFile();
        writeFile(file,fileString);
      }
    }
    if (answer != JOptionPane.NO_OPTION)     res=false;
  }
  File currentDiagramDir=null;
  if (diagFile != null) {
    currentDiagramDir=diagFile.getParentFile();
    driver.properties.put("String_Node_Str",currentDiagramDir.getAbsolutePath());
    if (res)     driver.properties.put("String_Node_Str",diagFile.getAbsolutePath());
 else     driver.properties.remove("String_Node_Str");
  }
  String t=Integer.toString(driver.frame.getX());
  driver.properties.put("String_Node_Str",t);
  t=Integer.toString(driver.frame.getY());
  driver.properties.put("String_Node_Str",t);
  t=Integer.toString(driver.frame.getWidth());
  driver.properties.put("String_Node_Str",t);
  t=Integer.toString(driver.frame.getHeight());
  driver.properties.put("String_Node_Str",t);
  driver.propertiesChanged=true;
  return res;
}
Program: 170243
Project: 170243
Buggy source:
Diagram(DrawFBP drawFBP){
  driver=drawFBP;
  blocks=new HashMap<Integer,Block>();
  arrows=new HashMap<Integer,Arrow>();
  clickToGrid=true;
  driver.grid.setSelected(clickToGrid);
  diagLang=driver.defaultCompLang;
  for (int i=0; i < fCPArr.length; i++) {
    fCPArr[i]=driver.fCPArray[i];
  }
  fCPArr[DrawFBP.CLASS]=driver.new FileChooserParms("String_Node_Str","String_Node_Str","String_Node_Str",driver.new JavaClassFilter(),"String_Node_Str");
  fCPArr[DrawFBP.PROCESS]=driver.new FileChooserParms(diagLang.srcDirProp,"String_Node_Str" + diagLang.showLangs() + "String_Node_Str",diagLang.suggExtn,diagLang.filter,"String_Node_Str" + diagLang.showLangs() + "String_Node_Str"+ diagLang.showSuffixes());
  fCPArr[DrawFBP.GENCODE]=driver.new FileChooserParms(diagLang.netDirProp,"String_Node_Str","String_Node_Str" + diagLang.suggExtn,diagLang.filter,diagLang.showLangs());
}

Fixed version (ground truth):
Diagram(DrawFBP drawFBP){
  driver=drawFBP;
  blocks=new ConcurrentHashMap<Integer,Block>();
  arrows=new ConcurrentHashMap<Integer,Arrow>();
  clickToGrid=true;
  driver.grid.setSelected(clickToGrid);
  diagLang=driver.defaultCompLang;
  for (int i=0; i < fCPArr.length; i++) {
    fCPArr[i]=driver.fCPArray[i];
  }
  fCPArr[DrawFBP.CLASS]=driver.new FileChooserParms("String_Node_Str","String_Node_Str","String_Node_Str",driver.new JavaClassFilter(),"String_Node_Str");
  fCPArr[DrawFBP.PROCESS]=driver.new FileChooserParms(diagLang.srcDirProp,"String_Node_Str" + diagLang.showLangs() + "String_Node_Str",diagLang.suggExtn,diagLang.filter,"String_Node_Str" + diagLang.showLangs() + "String_Node_Str"+ diagLang.showSuffixes());
  fCPArr[DrawFBP.GENCODE]=driver.new FileChooserParms(diagLang.netDirProp,"String_Node_Str","String_Node_Str" + diagLang.suggExtn,diagLang.filter,diagLang.showLangs());
}
Program: 170245
Project: 170245
Buggy source:
LinkedList<String> mySort(LinkedList<String> from){
  if (from.isEmpty()) {
    return new LinkedList<String>();
  }
  int low_x=0;
  LinkedList<String> lkl=new LinkedList<String>();
  while (true) {
    try {
      String low=from.getFirst();
      int i=0;
      for (      String s : from) {
        if (s.compareToIgnoreCase(low) == -1) {
          low=s;
          low_x=i;
        }
      }
      lkl.add(low);
      from.remove(low_x);
    }
 catch (    NoSuchElementException e) {
      return lkl;
    }
  }
}

Fixed version (ground truth):
LinkedList<String> mySort(LinkedList<String> from){
  if (from.isEmpty()) {
    return new LinkedList<String>();
  }
  LinkedList<String> ll=from;
  LinkedList<String> lkl=new LinkedList<String>();
  while (true) {
    try {
      String low=ll.getFirst();
      int i=0;
      int low_i=0;
      for (      String s : ll) {
        if (i > 0 && s.compareToIgnoreCase(low) < 0) {
          low=s;
          low_i=i;
        }
        i++;
      }
      lkl.add(low);
      ll.remove(low_i);
    }
 catch (    NoSuchElementException e) {
      return lkl;
    }
  }
}
Program: 170248
Project: 170248
Buggy source:
void writePropertiesFile(){
  BufferedWriter out=null;
  try {
    out=new BufferedWriter(new FileWriter(propertiesFile));
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    for (    String k : properties.keySet()) {
      if (k.startsWith("String_Node_Str"))       continue;
      String s="String_Node_Str" + k + "String_Node_Str"+ properties.get(k)+ "String_Node_Str"+ k+ "String_Node_Str";
      out.write(s);
    }
    out.write("String_Node_Str");
    out.flush();
    out.close();
  }
 catch (  FileNotFoundException ex) {
    ex.printStackTrace();
  }
catch (  IOException ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
void writePropertiesFile(){
  BufferedWriter out=null;
  try {
    out=new BufferedWriter(new FileWriter(propertiesFile));
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    for (    String k : properties.keySet()) {
      if (k.startsWith("String_Node_Str") || k.startsWith("String_Node_Str"))       continue;
      String s="String_Node_Str" + k + "String_Node_Str"+ properties.get(k)+ "String_Node_Str"+ k+ "String_Node_Str";
      out.write(s);
    }
    Iterator entries=jarFiles.entrySet().iterator();
    String z="String_Node_Str";
    String cma="String_Node_Str";
    boolean first=true;
    while (entries.hasNext()) {
      @SuppressWarnings("String_Node_Str") Entry<String,String> thisEntry=(Entry<String,String>)entries.next();
      if (!first) {
        z+=cma + thisEntry.getKey() + "String_Node_Str"+ thisEntry.getValue();
        cma="String_Node_Str";
      }
      first=false;
    }
    properties.put("String_Node_Str",z);
    out.write("String_Node_Str");
    out.flush();
    out.close();
  }
 catch (  FileNotFoundException ex) {
    ex.printStackTrace();
  }
catch (  IOException ex) {
    ex.printStackTrace();
  }
}
Program: 170249
Project: 170249
Buggy source:
public void setSelectedIndex(int i){
  if (i > -1) {
    super.setSelectedIndex(i);
    ButtonTabComponent b=(ButtonTabComponent)getTabComponentAt(i);
    if (b != null) {
      driver.curDiag=b.diag;
      if (driver.curDiag != null && driver.curDiag.diagLang != null && driver.curDiag.diagLang != driver.defaultCompLang) {
        driver.changeLanguage(driver.curDiag.diagLang);
      }
    }
  }
}

Fixed version (ground truth):
public void setSelectedIndex(int i){
  if (i > -1) {
    super.setSelectedIndex(i);
    ButtonTabComponent b=(ButtonTabComponent)getTabComponentAt(i);
    if (b != null && b.diag != null) {
      driver.curDiag=b.diag;
      driver.frame.setTitle("String_Node_Str" + driver.curDiag.title);
      File f=driver.curDiag.diagFile;
      if (f != null) {
        File currentDiagramDir=f.getParentFile();
        driver.properties.put("String_Node_Str",currentDiagramDir.getAbsolutePath());
        driver.propertiesChanged=true;
      }
      if (driver.curDiag != null && driver.curDiag.diagLang != null && driver.curDiag.diagLang != driver.defaultCompLang) {
        driver.changeLanguage(driver.curDiag.diagLang);
      }
    }
  }
}
Program: 170251
Project: 170251
Buggy source:
int testMatch(String port,String type){
  boolean input=(type.indexOf("String_Node_Str") > -1 || type.indexOf("String_Node_Str") > -1);
  boolean output=(type.indexOf("String_Node_Str") > -1);
  if (!input && !output) {
    MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str" + port + "String_Node_Str");
    return 1;
  }
  for (  Arrow arrow : diag.arrows.values()) {
    if (arrow.endsAtLine)     continue;
    if (id == arrow.toId && arrow.downStreamPort != null && stem(arrow.downStreamPort).equals(port))     if (input)     return 0;
 else     return 1;
    if (id == arrow.fromId && arrow.upStreamPort != null && stem(arrow.upStreamPort).equals(port))     if (output)     return 0;
 else     return 1;
  }
  if (input)   return 3;
 else   if (type.indexOf("String_Node_Str") > -1)   return 2;
 else   return 1;
}

Fixed version (ground truth):
int testMatch(String port,String type){
  boolean input=(type.indexOf("String_Node_Str") > -1 || type.indexOf("String_Node_Str") > -1);
  boolean output=(type.indexOf("String_Node_Str") > -1);
  if (!input && !output) {
    MyOptionPane.showMessageDialog(driver.frame,"String_Node_Str" + port + "String_Node_Str");
    return 1;
  }
  for (  Arrow arrow : diag.arrows.values()) {
    Arrow arr=arrow.findTerminalArrow();
    if (id == arr.toId && arr.downStreamPort != null && stem(arr.downStreamPort).equals(port))     if (input)     return 0;
 else     return 1;
    if (id == arrow.fromId && arrow.upStreamPort != null && stem(arrow.upStreamPort).equals(port))     if (output)     return 0;
 else     return 1;
  }
  if (input)   return 3;
 else   if (type.indexOf("String_Node_Str") > -1)   return 2;
 else   return 1;
}
Program: 170252
Project: 170252
Buggy source:
@SideOnly(Side.CLIENT) @Override public IPoint3D getItemRenderOffset(){
  return new Point3D(-1,-1,-1);
}

Fixed version (ground truth):
@SideOnly(Side.CLIENT) @Override public IPoint3D getItemRenderOffset(){
  return new Point3D(-2,0,0);
}
Program: 170253
Project: 170253
Buggy source:
private Skin downloadSkin(String name,int serverId) throws InterruptedException {
  long startTime=System.currentTimeMillis();
  long maxRate=5;
  String downloadUrl="String_Node_Str";
  if (!StringUtils.isNullOrEmpty(name)) {
    downloadUrl+="String_Node_Str" + name;
  }
 else {
    downloadUrl+="String_Node_Str" + String.valueOf(serverId);
  }
  Skin skin=null;
  InputStream in=null;
  String data=null;
  try {
    in=new URL(downloadUrl).openStream();
    skin=SkinIOUtils.loadSkinFromStream(new BufferedInputStream(in));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    IOUtils.closeQuietly(in);
  }
  long waitTime=maxRate - (System.currentTimeMillis() - startTime);
  if (waitTime > 0) {
  }
  if (skin != null) {
    skin.serverId=serverId;
  }
 else {
    ModLogger.log(String.format("String_Node_Str",serverId));
  }
  return skin;
}

Fixed version (ground truth):
private Skin downloadSkin(String name,int serverId) throws InterruptedException {
  long startTime=System.currentTimeMillis();
  long maxRate=5;
  String downloadUrl="String_Node_Str";
  if (!StringUtils.isNullOrEmpty(name)) {
    downloadUrl+="String_Node_Str" + name;
  }
 else {
    downloadUrl+="String_Node_Str" + String.valueOf(serverId);
  }
  Skin skin=null;
  InputStream in=null;
  ByteArrayInputStream byteIn=null;
  String data=null;
  try {
    in=new URL(downloadUrl).openStream();
    byte[] skinData=IOUtils.toByteArray(in);
    byteIn=new ByteArrayInputStream(skinData);
    skin=SkinIOUtils.loadSkinFromStream(byteIn);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    IOUtils.closeQuietly(byteIn);
    IOUtils.closeQuietly(in);
  }
  long waitTime=maxRate - (System.currentTimeMillis() - startTime);
  if (waitTime > 0) {
  }
  if (skin != null) {
    skin.serverId=serverId;
  }
 else {
    ModLogger.log(String.format("String_Node_Str",serverId));
  }
  return skin;
}
Program: 170254
Project: 170254
Buggy source:
private void sendGlobalDatabaseSkinToClient(SkinRequestMessage requestMessage){
  ISkinIdentifier identifier=requestMessage.getSkinIdentifier();
synchronized (cacheMapGlobalLink) {
    if (!cacheMapGlobalLink.containsKey(identifier.getSkinGlobalId())) {
      messageWaitQueue.add(requestMessage);
      SkinCacheGlobal.INSTANCE.downloadSkin(identifier);
    }
 else {
      sendGlobalSkinToPlayer(requestMessage);
    }
  }
}

Fixed version (ground truth):
private void sendGlobalDatabaseSkinToClient(SkinRequestMessage requestMessage){
  Skin skin=cacheGlobal.get(requestMessage,true);
  if (skin != null) {
    sendSkinToClient(skin,requestMessage);
  }
 else {
synchronized (messageWaitQueueLock) {
      messageWaitQueue.add(requestMessage);
    }
  }
}
Program: 170255
Project: 170255
Buggy source:
private void processNextMessage(){
synchronized (messageQueue) {
    if (messageQueue.size() > 0) {
      processMessage(messageQueue.get(0));
      messageQueue.remove(0);
    }
  }
}

Fixed version (ground truth):
private void processNextMessage(){
synchronized (messageQueueLock) {
    if (messageQueue.size() > 0) {
      processMessage(messageQueue.get(0));
      messageQueue.remove(0);
    }
  }
}
Program: 170256
Project: 170256
Buggy source:
@Override public void run(){
  Thread thisThread=Thread.currentThread();
  ModLogger.log("String_Node_Str");
  while (serverSkinThread == thisThread) {
    try {
      thisThread.sleep(10);
    }
 catch (    InterruptedException e) {
    }
    cacheLocalDatabase.doSkinLoading();
    processMessageQueue();
  }
  ModLogger.log("String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  Thread thisThread=Thread.currentThread();
  ModLogger.log("String_Node_Str");
  while (serverSkinThread == thisThread) {
    try {
      thisThread.sleep(10);
    }
 catch (    InterruptedException e) {
    }
    cacheLocalDatabase.doSkinLoading();
    cacheLocalFile.doSkinLoading();
    cacheGlobal.doSkinLoading();
    processMessageQueue();
  }
  ModLogger.log("String_Node_Str");
}
Program: 170257
Project: 170257
Buggy source:
private void sendLocalFileSkinToClient(SkinRequestMessage requestMessage){
  ISkinIdentifier identifier=requestMessage.getSkinIdentifier();
synchronized (cacheMapFileLink) {
    if (!cacheMapFileLink.containsKey(identifier.getSkinLibraryFile())) {
      Skin skin=null;
      skin=SkinIOUtils.loadSkinFromFileName(identifier.getSkinLibraryFile().getFullName() + SkinIOUtils.SKIN_FILE_EXTENSION);
      if (skin != null) {
        cacheLocalDatabase.add(skin);
        cacheMapFileLink.put(identifier.getSkinLibraryFile(),skin.lightHash());
      }
 else {
        ModLogger.log(Level.ERROR,String.format("String_Node_Str",String.valueOf(identifier.getSkinLibraryFile().getFullName() + SkinIOUtils.SKIN_FILE_EXTENSION)));
      }
    }
    if (cacheMapFileLink.containsKey(identifier.getSkinLibraryFile())) {
      int id=cacheMapFileLink.get(identifier.getSkinLibraryFile());
      SkinIdentifier newIdentifier=new SkinIdentifier(id,requestMessage.getSkinIdentifier().getSkinLibraryFile(),0,requestMessage.getSkinIdentifier().getSkinType());
      Skin skin=cacheLocalDatabase.get(newIdentifier,false);
      if (skin != null) {
        skin.requestId=(SkinIdentifier)identifier;
        PacketHandler.networkWrapper.sendTo(new MessageServerSendSkinData((SkinIdentifier)identifier,getFullIdentifier(skin,identifier),skin),requestMessage.getPlayer());
      }
 else {
        ModLogger.log(Level.WARN,"String_Node_Str" + id);
      }
    }
  }
}

Fixed version (ground truth):
private void sendLocalFileSkinToClient(SkinRequestMessage requestMessage){
  Skin skin=cacheLocalFile.get(requestMessage,true);
  if (skin != null) {
    sendSkinToClient(skin,requestMessage);
  }
 else {
synchronized (messageWaitQueueLock) {
      messageWaitQueue.add(requestMessage);
    }
  }
}
Program: 170258
Project: 170258
Buggy source:
public void clearAll(){
  cacheLocalDatabase.clear();
synchronized (cacheMapFileLink) {
synchronized (cacheMapGlobalLink) {
      cacheMapFileLink.clear();
      cacheMapGlobalLink.clear();
      messageQueue.clear();
    }
  }
}

Fixed version (ground truth):
public void clearAll(){
  cacheLocalDatabase.clear();
  cacheLocalFile.clear();
  cacheGlobal.clear();
}
Program: 170259
Project: 170259
Buggy source:
public int globalLinkSize(){
synchronized (cacheMapGlobalLink) {
    return cacheMapGlobalLink.size();
  }
}

Fixed version (ground truth):
public int globalLinkSize(){
  return cacheGlobal.size();
}
Program: 170260
Project: 170260
Buggy source:
public SkinIdentifier getFullIdentifier(Skin skin,ISkinIdentifier skinIdentifier){
  int localId=skin.lightHash();
  ISkinType skinType=skin.getSkinType();
  ILibraryFile libraryFile=null;
  int globalId=0;
  if (cacheMapFileLink.containsValue(skin.lightHash())) {
    libraryFile=cacheMapFileLink.getBackward(skin.lightHash());
  }
  if (cacheMapGlobalLink.containsValue(skin.lightHash())) {
    globalId=cacheMapGlobalLink.getBackward(skin.lightHash());
  }
  return new SkinIdentifier(localId,libraryFile,globalId,skinType);
}

Fixed version (ground truth):
public SkinIdentifier getFullIdentifier(Skin skin,ISkinIdentifier skinIdentifier){
  int localId=skin.lightHash();
  ISkinType skinType=skin.getSkinType();
  ILibraryFile libraryFile=null;
  int globalId=0;
  try {
    if (cacheLocalFile.containsValue(skin.lightHash())) {
      libraryFile=cacheLocalFile.getBackward(skin.lightHash());
    }
    if (cacheGlobal.containsValue(skin.lightHash())) {
      globalId=cacheGlobal.getBackward(skin.lightHash());
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return new SkinIdentifier(localId,libraryFile,globalId,skinType);
}
Program: 170261
Project: 170261
Buggy source:
public void clearFileNameIdLink(LibraryFile file){
  cacheMapFileLink.remove(file);
}

Fixed version (ground truth):
public void clearFileNameIdLink(LibraryFile libraryFile){
  cacheLocalFile.remove(libraryFile);
}
Program: 170262
Project: 170262
Buggy source:
public void clientRequestEquipmentData(ISkinIdentifier skinIdentifier,EntityPlayerMP player){
  SkinRequestMessage queueMessage=new SkinRequestMessage(skinIdentifier,player);
synchronized (messageQueue) {
    messageQueue.add(queueMessage);
  }
}

Fixed version (ground truth):
public void clientRequestEquipmentData(ISkinIdentifier skinIdentifier,EntityPlayerMP player){
  SkinRequestMessage queueMessage=new SkinRequestMessage(skinIdentifier,player);
synchronized (messageQueueLock) {
    messageQueue.add(queueMessage);
  }
}
Program: 170263
Project: 170263
Buggy source:
@Deprecated public void addEquipmentDataToCache(Skin skin,String fileName){
  try {
    skin.lightHash();
  }
 catch (  Exception e) {
    ModLogger.log(Level.ERROR,String.format("String_Node_Str",fileName));
    return;
  }
  addEquipmentDataToCache(skin,new LibraryFile(fileName));
}

Fixed version (ground truth):
@Deprecated public void addEquipmentDataToCache(Skin skin,String fileName){
  throw new NotImplementedException();
}
Program: 170264
Project: 170264
Buggy source:
public int fileLinkSize(){
synchronized (cacheMapFileLink) {
    return cacheMapFileLink.size();
  }
}

Fixed version (ground truth):
public int fileLinkSize(){
  return cacheLocalFile.size();
}
Program: 170265
Project: 170265
Buggy source:
public CommonSkinCache(){
  cacheLocalDatabase=new SkinCacheLocalDatabase(this);
  cacheMapFileLink=new BidirectionalHashMap<ILibraryFile,Integer>();
  cacheMapGlobalLink=new BidirectionalHashMap<Integer,Integer>();
}

Fixed version (ground truth):
public CommonSkinCache(){
  cacheLocalDatabase=new SkinCacheLocalDatabase(this);
  cacheLocalFile=new SkinCacheLocalFile(cacheLocalDatabase);
  cacheGlobal=new SkinCacheGlobal(cacheLocalDatabase);
}
Program: 170266
Project: 170266
Buggy source:
private void sendLocalDatabaseSkinToClient(SkinRequestMessage requestMessage){
  Skin skin=cacheLocalDatabase.get(requestMessage,true);
  if (skin != null) {
    SkinIdentifier identifier=(SkinIdentifier)requestMessage.getSkinIdentifier();
    skin.requestId=identifier;
    PacketHandler.networkWrapper.sendTo(new MessageServerSendSkinData(identifier,getFullIdentifier(skin,identifier),skin),requestMessage.getPlayer());
  }
 else {
    messageWaitQueue.add(requestMessage);
  }
}

Fixed version (ground truth):
private void sendLocalDatabaseSkinToClient(SkinRequestMessage requestMessage){
  Skin skin=cacheLocalDatabase.get(requestMessage,true);
  if (skin != null) {
    sendSkinToClient(skin,requestMessage);
  }
 else {
synchronized (messageWaitQueueLock) {
      messageWaitQueue.add(requestMessage);
    }
  }
}
Program: 170267
Project: 170267
Buggy source:
@Override public void itemExpired(Skin mapItem){
  if (mapItem == null) {
    return;
  }
synchronized (cacheMapFileLink) {
synchronized (cacheMapGlobalLink) {
      int skinId=mapItem.lightHash();
      if (cacheMapFileLink.containsValue(skinId)) {
        ILibraryFile libraryFile=cacheMapFileLink.getBackward(skinId);
        cacheMapFileLink.remove(libraryFile);
      }
      if (cacheMapGlobalLink.containsValue(skinId)) {
        int globalId=cacheMapGlobalLink.getBackward(skinId);
        cacheMapGlobalLink.remove(globalId);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void itemExpired(Skin mapItem){
  if (mapItem == null) {
    return;
  }
  int skinId=mapItem.lightHash();
  if (cacheLocalFile.containsValue(skinId)) {
    ILibraryFile libraryFile=cacheLocalFile.getBackward(skinId);
    cacheLocalFile.remove(libraryFile);
  }
  if (cacheGlobal.containsValue(skinId)) {
    int globalId=cacheGlobal.getBackward(skinId);
    cacheGlobal.remove(globalId);
  }
}
Program: 170268
Project: 170268
Buggy source:
public Skin getSkin(ISkinIdentifier identifier){
  return cacheLocalDatabase.get(identifier,false);
}

Fixed version (ground truth):
public Skin getSkin(ISkinIdentifier identifier){
  if (identifier.hasLocalId()) {
    return cacheLocalDatabase.get(identifier,false);
  }
 else   if (identifier.hasLibraryFile()) {
    return cacheLocalFile.get(identifier,false);
  }
 else   if (identifier.hasGlobalId()) {
    return cacheGlobal.get(identifier,false);
  }
 else {
    ModLogger.log(Level.ERROR,"String_Node_Str" + identifier.toString());
    return null;
  }
}
Program: 170269
Project: 170269
Buggy source:
/** 
 * Returns a skin if it is in the cache. If not the skin will be loaded by another thread. 
 */
public Skin softGetSkin(ISkinIdentifier identifier){
  return cacheLocalDatabase.get(identifier,true);
}

Fixed version (ground truth):
/** 
 * Returns a skin if it is in the cache. If not the skin will be loaded by another thread. 
 */
public Skin softGetSkin(ISkinIdentifier identifier){
  if (identifier.hasLocalId()) {
    return cacheLocalDatabase.get(identifier,true);
  }
 else   if (identifier.hasLibraryFile()) {
    return cacheLocalFile.get(identifier,true);
  }
 else   if (identifier.hasGlobalId()) {
    return cacheGlobal.get(identifier,true);
  }
 else {
    ModLogger.log(Level.ERROR,"String_Node_Str" + identifier.toString());
    return null;
  }
}
Program: 170270
Project: 170270
Buggy source:
public SkinCacheGlobal(){
  downloadingSet=new HashSet<Integer>();
  executorSkinDownloader=Executors.newFixedThreadPool(2);
  completionServiceSkinDownloader=new ExecutorCompletionService<Skin>(executorSkinDownloader);
  FMLCommonHandler.instance().bus().register(this);
}

Fixed version (ground truth):
public SkinCacheGlobal(SkinCacheLocalDatabase cacheLocalDatabase){
  this.cacheLocalDatabase=cacheLocalDatabase;
  cacheMapFileLink=new BidirectionalHashMap<Integer,Integer>();
  downloadingSet=new HashSet<Integer>();
  executorSkinDownloader=Executors.newFixedThreadPool(2);
  completionServiceSkinDownloader=new ExecutorCompletionService<Skin>(executorSkinDownloader);
}
Program: 170271
Project: 170271
Buggy source:
public void downloadSkin(ISkinIdentifier identifier){
synchronized (downloadingSet) {
    if (!downloadingSet.contains(identifier.getSkinGlobalId())) {
      downloadingSet.add(identifier.getSkinGlobalId());
      completionServiceSkinDownloader.submit(new DownloadSkinCallable(null,identifier.getSkinGlobalId()));
    }
  }
}

Fixed version (ground truth):
private void downloadSkin(ISkinIdentifier identifier){
synchronized (downloadingSet) {
    if (!downloadingSet.contains(identifier.getSkinGlobalId())) {
      downloadingSet.add(identifier.getSkinGlobalId());
      completionServiceSkinDownloader.submit(new DownloadSkinCallable(null,identifier.getSkinGlobalId()));
    }
  }
}
Program: 170272
Project: 170272
Buggy source:
public void add(Skin skin){
  addSkinDataToCache(skin,skin.lightHash());
}

Fixed version (ground truth):
public void add(Skin skin){
synchronized (cacheMapLock) {
    addSkinDataToCache(skin,skin.lightHash());
  }
}
Program: 170273
Project: 170273
Buggy source:
public void clear(){
synchronized (cacheMapDatabase) {
    cacheMapDatabase.clear();
  }
}

Fixed version (ground truth):
public void clear(){
synchronized (cacheMapLock) {
    cacheMapDatabase.clear();
  }
}
Program: 170274
Project: 170274
Buggy source:
public int size(){
synchronized (cacheMapDatabase) {
    return cacheMapDatabase.size();
  }
}

Fixed version (ground truth):
public int size(){
synchronized (cacheMapLock) {
    return cacheMapDatabase.size();
  }
}