nus-yam/ex-repair huggingface dataset:
Program: 173890
Project: 173890
Buggy source:
private void moveTokens(TileI newTile){
  ArrayList newStations=(ArrayList)newTile.getStations();
  if (newStations.size() < stations.size() && newStations.size() <= 1) {
    System.out.println("String_Node_Str");
    for (int i=0; i < stations.size(); i++) {
      ArrayList tokens=(ArrayList)((Station)stations.get(i)).getTokens();
      for (int j=0; j < tokens.size(); j++) {
        ((Station)newStations.get(0)).addToken((PublicCompany)tokens.get(j));
      }
    }
    stations=new ArrayList(newStations);
  }
 else {
    for (int i=0; i < stations.size(); i++) {
      ArrayList tokens=(ArrayList)((Station)stations.get(i)).getTokens();
      for (int j=0; j < tokens.size(); j++) {
        ((Station)newStations.get(i)).addToken((PublicCompany)tokens.get(j));
      }
    }
    stations=new ArrayList(newStations);
  }
}

Fixed version (ground truth):
private void moveTokens(TileI newTile){
  ArrayList movedTokens=new ArrayList();
  ArrayList co=(ArrayList)Game.getCompanyManager().getAllPublicCompanies();
  Iterator it=co.iterator();
  while (it.hasNext()) {
    PublicCompany c=(PublicCompany)it.next();
    if (c.hasTokens()) {
      ArrayList t=(ArrayList)c.getTokens();
      Iterator it2=t.iterator();
      while (it2.hasNext()) {
        MapHex hex=(MapHex)it2.next();
        if (hex.equals(this)) {
          System.out.println("String_Node_Str" + hex + "String_Node_Str"+ this);
          movedTokens.add(c);
        }
      }
    }
  }
  if (newTile.getStations().size() <= stations.size() && newTile.getStations().size() == 1) {
    stations=new ArrayList(newTile.getStations());
    Iterator it3=movedTokens.iterator();
    while (it3.hasNext()) {
      ((Station)stations.get(0)).addToken((PublicCompany)it3.next());
    }
    return;
  }
 else {
    ArrayList newStations=new ArrayList(newTile.getStations());
    for (int j=0; j < stations.size(); j++) {
      for (int k=0; k < ((Station)stations.get(j)).getTokens().size(); k++) {
        Iterator it3=movedTokens.iterator();
        while (it3.hasNext()) {
          ArrayList tokens=(ArrayList)((Station)stations.get(j)).getTokens();
          if (((CompanyI)tokens.get(k)).equals(((CompanyI)it.next()))) {
            ((Station)newStations.get(j)).addToken((CompanyI)it.next());
          }
        }
      }
    }
    stations.clear();
    stations=newStations;
  }
}
Program: 173891
Project: 173891
Buggy source:
private void paintToken(Graphics2D g2){
  if (getHexModel().getStations().size() > 1) {
    paintSplitStations(g2);
    return;
  }
  int numTokens=getHexModel().getTokens(0).size();
  ArrayList tokens=(ArrayList)getHexModel().getTokens(0);
  System.out.println("String_Node_Str" + getHexModel().getName() + "String_Node_Str"+ tokens);
  for (int i=0; i < tokens.size(); i++) {
    PublicCompany co=(PublicCompany)tokens.get(i);
    Point origin=getTokenOrigin(numTokens,i,1,0);
    System.out.println("String_Node_Str" + i + "String_Node_Str"+ origin.x+ "String_Node_Str"+ origin.y+ "String_Node_Str");
    drawToken(g2,co,origin);
  }
}

Fixed version (ground truth):
private void paintToken(Graphics2D g2){
  if (getHexModel().getStations().size() > 1) {
    paintSplitStations(g2);
    return;
  }
  int numTokens=getHexModel().getTokens(0).size();
  ArrayList tokens=(ArrayList)getHexModel().getTokens(0);
  System.out.println("String_Node_Str" + getHexModel().getName() + "String_Node_Str"+ tokens);
  for (int i=0; i < tokens.size(); i++) {
    PublicCompany co=(PublicCompany)tokens.get(i);
    Point origin=getTokenOrigin(numTokens,i,1,0);
    drawToken(g2,co,origin);
  }
}
Program: 173892
Project: 173892
Buggy source:
private Point getTokenOrigin(int numTokens,int currentToken,int numStations,int currentStation){
  Point p=new Point();
switch (numStations) {
case 1:
switch (numTokens) {
case 1:
      p.x=(center.x - 9);
    p.y=(center.y - 9);
  return p;
case 2:
if (currentToken == 0) {
  p.x=(center.x - 9);
  p.y=(center.y - 9);
  return p;
}
 else {
  p.x=(center.x - 14);
  p.y=(center.y + 3);
  return p;
}
case 3:
if (currentToken == 0) {
p.x=(center.x - 9);
p.y=(center.y - 9);
return p;
}
 else if (currentToken == 1) {
p.x=(center.x - 14);
p.y=(center.y + 3);
return p;
}
 else {
p.x=(center.x);
p.y=(center.y);
return p;
}
case 4:
case 5:
case 6:
default :
return center;
}
case 2:
if (currentStation == 0) {
switch (numTokens) {
case 1:
p.x=(center.x - 14);
p.y=(center.y + 3);
return p;
case 2:
if (currentToken == 0) {
p.x=(center.x - 14);
p.y=(center.y + 3);
return p;
}
 else {
p.x=(center.x - 20);
p.y=(center.y + 12);
return p;
}
default :
return center;
}
}
 else {
switch (numTokens) {
case 1:
p.x=(center.x - 1);
p.y=(center.y - 20);
return p;
case 2:
if (currentToken == 0) {
p.x=(center.x - 1);
p.y=(center.y - 20);
return p;
}
 else {
p.x=(center.x - 6);
p.y=(center.y - 8);
return p;
}
default :
return center;
}
}
case 3:
default :
return center;
}
}

Fixed version (ground truth):
private Point getTokenOrigin(int numTokens,int currentToken,int numStations,int currentStation){
  Point p=new Point();
switch (numStations) {
case 1:
switch (numTokens) {
case 1:
      p.x=(center.x - 9);
    p.y=(center.y - 9);
  return p;
case 2:
if (currentToken == 0) {
  p.x=(center.x - 5);
  p.y=(center.y - 9);
  return p;
}
 else {
  p.x=(center.x - 17);
  p.y=(center.y - 9);
  return p;
}
case 3:
if (currentToken == 0) {
p.x=(center.x - 14);
p.y=(center.y - 3);
return p;
}
 else if (currentToken == 1) {
p.x=(center.x - 5);
p.y=(center.y - 3);
return p;
}
 else {
p.x=(center.x - 9);
p.y=(center.y - 14);
return p;
}
case 4:
case 5:
case 6:
default :
return center;
}
case 2:
if (currentStation == 0) {
switch (numTokens) {
case 1:
p.x=(center.x - 14);
p.y=(center.y + 3);
return p;
case 2:
if (currentToken == 0) {
p.x=(center.x - 14);
p.y=(center.y + 3);
return p;
}
 else {
p.x=(center.x - 20);
p.y=(center.y + 12);
return p;
}
default :
return center;
}
}
 else {
switch (numTokens) {
case 1:
p.x=(center.x - 1);
p.y=(center.y - 20);
return p;
case 2:
if (currentToken == 0) {
p.x=(center.x - 1);
p.y=(center.y - 20);
return p;
}
 else {
p.x=(center.x - 6);
p.y=(center.y - 8);
return p;
}
default :
return center;
}
}
case 3:
default :
return center;
}
}
Program: 173894
Project: 173894
Buggy source:
public void upgrade(TileI newTile,int newOrientation){
  if (currentTile != null)   currentTile.remove(this);
  moveTokens(newTile);
  newTile.lay(this);
  currentTile=newTile;
  currentTileRotation=newOrientation;
}

Fixed version (ground truth):
public void upgrade(TileI newTile,int newOrientation){
  if (currentTile != null)   currentTile.remove(this);
  if (hasTokens)   moveTokens(newTile);
  newTile.lay(this);
  currentTile=newTile;
  currentTileRotation=newOrientation;
}
Program: 173895
Project: 173895
Buggy source:
private void moveTokens(TileI newTile){
  ArrayList newStations=(ArrayList)newTile.getStations();
  if (newStations.size() < stations.size() && newStations.size() <= 1) {
    System.out.println("String_Node_Str");
    for (int i=0; i < stations.size(); i++) {
      ArrayList tokens=(ArrayList)((Station)stations.get(i)).getTokens();
      for (int j=0; j < tokens.size(); j++) {
        ((Station)newStations.get(0)).addToken((PublicCompany)tokens.get(j));
      }
    }
    stations=newStations;
  }
 else {
    for (int i=0; i < stations.size(); i++) {
      ArrayList tokens=(ArrayList)((Station)stations.get(i)).getTokens();
      for (int j=0; j < tokens.size(); j++) {
        ((Station)newStations.get(i)).addToken((PublicCompany)tokens.get(j));
      }
    }
    stations=newStations;
  }
}

Fixed version (ground truth):
private void moveTokens(TileI newTile){
  ArrayList newStations=(ArrayList)newTile.getStations();
  if (newStations.size() < stations.size() && newStations.size() <= 1) {
    System.out.println("String_Node_Str");
    for (int i=0; i < stations.size(); i++) {
      ArrayList tokens=(ArrayList)((Station)stations.get(i)).getTokens();
      for (int j=0; j < tokens.size(); j++) {
        ((Station)newStations.get(0)).addToken((PublicCompany)tokens.get(j));
      }
    }
    stations=new ArrayList(newStations);
  }
 else {
    for (int i=0; i < stations.size(); i++) {
      ArrayList tokens=(ArrayList)((Station)stations.get(i)).getTokens();
      for (int j=0; j < tokens.size(); j++) {
        ((Station)newStations.get(i)).addToken((PublicCompany)tokens.get(j));
      }
    }
    stations=new ArrayList(newStations);
  }
}
Program: 173896
Project: 173896
Buggy source:
public LogWindow(){
  messageWindow=this;
  message=new JLabel("String_Node_Str");
  message.setBackground(Color.WHITE);
  message.setOpaque(true);
  message.setVerticalAlignment(SwingConstants.TOP);
  messagePanel=new JPanel(new GridBagLayout());
  messageScroller=new JScrollPane(message,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  vbar=messageScroller.getVerticalScrollBar();
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridx=gbc.gridy=0;
  gbc.weightx=gbc.weighty=0.5;
  gbc.fill=GridBagConstraints.BOTH;
  messagePanel.add(messageScroller,gbc);
  setContentPane(messagePanel);
  setSize(400,400);
  setLocation(600,400);
  messagePanel.setBorder(BorderFactory.createEtchedBorder());
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

Fixed version (ground truth):
public LogWindow(){
  messageWindow=this;
  message=new JLabel("String_Node_Str");
  message.setBackground(Color.WHITE);
  message.setOpaque(true);
  message.setVerticalAlignment(SwingConstants.TOP);
  messagePanel=new JPanel(new GridBagLayout());
  messageScroller=new JScrollPane(message,ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  vbar=messageScroller.getVerticalScrollBar();
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridx=gbc.gridy=0;
  gbc.weightx=gbc.weighty=0.5;
  gbc.fill=GridBagConstraints.BOTH;
  messagePanel.add(messageScroller,gbc);
  setContentPane(messagePanel);
  setSize(400,400);
  setLocation(600,400);
  messagePanel.setBorder(BorderFactory.createEtchedBorder());
  setTitle("String_Node_Str");
  addWindowListener(this);
}
Program: 173897
Project: 173897
Buggy source:
public MapWindow(){
  Scale.set(15);
  Container contentPane=this.getContentPane();
  contentPane.setLayout(new BorderLayout());
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  map.addMouseListener(map);
  map.addMouseMotionListener(map);
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  scrollPane=new JScrollPane(map);
  scrollPane.setSize(map.getPreferredSize());
  contentPane.add(scrollPane,BorderLayout.CENTER);
  upgradePanel=new UpgradesPanel(map);
  contentPane.add(upgradePanel,BorderLayout.WEST);
  map.setUpgradesPanel(upgradePanel);
  setSize(map.getPreferredSize().width + 100,map.getPreferredSize().height + 40);
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  pack();
}

Fixed version (ground truth):
public MapWindow(){
  Scale.set(15);
  Container contentPane=this.getContentPane();
  contentPane.setLayout(new BorderLayout());
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  map.addMouseListener(map);
  map.addMouseMotionListener(map);
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  scrollPane=new JScrollPane(map);
  scrollPane.setSize(map.getPreferredSize());
  contentPane.add(scrollPane,BorderLayout.CENTER);
  upgradePanel=new UpgradesPanel(map);
  contentPane.add(upgradePanel,BorderLayout.WEST);
  map.setUpgradesPanel(upgradePanel);
  setSize(map.getPreferredSize().width + 100,map.getPreferredSize().height + 40);
  setLocation(25,25);
  setTitle("String_Node_Str");
  addWindowListener(this);
  pack();
}
Program: 173899
Project: 173899
Buggy source:
public MapWindow(){
  Scale.set(15);
  Container contentPane=this.getContentPane();
  contentPane.setLayout(new BorderLayout());
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  map.addMouseListener(map);
  addMouseListener(map);
  map.addMouseMotionListener(map);
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  scrollPane=new JScrollPane(map);
  scrollPane.setSize(map.getPreferredSize());
  contentPane.add(scrollPane,BorderLayout.CENTER);
  upgradePanel=new UpgradesPanel();
  contentPane.add(upgradePanel,BorderLayout.WEST);
  map.setUpgradesPanel(upgradePanel);
  setSize(map.getPreferredSize().width + 100,map.getPreferredSize().height + 40);
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}

Fixed version (ground truth):
public MapWindow(){
  Scale.set(15);
  Container contentPane=this.getContentPane();
  contentPane.setLayout(new BorderLayout());
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  map.addMouseListener(map);
  addMouseListener(map);
  map.addMouseMotionListener(map);
  ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  scrollPane=new JScrollPane(map);
  scrollPane.setSize(map.getPreferredSize());
  contentPane.add(scrollPane,BorderLayout.CENTER);
  upgradePanel=new UpgradesPanel();
  contentPane.add(upgradePanel,BorderLayout.WEST);
  map.setUpgradesPanel(upgradePanel);
  setSize(map.getPreferredSize().width + 100,map.getPreferredSize().height + 40);
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  pack();
}
Program: 173900
Project: 173900
Buggy source:
public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  if (getAntialias()) {
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  }
 else {
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
  }
  Color terrainColor=Color.WHITE;
  if (isSelected()) {
    tileScale=0.3;
    g2.setColor(highlightColor);
    g2.fill(hexagon);
    g2.setColor(terrainColor);
    g2.fill(innerHexagon);
    g2.setColor(Color.black);
    g2.draw(innerHexagon);
  }
 else {
    if (tileScale != 0.33)     tileScale=0.33;
    g2.setColor(terrainColor);
    g2.fill(hexagon);
  }
  g2.setColor(Color.black);
  g2.draw(hexagon);
  FontMetrics fontMetrics=g2.getFontMetrics();
  g2.drawString(hexName,rectBound.x + (rectBound.width - fontMetrics.stringWidth(getHexModel().getName())) * 2 / 5,rectBound.y + ((fontMetrics.getHeight() + rectBound.height) * 3 / 10));
  g2.drawString("String_Node_Str" + model.getX() + "String_Node_Str"+ model.getY()+ "String_Node_Str",rectBound.x + (rectBound.width - fontMetrics.stringWidth("String_Node_Str" + getHexModel().getX() + "String_Node_Str"+ getHexModel().getY()+ "String_Node_Str")) * 1 / 3,rectBound.y + ((fontMetrics.getHeight() + rectBound.height) * 1 / 2));
  g2.drawString(tileId == -999 ? "String_Node_Str" : "String_Node_Str" + tileId,rectBound.x + (rectBound.width - fontMetrics.stringWidth("String_Node_Str" + getHexModel().getPreprintedTileId())) * 2 / 5,rectBound.y + ((fontMetrics.getHeight() + rectBound.height) * 7 / 10));
}

Fixed version (ground truth):
public void paint(Graphics g){
  Graphics2D g2=(Graphics2D)g;
  if (getAntialias()) {
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  }
 else {
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
  }
  Color terrainColor=Color.WHITE;
  if (isSelected()) {
    tileScale=0.3;
    g2.setColor(highlightColor);
    g2.fill(hexagon);
    g2.setColor(terrainColor);
    g2.fill(innerHexagon);
    g2.setColor(Color.black);
    g2.draw(innerHexagon);
  }
 else {
    if (tileScale != 0.33)     tileScale=0.33;
  }
  paintOverlay(g2);
}
Program: 173901
Project: 173901
Buggy source:
public void paintOverlay(Graphics2D g){
  BufferedImage overlay=tileImage;
  if (overlay != null) {
    Point center=findCenter();
    af=AffineTransform.getRotateInstance(rotation);
    af.scale(tileScale,tileScale);
    AffineTransformOp aop=new AffineTransformOp(af,AffineTransformOp.TYPE_BILINEAR);
    g.drawImage(tileImage,aop,(center.x + x_adjust),(center.y + y_adjust));
    g.setTransform(AffineTransform.getRotateInstance(0));
  }
}

Fixed version (ground truth):
public void paintOverlay(Graphics2D g2){
  if (tileImage != null) {
    Point center=findCenter();
    af=AffineTransform.getRotateInstance(rotation);
    af.scale(tileScale,tileScale);
    AffineTransformOp aop=new AffineTransformOp(af,AffineTransformOp.TYPE_BILINEAR);
    g2.drawImage(tileImage,aop,center.x + x_adjust,center.y + y_adjust);
  }
}
Program: 173902
Project: 173902
Buggy source:
protected void setupHexesGUI(){
  hexes.clear();
  MapManager mmgr=MapManager.getInstance();
  MapHex[][] hexArray=mmgr.getHexes();
  MapHex mh;
  h=new GUIHex[hexArray.length][hexArray[0].length];
  for (int i=0; i < hexArray.length; i++) {
    for (int j=0; j < hexArray[0].length; j++) {
      mh=hexArray[i][j];
      if (mh != null) {
        GUIEWHex hex=new GUIEWHex((cx + scale * ((GUIHex.SQRT3 * i) + (GUIHex.SQRT3 / 2 * (j & 1)))),(cy + j * 1.5 * scale),scale,this,i,j);
        hex.setName(mh.getName());
        hex.setTileId(mh.getPreprintedTileId());
        hex.setTileOrientation(mh.getPreprintedTileOrientation());
        hex.setTileFilename(mh.getTileFileName());
        hex.setHexModel(mh);
        imageLoader.loadTile(mh.getPreprintedTileId());
        hex.setTileImage(imageLoader.getTile(mh.getPreprintedTileId()));
        hex.x_adjust=hex.x_adjust_arr[hex.tileOrientation];
        hex.y_adjust=hex.y_adjust_arr[hex.tileOrientation];
        hex.rotation=hex.rotation_arr[hex.tileOrientation];
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}

Fixed version (ground truth):
protected void setupHexesGUI(){
  hexes=new ArrayList();
  MapManager mmgr=MapManager.getInstance();
  MapHex[][] hexArray=mmgr.getHexes();
  MapHex mh;
  h=new GUIHex[hexArray.length][hexArray[0].length];
  for (int i=0; i < hexArray.length; i++) {
    for (int j=0; j < hexArray[0].length; j++) {
      mh=hexArray[i][j];
      if (mh != null) {
        GUIEWHex hex=new GUIEWHex((cx + scale * ((GUIHex.SQRT3 * i) + (GUIHex.SQRT3 / 2 * (j & 1)))),(cy + j * 1.5 * scale),scale,this,i,j);
        hex.setName(mh.getName());
        hex.setTileId(mh.getPreprintedTileId());
        hex.setTileOrientation(mh.getPreprintedTileOrientation());
        hex.setTileFilename(mh.getTileFileName());
        hex.setHexModel(mh);
        imageLoader.loadTile(mh.getPreprintedTileId());
        hex.setTileImage(imageLoader.getTile(mh.getPreprintedTileId()));
        hex.x_adjust=hex.x_adjust_arr[hex.tileOrientation];
        hex.y_adjust=hex.y_adjust_arr[hex.tileOrientation];
        hex.rotation=hex.rotation_arr[hex.tileOrientation];
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}
Program: 173903
Project: 173903
Buggy source:
protected void setupHexesGUI(){
  hexes.clear();
  scale=Scale.get();
  MapManager mmgr=MapManager.getInstance();
  MapHex[][] hexArray=mmgr.getHexes();
  MapHex mh;
  h=new GUIHex[hexArray.length][hexArray[0].length];
  for (int i=0; i < hexArray.length; i++) {
    for (int j=0; j < hexArray[0].length; j++) {
      mh=hexArray[i][j];
      if (mh != null) {
        GUINSHex hex=new GUINSHex((int)Math.round(cx + 3 * i * scale),(int)Math.round(cy + (2 * j + (i & 1)) * GUIHex.SQRT3 * scale),scale,this,i,j);
        hex.setName(mh.getName());
        hex.setTileId(mh.getPreprintedTileId());
        hex.setTileOrientation(mh.getPreprintedTileOrientation());
        hex.setTileFilename(mh.getTileFileName());
        hex.setHexModel(mh);
        imageLoader.loadTile(hexArray[i][j].getPreprintedTileId());
        hex.setTileImage(imageLoader.getTile(hexArray[i][j].getPreprintedTileId()));
        hex.x_adjust=hex.x_adjust_arr[hex.tileOrientation];
        hex.y_adjust=hex.y_adjust_arr[hex.tileOrientation];
        hex.rotation=hex.rotation_arr[hex.tileOrientation];
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}

Fixed version (ground truth):
protected void setupHexesGUI(){
  hexes=new ArrayList();
  scale=Scale.get();
  MapManager mmgr=MapManager.getInstance();
  MapHex[][] hexArray=mmgr.getHexes();
  MapHex mh;
  h=new GUIHex[hexArray.length][hexArray[0].length];
  for (int i=0; i < hexArray.length; i++) {
    for (int j=0; j < hexArray[0].length; j++) {
      mh=hexArray[i][j];
      if (mh != null) {
        GUINSHex hex=new GUINSHex((int)Math.round(cx + 3 * i * scale),(int)Math.round(cy + (2 * j + (i & 1)) * GUIHex.SQRT3 * scale),scale,this,i,j);
        hex.setName(mh.getName());
        hex.setTileId(mh.getPreprintedTileId());
        hex.setTileOrientation(mh.getPreprintedTileOrientation());
        hex.setTileFilename(mh.getTileFileName());
        hex.setHexModel(mh);
        imageLoader.loadTile(hexArray[i][j].getPreprintedTileId());
        hex.setTileImage(imageLoader.getTile(hexArray[i][j].getPreprintedTileId()));
        hex.x_adjust=hex.x_adjust_arr[hex.tileOrientation];
        hex.y_adjust=hex.y_adjust_arr[hex.tileOrientation];
        hex.rotation=hex.rotation_arr[hex.tileOrientation];
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}
Program: 173904
Project: 173904
Buggy source:
public MapWindow(){
  GUIHex.setOverlay(true);
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  scrollPane=new ScrollPane();
  scrollPane.add(map);
  map.addMouseListener(map);
  scrollPane.addMouseListener(map);
  addMouseListener(map);
  scrollPane.setSize(map.getMinimumSize());
  setSize(scrollPane.getPreferredSize());
  getContentPane().add(scrollPane);
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

Fixed version (ground truth):
public MapWindow(){
  GUIHex.setOverlay(true);
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  scrollPane=new ScrollPane();
  scrollPane.add(map);
  map.addMouseListener(map);
  scrollPane.addMouseListener(map);
  addMouseListener(map);
  scrollPane.setSize(map.getMinimumSize());
  setSize(scrollPane.getPreferredSize());
  getContentPane().add(scrollPane);
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  System.out.println("String_Node_Str" + map.isLightweight());
}
Program: 173907
Project: 173907
Buggy source:
public void repaint(){
  try {
    if (getBattleHexModel().isEntrance()) {
      map.repaint();
    }
 else {
      map.repaint(getBounds().x,getBounds().y,getBounds().width,getBounds().height);
    }
  }
 catch (  NullPointerException e) {
  }
}

Fixed version (ground truth):
public void repaint(){
  super.repaint();
  try {
    if (getBattleHexModel().isEntrance()) {
      map.repaint();
    }
 else {
      System.out.println(getBounds());
      map.repaint();
    }
  }
 catch (  NullPointerException e) {
  }
}
Program: 173908
Project: 173908
Buggy source:
public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2=(Graphics2D)g;
  try {
    Rectangle rectClip=g.getClipBounds();
    if (rectClip == null) {
      return;
    }
    Iterator it=hexes.iterator();
    while (it.hasNext()) {
      GUIHex hex=(GUIHex)it.next();
      if (!hex.getBattleHexModel().isEntrance() && rectClip.intersects(hex.getBounds())) {
        hex.paint(g);
      }
    }
    Object oldantialias=g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    Font oldFont=g.getFont();
    FontMetrics fm;
    String dn=null;
    String bn=null;
    String sub=null;
    if (sub == null) {
      sub=(dn.equals(bn) ? null : bn);
    }
    fm=g.getFontMetrics();
    int tma=fm.getMaxAscent();
    g.drawString(dn,80,4 + tma);
    if (sub != null) {
      fm=g.getFontMetrics();
      int tma2=fm.getMaxAscent();
      g.drawString(sub,80,4 + tma + 8+ tma2);
    }
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,oldantialias);
    g.setFont(oldFont);
  }
 catch (  NullPointerException ex) {
  }
}

Fixed version (ground truth):
public void paintComponent(Graphics g){
  super.paintComponent(g);
  Graphics2D g2=(Graphics2D)g;
  try {
    Rectangle rectClip=g.getClipBounds();
    if (rectClip == null) {
      return;
    }
    Iterator it=hexes.iterator();
    while (it.hasNext()) {
      GUIHex hex=(GUIHex)it.next();
      if (!hex.getBattleHexModel().isEntrance() && rectClip.intersects(hex.getBounds())) {
        hex.paint(g);
      }
    }
    Object oldantialias=g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    Font oldFont=g.getFont();
    FontMetrics fm;
    String dn="String_Node_Str";
    String bn=null;
    String sub=null;
    if (sub == null) {
      sub=(dn.equals(bn) ? null : bn);
    }
    fm=g.getFontMetrics();
    int tma=fm.getMaxAscent();
    g.drawString(dn,80,4 + tma);
    if (sub != null) {
      fm=g.getFontMetrics();
      int tma2=fm.getMaxAscent();
      g.drawString(sub,80,4 + tma + 8+ tma2);
    }
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,oldantialias);
    g.setFont(oldFont);
  }
 catch (  NullPointerException ex) {
  }
}
Program: 173909
Project: 173909
Buggy source:
public void mouseClicked(MouseEvent arg0){
  Point point=arg0.getPoint();
  try {
    GUIHex hex=getHexContainingPoint(point);
    if (hex.isSelected() && hexSelected == true) {
      hex.x_adjust=hex.x_adjust_arr[hex.arr_index];
      hex.y_adjust=hex.y_adjust_arr[hex.arr_index];
      hex.rotation=hex.rotation_arr[hex.arr_index];
    }
 else     if (!hex.isSelected() && hexSelected == false) {
      hex.setSelected(true);
      hexSelected=true;
    }
 else {
      unselectAllHexes();
      hex.setSelected(true);
      hexSelected=true;
    }
    hex.repaint();
  }
 catch (  NullPointerException e) {
  }
}

Fixed version (ground truth):
public void mouseClicked(MouseEvent arg0){
  Point point=arg0.getPoint();
  try {
    GUIHex hex=getHexContainingPoint(point);
    if (hex.isSelected() && hexSelected == true) {
      hex.x_adjust=hex.x_adjust_arr[hex.arr_index];
      hex.y_adjust=hex.y_adjust_arr[hex.arr_index];
      hex.rotation=hex.rotation_arr[hex.arr_index];
      hex.rotateHexCW();
    }
 else     if (!hex.isSelected() && hexSelected == false) {
      hex.setSelected(true);
      hexSelected=true;
    }
 else {
      unselectAllHexes();
      hex.setSelected(true);
      hexSelected=true;
    }
    hex.repaint();
  }
 catch (  NullPointerException e) {
  }
}
Program: 173910
Project: 173910
Buggy source:
public MapWindow(){
  GUIHex.setOverlay(true);
  Scale.set(15);
  Container contentPane=this.getContentPane();
  contentPane.setLayout(new BorderLayout());
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  map.addMouseListener(map);
  addMouseListener(map);
  addWindowListener(map);
  scrollPane=new JScrollPane(map);
  scrollPane.setSize(map.getPreferredSize());
  scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
  contentPane.add(scrollPane,BorderLayout.CENTER);
  setSize(map.getPreferredSize());
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}

Fixed version (ground truth):
public MapWindow(){
  GUIHex.setOverlay(true);
  Scale.set(15);
  Container contentPane=this.getContentPane();
  contentPane.setLayout(new BorderLayout());
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  map.addMouseListener(map);
  addMouseListener(map);
  addWindowListener(map);
  scrollPane=new ScrollPane();
  scrollPane.add(map);
  scrollPane.setSize(map.getPreferredSize());
  contentPane.add(scrollPane,BorderLayout.CENTER);
  setSize(map.getPreferredSize());
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
Program: 173911
Project: 173911
Buggy source:
public void paintComponent(Graphics g){
  try {
    super.paintComponent(g);
    Rectangle rectClip=g.getClipBounds();
    if (rectClip == null) {
      return;
    }
    System.out.println(rectClip);
    for (int x=(hexes.size() - 1); x > 0; x--) {
      GUIHex hex=(GUIHex)hexes.get(x);
      Rectangle hexrect=hex.getBounds();
      if (g.hitClip(hexrect.x,hexrect.y,hexrect.width,hexrect.height)) {
        hex.paint(g);
      }
    }
  }
 catch (  NullPointerException ex) {
  }
}

Fixed version (ground truth):
public void paintComponent(Graphics g){
  try {
    super.paintComponent(g);
    Rectangle rectClip=g.getClipBounds();
    if (rectClip == null) {
      return;
    }
    for (int x=(hexes.size() - 1); x > 0; x--) {
      GUIHex hex=(GUIHex)hexes.get(x);
      Rectangle hexrect=hex.getBounds();
      if (g.hitClip(hexrect.x,hexrect.y,hexrect.width,hexrect.height)) {
        hex.paint(g);
      }
    }
  }
 catch (  NullPointerException ex) {
  }
}
Program: 173912
Project: 173912
Buggy source:
public MapWindow(){
  GUIHex.setOverlay(true);
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  scrollPane=new ScrollPane();
  scrollPane.add(map);
  map.addMouseListener(map);
  scrollPane.addMouseListener(map);
  addMouseListener(map);
  scrollPane.setSize(map.getMinimumSize());
  setSize(scrollPane.getPreferredSize());
  getContentPane().add(scrollPane);
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  System.out.println("String_Node_Str" + map.isLightweight());
}

Fixed version (ground truth):
public MapWindow(){
  GUIHex.setOverlay(true);
  Scale.set(15);
  mmgr=MapManager.getInstance();
  try {
    map=(HexMap)Class.forName(mmgr.getMapUIClassName()).newInstance();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    return;
  }
  scrollPane=new ScrollPane();
  scrollPane.add(map);
  map.addMouseListener(map);
  scrollPane.addMouseListener(map);
  addMouseListener(map);
  scrollPane.setSize(map.getMinimumSize());
  setSize(scrollPane.getPreferredSize());
  getContentPane().add(scrollPane);
  setLocation(25,25);
  setTitle("String_Node_Str");
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  System.out.println("String_Node_Str" + map.isLightweight());
}
Program: 173913
Project: 173913
Buggy source:
protected void setupHexesGUI(){
  hexes.clear();
  MapManager mmgr=MapManager.getInstance();
  MapHex[][] hexArray=mmgr.getHexes();
  MapHex mh;
  h=new GUIHex[hexArray.length][hexArray[0].length];
  for (int i=0; i < hexArray.length; i++) {
    for (int j=0; j < hexArray[0].length; j++) {
      mh=hexArray[i][j];
      if (mh != null) {
        GUIEWHex hex=new GUIEWHex((cx + scale * ((GUIHex.SQRT3 * i) + (GUIHex.SQRT3 / 2 * (j & 1)))),(cy + j * 1.5 * scale),scale,this,i,j);
        hex.setName(hexArray[i][j].getName());
        hex.setTileId(hexArray[i][j].getPreprintedTileId());
        hex.setTileOrientation(hexArray[i][j].getPreprintedTileOrientation());
        hex.setTileFilename(hexArray[i][j].getTileFileName());
        imageLoader.loadTile(hexArray[i][j].getPreprintedTileId());
        hex.setTileImage(imageLoader.getTile(hexArray[i][j].getPreprintedTileId()));
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}

Fixed version (ground truth):
protected void setupHexesGUI(){
  hexes.clear();
  MapManager mmgr=MapManager.getInstance();
  MapHex[][] hexArray=mmgr.getHexes();
  MapHex mh;
  h=new GUIHex[hexArray.length][hexArray[0].length];
  for (int i=0; i < hexArray.length; i++) {
    for (int j=0; j < hexArray[0].length; j++) {
      mh=hexArray[i][j];
      if (mh != null) {
        GUIEWHex hex=new GUIEWHex((cx + scale * ((GUIHex.SQRT3 * i) + (GUIHex.SQRT3 / 2 * (j & 1)))),(cy + j * 1.5 * scale),scale,this,i,j);
        hex.setName(hexArray[i][j].getName());
        hex.setTileId(hexArray[i][j].getPreprintedTileId());
        hex.setTileOrientation(hexArray[i][j].getPreprintedTileOrientation());
        hex.setTileFilename(hexArray[i][j].getTileFileName());
        imageLoader.loadTile(hexArray[i][j].getPreprintedTileId());
        hex.setTileImage(imageLoader.getTile(hexArray[i][j].getPreprintedTileId()));
        hex.x_adjust=hex.x_adjust_arr[hex.tileOrientation];
        hex.y_adjust=hex.y_adjust_arr[hex.tileOrientation];
        hex.rotation=hex.rotation_arr[hex.tileOrientation];
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}
Program: 173914
Project: 173914
Buggy source:
public void paint(Graphics g){
  super.paint(g);
  Graphics2D g2=(Graphics2D)g;
  Point center=findCenter();
  x_adjust=x_adjust_arr[tileOrientation];
  y_adjust=y_adjust_arr[tileOrientation];
  rotation=rotation_arr[tileOrientation];
  af=AffineTransform.getRotateInstance(rotation);
  af.scale(tileScale,tileScale);
  AffineTransformOp aop=new AffineTransformOp(af,AffineTransformOp.TYPE_BILINEAR);
  g2.drawImage(tileImage,aop,(center.x + x_adjust),(center.y + y_adjust));
  if (arr_index == 6) {
    arr_index=1;
  }
 else   arr_index++;
}

Fixed version (ground truth):
public void paint(Graphics g){
  super.paint(g);
  Graphics2D g2=(Graphics2D)g;
  Point center=findCenter();
  af=AffineTransform.getRotateInstance(rotation);
  af.scale(tileScale,tileScale);
  AffineTransformOp aop=new AffineTransformOp(af,AffineTransformOp.TYPE_BILINEAR);
  g2.drawImage(tileImage,aop,(center.x + x_adjust),(center.y + y_adjust));
  if (arr_index == 6) {
    arr_index=1;
  }
 else   arr_index++;
}
Program: 173915
Project: 173915
Buggy source:
public void paint(Graphics g){
  super.paint(g);
  Graphics2D g2=(Graphics2D)g;
  Point center=findCenter();
  af=AffineTransform.getRotateInstance(rotation);
  af.scale(tileScale,tileScale);
  AffineTransformOp aop=new AffineTransformOp(af,AffineTransformOp.TYPE_BILINEAR);
  g2.drawImage(tileImage,aop,(center.x + x_adjust),(center.y + y_adjust));
  if (arr_index == 6) {
    arr_index=1;
  }
 else   arr_index++;
}

Fixed version (ground truth):
public void paint(Graphics g){
  super.paint(g);
  Graphics2D g2=(Graphics2D)g;
  Point center=findCenter();
  af=AffineTransform.getRotateInstance(rotation);
  af.scale(tileScale,tileScale);
  AffineTransformOp aop=new AffineTransformOp(af,AffineTransformOp.TYPE_BILINEAR);
  g2.setClip(hexagon);
  g2.drawImage(tileImage,aop,(center.x + x_adjust),(center.y + y_adjust));
  if (arr_index == 6) {
    arr_index=1;
  }
 else   arr_index++;
}
Program: 173916
Project: 173916
Buggy source:
public void paintComponent(Graphics g){
  super.paintComponent(g);
  Rectangle rectClip=g.getClipBounds();
  if (rectClip == null) {
    return;
  }
}

Fixed version (ground truth):
public void paintComponent(Graphics g){
  super.paintComponent(g);
}
Program: 173917
Project: 173917
Buggy source:
public BattleMap(){
  super();
  battleFrame=new JFrame();
  battleFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  Container contentPane=battleFrame.getContentPane();
  contentPane.setLayout(new BorderLayout());
  battleFrame.addWindowListener(this);
  addMouseListener(this);
  if (location == null) {
    location=new Point2D.Double(0,2 * scale);
  }
  battleFrame.setLocation((int)location.getX(),(int)location.getY());
  contentPane.add(new JScrollPane(this),BorderLayout.CENTER);
  defaultCursor=battleFrame.getCursor();
  battleFrame.setVisible(true);
  battleFrame.pack();
  battleFrame.setSize(600,600);
}

Fixed version (ground truth):
public BattleMap(){
  super();
  battleFrame=new JFrame();
  battleFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  Container contentPane=battleFrame.getContentPane();
  contentPane.setLayout(new BorderLayout());
  battleFrame.addWindowListener(this);
  addMouseListener(this);
  if (location == null) {
    location=new Point2D.Double(0,2 * scale);
  }
  battleFrame.setLocation((int)location.getX(),(int)location.getY());
  contentPane.add(new JScrollPane(this),BorderLayout.CENTER);
  defaultCursor=battleFrame.getCursor();
  battleFrame.setVisible(true);
  rescale();
}
Program: 173918
Project: 173918
Buggy source:
protected void setupHexesGUI(){
  hexes.clear();
  for (int i=0; i < h.length; i++) {
    for (int j=0; j < h[0].length; j++) {
      if (show[i][j]) {
        GUIEWHex hex=new GUIEWHex((cx + (GUIHex.SQRT3 * i * scale) + (GUIHex.SQRT3 / 2 * scale * (j & 1))),(cy + j * 1.5 * scale),scale,this,i,j);
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}

Fixed version (ground truth):
protected void setupHexesGUI(){
  hexes.clear();
  for (int i=0; i < h.length; i++) {
    for (int j=0; j < h[0].length; j++) {
      if (show[i][j]) {
        GUIEWHex hex=new GUIEWHex((cx + scale * ((GUIHex.SQRT3 * i) + (GUIHex.SQRT3 / 2 * (j & 1)))),(cy + j * 1.5 * scale),scale,this,i,j);
        h[i][j]=hex;
        hexes.add(hex);
      }
    }
  }
}
Program: 173920
Project: 173920
Buggy source:
public Dimension getPreferredSize(){
  return new Dimension(60,55);
}

Fixed version (ground truth):
public Dimension getPreferredSize(){
  return new Dimension(550,350);
}
Program: 173921
Project: 173921
Buggy source:
/** 
 * Check if a player may buy the given number of shares from a given company.
 * @param company The company from which to buy
 * @param number The number of shares (usually 1 but not always so).
 * @return True if it is allowed.
 */
public boolean mayBuyCompanyShare(PublicCompanyI company,int number){
  if (portfolio.countShares(company) + number * company.getShareUnit() > 60)   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Check if a player may buy the given number of shares from a given company.
 * @param company The company from which to buy
 * @param number The number of shares (usually 1 but not always so).
 * @return True if it is allowed.
 */
public boolean mayBuyCompanyShare(PublicCompanyI company,int number){
  if (portfolio.ownsShare(company) + number * company.getShareUnit() > 60)   return false;
  return true;
}
Program: 173922
Project: 173922
Buggy source:
/** 
 * Find any certificate 
 */
public PublicCertificateI findCertificate(PublicCompanyI company,boolean president){
  String companyName=company.getName();
  if (!certPerCompany.containsKey(companyName))   return null;
  Iterator it=((List)certPerCompany.get(companyName)).iterator();
  PublicCertificateI cert;
  while (it.hasNext()) {
    cert=(PublicCertificateI)it.next();
    if (cert.getCompany() == company && president == cert.isPresidentShare()) {
      return cert;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Find any certificate 
 */
public PublicCertificateI findCertificate(PublicCompanyI company,boolean president){
  String companyName=company.getName();
  if (!certPerCompany.containsKey(companyName)) {
    System.out.println("String_Node_Str" + name + "String_Node_Str"+ company.getName());
    return null;
  }
  Iterator it=((List)certPerCompany.get(companyName)).iterator();
  PublicCertificateI cert;
  while (it.hasNext()) {
    cert=(PublicCertificateI)it.next();
    if (cert.getCompany() == company && president == cert.isPresidentShare()) {
      return cert;
    }
  }
  return null;
}
Program: 173923
Project: 173923
Buggy source:
/** 
 * Set a par price.
 * @param playerName The name of the par price setting player.
 * @param companyName The name of teh company for which a par price is set.
 * @param parPrice The par price.
 */
public boolean setPrice(String playerName,String companyName,int parPrice){
  String errMsg=null;
  Player player=GameManager.getCurrentPlayer();
  StockSpaceI startSpace=null;
  while (true) {
    if (!playerName.equals(player.getName())) {
      errMsg="String_Node_Str";
      break;
    }
    if (!companyName.equals(companyNeedingPrice.getName())) {
      errMsg="String_Node_Str";
      break;
    }
    if ((startSpace=StockMarket.getInstance().getStartSpace(parPrice)) == null) {
      errMsg="String_Node_Str";
      break;
    }
    break;
  }
  if (errMsg != null) {
    Log.error("String_Node_Str" + Bank.format(parPrice) + "String_Node_Str"+ playerName+ "String_Node_Str"+ companyName+ "String_Node_Str"+ errMsg);
    return false;
  }
  Log.write(playerName + "String_Node_Str" + companyName+ "String_Node_Str"+ Bank.format(parPrice));
  companyNeedingPrice.start(startSpace);
  if (!companyNeedingPrice.hasFloated() && Bank.getIpo().countShares(companyNeedingPrice) <= (100 - companyNeedingPrice.getFloatPercentage())) {
    companyNeedingPrice.setFloated(10 * parPrice);
    Log.write(companyName + "String_Node_Str" + Bank.format(companyNeedingPrice.getCash()));
  }
  companyNeedingPrice=null;
  setNextAction();
  return true;
}

Fixed version (ground truth):
/** 
 * Set a par price.
 * @param playerName The name of the par price setting player.
 * @param companyName The name of teh company for which a par price is set.
 * @param parPrice The par price.
 */
public boolean setPrice(String playerName,String companyName,int parPrice){
  String errMsg=null;
  Player player=GameManager.getCurrentPlayer();
  StockSpaceI startSpace=null;
  while (true) {
    if (!playerName.equals(player.getName())) {
      errMsg="String_Node_Str";
      break;
    }
    if (!companyName.equals(companyNeedingPrice.getName())) {
      errMsg="String_Node_Str";
      break;
    }
    if ((startSpace=StockMarket.getInstance().getStartSpace(parPrice)) == null) {
      errMsg="String_Node_Str";
      break;
    }
    break;
  }
  if (errMsg != null) {
    Log.error("String_Node_Str" + Bank.format(parPrice) + "String_Node_Str"+ playerName+ "String_Node_Str"+ companyName+ "String_Node_Str"+ errMsg);
    return false;
  }
  Log.write(playerName + "String_Node_Str" + companyName+ "String_Node_Str"+ Bank.format(parPrice));
  companyNeedingPrice.start(startSpace);
  if (!companyNeedingPrice.hasFloated() && Bank.getIpo().ownsShare(companyNeedingPrice) <= (100 - companyNeedingPrice.getFloatPercentage())) {
    companyNeedingPrice.setFloated(10 * parPrice);
    Log.write(companyName + "String_Node_Str" + Bank.format(companyNeedingPrice.getCash()));
  }
  companyNeedingPrice=null;
  setNextAction();
  return true;
}
Program: 173925
Project: 173925
Buggy source:
/** 
 * Check if the current player can sell shares of a given company.
 * @param company The company to be checked
 * @return True if shares of the company can be sold.TODO Make Bank Pool share limit configurable.
 */
public boolean isCompanySellable(PublicCompanyI company){
  if (currentPlayer.getPortfolio().findCertificate(company,false) == null)   return false;
  if (pool.countShares(company) * company.getShareUnit() >= 50)   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Check if the current player can sell shares of a company.
 * @param companyName Name of the company to be checked
 * @return True if the company can be sold.TODO Make Bank Pool share limit configurable.
 */
public boolean isCompanySellable(String companyName){
  PublicCompanyI company=companyMgr.getPublicCompany(companyName);
  if (currentPlayer.getPortfolio().ownsShare(company) == 0)   return false;
  if (pool.ownsShare(company) >= Bank.getPoolShareLimit())   return false;
  return true;
}
Program: 173927
Project: 173927
Buggy source:
/** 
 * Central method for transferring all cash.
 * @param from Who pays the money (null = Bank).
 * @param to Who received the money (null = Bank).
 * @param amount The amount of money.
 */
public static void transferCash(CashHolder from,CashHolder to,int amount){
  if (from == null)   from=instance;
 else   if (to == null)   to=instance;
  from.addCash(-amount);
  to.addCash(amount);
}

Fixed version (ground truth):
/** 
 * Central method for transferring all cash.
 * @param from Who pays the money (null = Bank).
 * @param to Who received the money (null = Bank).
 * @param amount The amount of money.
 */
public static void transferCash(CashHolder from,CashHolder to,int amount){
  if (from == null)   from=instance;
 else   if (to == null)   to=instance;
  System.out.println("String_Node_Str" + amount);
  from.addCash(-amount);
  to.addCash(amount);
}
Program: 173928
Project: 173928
Buggy source:
public void buyShare(Certificate share) throws NullPointerException {
  if (hasBoughtStockThisTurn)   return;
  for (int i=0; i < companiesSoldThisTurn.size(); i++) {
    if (share.company.getName().equalsIgnoreCase(companiesSoldThisTurn.get(i).toString()))     return;
  }
  if (portfolio.getCertificates().size() >= playerCertificateLimit)   return;
  try {
    getPortfolio().buyCertificate(share,portfolio,share.getCertificatePrice());
  }
 catch (  NullPointerException e) {
    throw e;
  }
  Game.getPlayerManager().setBoughtStockLast(this);
  hasBoughtStockThisTurn=true;
}

Fixed version (ground truth):
public void buyShare(Certificate share) throws NullPointerException {
  if (hasBoughtStockThisTurn)   return;
  for (int i=0; i < companiesSoldThisTurn.size(); i++) {
    if (share.company.getName().equalsIgnoreCase(companiesSoldThisTurn.get(i).toString()))     return;
  }
  if (portfolio.getCertificates().size() >= playerCertificateLimit)   return;
  try {
    getPortfolio().buyCertificate(share,share.getPortfolio(),share.getCompany().getCurrentPrice().getPrice());
  }
 catch (  NullPointerException e) {
    throw e;
  }
  Game.getPlayerManager().setBoughtStockLast(this);
  hasBoughtStockThisTurn=true;
}
Program: 173929
Project: 173929
Buggy source:
public CertificateI getNextAvailableCertificate(PublicCompanyI company){
  ArrayList certs=(ArrayList)company.getCertificates();
  for (int i=0; i < certs.size(); i++) {
    if (((CertificateI)certs.get(i)).isAvailable()) {
      return (CertificateI)certs.get(i);
    }
  }
  return null;
}

Fixed version (ground truth):
public CertificateI getNextAvailableCertificate(){
  for (int i=0; i < certificates.size(); i++) {
    if (((CertificateI)certificates.get(i)).isAvailable()) {
      return (CertificateI)certificates.get(i);
    }
  }
  return null;
}
Program: 173930
Project: 173930
Buggy source:
public void buyCertificate(CertificateI certificate,Portfolio from,int price){
  if (owner instanceof Player) {
  }
 else {
    Log.write(from.getName() + "String_Node_Str" + certificate.getShare()+ "String_Node_Str"+ certificate.getCompany().getName()+ "String_Node_Str"+ getName()+ "String_Node_Str"+ price+ "String_Node_Str");
  }
  from.removeCertificate(certificate);
  this.addCertificate(certificate);
  certificate.setPortfolio(this);
  certificate.setAvailable(false);
  Bank.transferCash(owner,from.owner,price);
}

Fixed version (ground truth):
public void buyCertificate(CertificateI certificate,Portfolio from,int price){
  if (owner instanceof Player) {
    Log.write(from.getName() + "String_Node_Str" + certificate.getShare()+ "String_Node_Str"+ certificate.getCompany().getName()+ "String_Node_Str"+ getName()+ "String_Node_Str"+ price+ "String_Node_Str");
  }
 else {
    Log.write(from.getName() + "String_Node_Str" + certificate.getShare()+ "String_Node_Str"+ certificate.getCompany().getName()+ "String_Node_Str"+ getName()+ "String_Node_Str"+ price+ "String_Node_Str");
  }
  from.removeCertificate(certificate);
  this.addCertificate(certificate);
  certificate.setPortfolio(this);
  certificate.setAvailable(false);
  if (from.name.equalsIgnoreCase("String_Node_Str"))   Bank.transferCash(owner,(PublicCompany)certificate.getCompany(),price);
 else   Bank.transferCash(owner,from.owner,price);
}