nus-yam/ex-repair huggingface dataset:
Program: 20206
Project: 20206
Buggy source:
private String getCardType(String sCardNumber){
  String c="String_Node_Str";
  if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str") || sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str") || sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
  return c;
}

Fixed version (ground truth):
private String getCardType(String sCardNumber){
  String c="String_Node_Str";
  if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str") || sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str") || sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
 else   if (sCardNumber.startsWith("String_Node_Str")) {
    c="String_Node_Str";
  }
  return c;
}
Program: 20211
Project: 20211
Buggy source:
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  DynaActionForm inputFormPlace=(DynaActionForm)form;
  RestaurantManager manager=new RestaurantManager();
  List<CategoryInfo> categories=new ArrayList<CategoryInfo>();
  categories=manager.findAllCategories();
  List products=new ArrayList<ProductInfoExt>();
  products=manager.findProductsByCategory(categories.get(0).getId());
  List subcategories=new ArrayList<CategoryInfo>();
  subcategories=manager.findAllSubcategories(categories.get(0).getId());
  request.setAttribute("String_Node_Str",products);
  request.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  request.setAttribute("String_Node_Str",manager.findPlaceNameById((String)inputFormPlace.get("String_Node_Str")));
  request.setAttribute("String_Node_Str",categories);
  request.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  return mapping.findForward(SUCCESS);
}

Fixed version (ground truth):
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  DynaActionForm inputFormPlace=(DynaActionForm)form;
  RestaurantManager manager=new RestaurantManager();
  List<CategoryInfo> categories=new ArrayList<CategoryInfo>();
  categories=manager.findAllCategories();
  List products=new ArrayList<ProductInfoExt>();
  products=manager.findProductsByCategory(categories.get(0).getId());
  List subcategories=new ArrayList<CategoryInfo>();
  subcategories=manager.findAllSubcategories(categories.get(0).getId());
  request.setAttribute("String_Node_Str",products);
  request.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  request.setAttribute("String_Node_Str",manager.findPlaceNameById((String)inputFormPlace.get("String_Node_Str")));
  request.setAttribute("String_Node_Str",categories);
  request.setAttribute("String_Node_Str",subcategories);
  request.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  return mapping.findForward(SUCCESS);
}
Program: 20212
Project: 20212
Buggy source:
public void addLineToTicket(String ticketId,String productId){
  ticket=new TicketDAO();
  product=new ProductDAO();
  category=new CategoryDAO();
  tax=new TaxDAO();
  taxesLogic=new TaxesLogic(tax.getTaxList());
  TicketInfo obj=ticket.getTicket(ticketId);
  ProductInfo productObj=null;
  productObj=product.findProductById(productId);
  TicketLineInfo line=new TicketLineInfo(productObj,productObj.getPriceSell(),taxesLogic.getTaxInfo(productObj.getCategoryId()));
  obj.addLine(line);
  ticket.updateTicket(ticketId,obj);
  refreshTax(obj);
}

Fixed version (ground truth):
public void addLineToTicket(String ticketId,String productId){
  ticket=new TicketDAO();
  product=new ProductDAO();
  category=new CategoryDAO();
  tax=new TaxDAO();
  taxesLogic=new TaxesLogic(tax.getTaxList());
  TicketInfo obj=ticket.getTicket(ticketId);
  ProductInfo productObj=product.findProductById(productId);
  TicketLineInfo line=new TicketLineInfo(productObj,productObj.getPriceSell(),taxesLogic.getTaxInfo(productObj.getCategoryId()));
  obj.addLine(line);
  ticket.updateTicket(ticketId,obj);
  refreshTax(obj);
}
Program: 20213
Project: 20213
Buggy source:
public UserInfo findUser(String login,String password){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  UserInfo user=null;
  String sqlStr="String_Node_Str";
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,login);
    if (password.equals("String_Node_Str")) {
      ps.setString(2,null);
    }
 else {
      ps.setString(2,StringUtils.hashString(password));
    }
    rs=ps.executeQuery();
    user=map2VO(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return user;
}

Fixed version (ground truth):
public UserInfo findUser(String login,String password){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  UserInfo user=null;
  String sqlStr="String_Node_Str";
  String end="String_Node_Str";
  if (password.equals("String_Node_Str")) {
    end="String_Node_Str";
  }
 else {
    end="String_Node_Str";
  }
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr + end);
    ps.setString(1,login);
    if (!password.equals("String_Node_Str")) {
      ps.setString(2,StringUtils.hashString(password));
    }
    rs=ps.executeQuery();
    user=map2VO(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return user;
}
Program: 20214
Project: 20214
Buggy source:
@Override protected UserInfo map2VO(ResultSet rs) throws SQLException {
  UserInfo user=new UserInfo();
  rs.next();
  user.setLogin(rs.getString("String_Node_Str"));
  user.setPassword(rs.getString("String_Node_Str"));
  return user;
}

Fixed version (ground truth):
@Override protected UserInfo map2VO(ResultSet rs) throws SQLException {
  UserInfo user=new UserInfo();
  rs.next();
  user.setLogin(rs.getString("String_Node_Str"));
  if (rs.getString("String_Node_Str") == null) {
    user.setPassword("String_Node_Str");
  }
 else {
    user.setPassword(rs.getString("String_Node_Str"));
  }
  return user;
}
Program: 20215
Project: 20215
Buggy source:
public static int getLineMult(int iSize){
switch (iSize) {
case 0:
case 2:
    return 1;
case 1:
case 3:
  return 2;
default :
return 0;
}
}

Fixed version (ground truth):
public static int getLineMult(int iSize){
switch (iSize) {
case 0:
case 2:
    return 1;
case 1:
case 3:
  return 2;
default :
return 1;
}
}
Program: 20216
Project: 20216
Buggy source:
public Font getFont(Font baseFont,int iStyle){
  Font f;
switch (m_iSize) {
case 0:
    f=baseFont;
  break;
case 2:
f=baseFont.deriveFont(AffineTransform.getScaleInstance(2.0,1.0));
break;
case 1:
f=baseFont.deriveFont(AffineTransform.getScaleInstance(1.0,2.0));
break;
case 3:
f=baseFont.deriveFont(AffineTransform.getScaleInstance(2.0,2.0));
break;
default :
f=baseFont;
break;
}
f=f.deriveFont((iStyle & DevicePrinter.STYLE_BOLD) != 0 ? Font.BOLD : Font.PLAIN);
return f;
}

Fixed version (ground truth):
public Font getFont(Font baseFont,int iStyle){
  Font f;
  AffineTransform a;
switch (m_iSize) {
case 0:
    f=baseFont;
  break;
case 2:
a=AffineTransform.getScaleInstance(2.0,1.0);
a.preConcatenate(baseFont.getTransform());
f=baseFont.deriveFont(a);
break;
case 1:
a=AffineTransform.getScaleInstance(1.0,2.0);
a.preConcatenate(baseFont.getTransform());
f=baseFont.deriveFont(a);
break;
case 3:
a=AffineTransform.getScaleInstance(2.0,2.0);
a.preConcatenate(baseFont.getTransform());
f=baseFont.deriveFont(a);
break;
default :
f=baseFont;
break;
}
f=f.deriveFont((iStyle & DevicePrinter.STYLE_BOLD) != 0 ? Font.BOLD : baseFont.getStyle());
return f;
}
Program: 20217
Project: 20217
Buggy source:
public BigDecimal getTotalOfaTicket(String place){
  double total=0;
  for (  TicketLineInfo line : findTicket(place).getM_aLines()) {
    total+=line.getPrice() + line.getPrice() * line.getTax().getRate();
  }
  return BigDecimal.valueOf(total);
}

Fixed version (ground truth):
public BigDecimal getTotalOfaTicket(String place){
  double total=0;
  for (  TicketLineInfo line : findTicket(place).getM_aLines()) {
    try {
      total+=line.getMultiply() * (line.getPrice() + line.getPrice() * line.getTax().getRate());
    }
 catch (    NullPointerException e) {
      total+=line.getMultiply() * line.getPrice();
    }
  }
  return BigDecimal.valueOf(total);
}
Program: 20218
Project: 20218
Buggy source:
public String findPlaceById(String placeId){
  place=new PlaceDAO();
  return place.findPlaceById(placeId).getName();
}

Fixed version (ground truth):
public Place findPlaceById(String placeId){
  place=new PlaceDAO();
  return place.findPlaceById(placeId);
}
Program: 20219
Project: 20219
Buggy source:
public void addLineToTicket(String ticketId,String aCategory,String productIndex){
  lines=new TicketLineDAO();
  ticket=new TicketDAO();
  product=new ProductDAO();
  category=new CategoryDAO();
  tax=new TaxDAO();
  taxesLogic=new TaxesLogic(tax.getTaxList());
  TicketInfo obj=ticket.getTicket(ticketId);
  ProductInfo productObj=null;
  if (aCategory.equals("String_Node_Str")) {
    aCategory=category.findFirstCategory();
  }
  productObj=product.findProductsByCategory(aCategory).get(Integer.valueOf(productIndex));
  TicketLineInfo line=new TicketLineInfo(productObj,productObj.getPriceSell(),taxesLogic.getTaxInfo(productObj.getCategoryID()));
  obj.addLine(line);
  ticket.updateTicket(ticketId,obj);
  refreshTax(obj);
}

Fixed version (ground truth):
public void addLineToTicket(String ticketId,String productId){
  ticket=new TicketDAO();
  product=new ProductDAO();
  category=new CategoryDAO();
  tax=new TaxDAO();
  taxesLogic=new TaxesLogic(tax.getTaxList());
  TicketInfo obj=ticket.getTicket(ticketId);
  ProductInfo productObj=null;
  productObj=product.findProductById(productId);
  TicketLineInfo line=new TicketLineInfo(productObj,productObj.getPriceSell(),taxesLogic.getTaxInfo(productObj.getCategoryId()));
  obj.addLine(line);
  ticket.updateTicket(ticketId,obj);
  refreshTax(obj);
}
Program: 20220
Project: 20220
Buggy source:
public String findFloorById(String floorId){
  floor=new FloorDAO();
  return floor.findFloorById(floorId).getName();
}

Fixed version (ground truth):
public Floor findFloorById(String floorId){
  floor=new FloorDAO();
  return floor.findFloorById(floorId);
}
Program: 20221
Project: 20221
Buggy source:
@Override protected ProductInfo map2VO(ResultSet rs) throws SQLException {
  ProductInfo product=new ProductInfo();
  product.setId(rs.getString("String_Node_Str"));
  product.setRef(rs.getString("String_Node_Str"));
  product.setCode(rs.getString("String_Node_Str"));
  product.setName(rs.getString("String_Node_Str"));
  product.setPriceBuy(rs.getDouble("String_Node_Str"));
  product.setPriceSell(rs.getDouble("String_Node_Str"));
  product.setCategoryID(rs.getString("String_Node_Str"));
  product.setTaxcat(rs.getString("String_Node_Str"));
  product.setCom(rs.getBoolean("String_Node_Str"));
  product.setScale(rs.getBoolean("String_Node_Str"));
  return product;
}

Fixed version (ground truth):
@Override protected ProductInfo map2VO(ResultSet rs) throws SQLException {
  ProductInfo product=new ProductInfo();
  product.setId(rs.getString("String_Node_Str"));
  product.setRef(rs.getString("String_Node_Str"));
  product.setCode(rs.getString("String_Node_Str"));
  product.setName(rs.getString("String_Node_Str"));
  product.setPriceBuy(rs.getDouble("String_Node_Str"));
  product.setPriceSell(rs.getDouble("String_Node_Str"));
  product.setCategoryId(rs.getString("String_Node_Str"));
  product.setTaxcat(rs.getString("String_Node_Str"));
  product.setCom(rs.getBoolean("String_Node_Str"));
  product.setScale(rs.getBoolean("String_Node_Str"));
  return product;
}
Program: 20222
Project: 20222
Buggy source:
public TicketInfo getTicket(String id){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  String sqlStr="String_Node_Str";
  TicketInfo ticket=new TicketInfo();
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,id);
    rs=ps.executeQuery();
    rs.next();
    ObjectInputStream in=new ObjectInputStream(new BufferedInputStream(rs.getBinaryStream(1)));
    ticket=(TicketInfo)in.readObject();
  }
 catch (  Exception ex) {
    Logger.getLogger(TicketDAO.class.getName()).log(Level.SEVERE,null,ex);
    return null;
  }
  return ticket;
}

Fixed version (ground truth):
public TicketInfo getTicket(String id){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  String sqlStr="String_Node_Str";
  TicketInfo ticket=new TicketInfo();
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,id);
    rs=ps.executeQuery();
    rs.next();
    ObjectInputStream in=new ObjectInputStream(new BufferedInputStream(rs.getBinaryStream(1)));
    ticket=(TicketInfo)in.readObject();
  }
 catch (  Exception ex) {
    return null;
  }
  return ticket;
}
Program: 20223
Project: 20223
Buggy source:
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  FloorForm aForm=(FloorForm)form;
  RestaurantManager manager=new RestaurantManager();
  TicketInfo ticket=manager.findTicket(aForm.getId());
  List<TicketLineInfo> list=ticket.getM_aLines();
  String[] array=aForm.getParameters();
  list.get(Integer.valueOf(aForm.getLine())).setMultiply(Double.valueOf(array[0]));
  manager.updateLineFromTicket(aForm.getId(),ticket);
  request.setAttribute("String_Node_Str",aForm.getLine());
  request.setAttribute("String_Node_Str",ticket.getName());
  return mapping.findForward(SUCCESS);
}

Fixed version (ground truth):
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  FloorForm floorForm=(FloorForm)form;
  RestaurantManager manager=new RestaurantManager();
  String floorId=(String)floorForm.getFloorId();
  String place=(String)floorForm.getId();
  String str=(String)floorForm.getMode();
  String[] array=floorForm.getParameters();
  List<TicketLineInfo> linesList=new ArrayList<TicketLineInfo>();
  List products=new ArrayList<ProductInfoExt>();
  TicketInfo ticket=manager.findTicket(place);
  linesList=ticket.getM_aLines();
  if (array != null) {
    for (int i=0; i < array.length; i++) {
      linesList.get(Integer.valueOf(array[i]) - 0).setMultiply(linesList.get(Integer.valueOf(array[i]) - 0).getMultiply() + 1);
    }
  }
  manager.updateLineFromTicket(floorForm.getId(),ticket);
  for (  Object line : linesList) {
    TicketLineInfo li=(TicketLineInfo)line;
    products.add(manager.findProductById(li.getProductid()));
  }
  request.setAttribute("String_Node_Str",manager.findFloorById(manager.findPlaceById(place).getFloor()).getName());
  request.setAttribute("String_Node_Str",place);
  request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
  request.setAttribute("String_Node_Str",floorId);
  request.setAttribute("String_Node_Str",linesList);
  request.setAttribute("String_Node_Str",products);
  request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
  return mapping.findForward(SUCCESS);
}
Program: 20224
Project: 20224
Buggy source:
protected void internalWrite(byte[] data){
  try {
    if (m_out == null) {
      m_PortIdPrinter=CommPortIdentifier.getPortIdentifier(m_sPortPrinter);
      m_CommPortPrinter=m_PortIdPrinter.open("String_Node_Str",2000);
      m_out=m_CommPortPrinter.getOutputStream();
      if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_SERIAL) {
        ((SerialPort)m_CommPortPrinter).setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
      }
    }
    m_out.write(data);
  }
 catch (  NoSuchPortException e) {
    System.err.println(e);
  }
catch (  PortInUseException e) {
    System.err.println(e);
  }
catch (  UnsupportedCommOperationException e) {
    System.err.println(e);
  }
catch (  IOException e) {
    System.err.println(e);
  }
}

Fixed version (ground truth):
protected void internalWrite(byte[] data){
  try {
    if (m_out == null) {
      m_PortIdPrinter=CommPortIdentifier.getPortIdentifier(m_sPortPrinter);
      m_CommPortPrinter=m_PortIdPrinter.open("String_Node_Str",2000);
      m_out=m_CommPortPrinter.getOutputStream();
      if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_SERIAL) {
        ((SerialPort)m_CommPortPrinter).setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
        ((SerialPort)m_CommPortPrinter).setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN);
      }
    }
    m_out.write(data);
  }
 catch (  NoSuchPortException e) {
    System.err.println(e);
  }
catch (  PortInUseException e) {
    System.err.println(e);
  }
catch (  UnsupportedCommOperationException e) {
    System.err.println(e);
  }
catch (  IOException e) {
    System.err.println(e);
  }
}
Program: 20225
Project: 20225
Buggy source:
public TicketLineInfo copyTicketLine(){
  TicketLineInfo l=new TicketLineInfo();
  l.productid=productid;
  l.multiply=multiply;
  l.price=price;
  l.tax=tax;
  l.attributes=(Properties)attributes.clone();
  return l;
}

Fixed version (ground truth):
public TicketLineInfo copyTicketLine(){
  TicketLineInfo l=new TicketLineInfo();
  l.productid=productid;
  l.attsetinstid=attsetinstid;
  l.multiply=multiply;
  l.price=price;
  l.tax=tax;
  l.attributes=(Properties)attributes.clone();
  return l;
}
Program: 20226
Project: 20226
Buggy source:
private void init(String productid,double dMultiply,double dPrice,TaxInfo tax,Properties attributes){
  this.productid=productid;
  attsetinstid=null;
  multiply=dMultiply;
  price=dPrice;
  this.tax=tax;
  this.attributes=attributes;
  m_sTicket=null;
  m_iLine=-1;
}

Fixed version (ground truth):
private void init(String productid,String attsetinstid,double dMultiply,double dPrice,TaxInfo tax,Properties attributes){
  this.productid=productid;
  this.attsetinstid=attsetinstid;
  multiply=dMultiply;
  price=dPrice;
  this.tax=tax;
  this.attributes=attributes;
  m_sTicket=null;
  m_iLine=-1;
}
Program: 20227
Project: 20227
Buggy source:
public TicketLineInfo(TicketLineInfo line){
  init(line.productid,line.multiply,line.price,line.tax,(Properties)line.attributes.clone());
}

Fixed version (ground truth):
public TicketLineInfo(TicketLineInfo line){
  init(line.productid,line.attsetinstid,line.multiply,line.price,line.tax,(Properties)line.attributes.clone());
}
Program: 20228
Project: 20228
Buggy source:
public byte[] transImage(BufferedImage image){
  CenteredImage centeredimage=new CenteredImage(image,IMAGE_WIDTH);
  int iWidth=(centeredimage.getWidth() + 7) / 8;
  int iHeight=centeredimage.getHeight();
  byte[] bData=new byte[getImageHeader().length + 4 + iWidth * iHeight];
  System.arraycopy(getImageHeader(),0,bData,0,getImageHeader().length);
  int index=getImageHeader().length;
  bData[index++]=(byte)(iWidth % 256);
  bData[index++]=(byte)(iWidth / 256);
  bData[index++]=(byte)(iHeight % 256);
  bData[index++]=(byte)(iHeight / 256);
  int iRGB;
  int p;
  for (int i=0; i < centeredimage.getHeight(); i++) {
    for (int j=0; j < centeredimage.getWidth(); j=j + 8) {
      p=0x00;
      for (int d=0; d < 8; d++) {
        p=p << 1;
        if (centeredimage.isBlack(j + d,i)) {
          p=p | 0x01;
        }
      }
      bData[index++]=(byte)p;
    }
  }
  return bData;
}

Fixed version (ground truth):
public byte[] transImage(BufferedImage image){
  CenteredImage centeredimage=new CenteredImage(image,getImageWidth());
  int iWidth=(centeredimage.getWidth() + 7) / 8;
  int iHeight=centeredimage.getHeight();
  byte[] bData=new byte[getImageHeader().length + 4 + iWidth * iHeight];
  System.arraycopy(getImageHeader(),0,bData,0,getImageHeader().length);
  int index=getImageHeader().length;
  bData[index++]=(byte)(iWidth % 256);
  bData[index++]=(byte)(iWidth / 256);
  bData[index++]=(byte)(iHeight % 256);
  bData[index++]=(byte)(iHeight / 256);
  int iRGB;
  int p;
  for (int i=0; i < centeredimage.getHeight(); i++) {
    for (int j=0; j < centeredimage.getWidth(); j=j + 8) {
      p=0x00;
      for (int d=0; d < 8; d++) {
        p=p << 1;
        if (centeredimage.isBlack(j + d,i)) {
          p=p | 0x01;
        }
      }
      bData[index++]=(byte)p;
    }
  }
  return bData;
}
Program: 20229
Project: 20229
Buggy source:
@Override public byte[] transImage(BufferedImage image){
  CenteredImage centeredimage=new CenteredImage(image,IMAGE_WIDTH);
  int iWidth=centeredimage.getWidth();
  int iHeight=(centeredimage.getHeight() + 7) / 8;
  byte[] bData=new byte[IMAGE_BEGIN.length + (getImageHeader().length + 2 + iWidth+ getNewLine().length) * iHeight + IMAGE_END.length];
  int index=0;
  System.arraycopy(IMAGE_BEGIN,0,bData,index,IMAGE_BEGIN.length);
  index+=IMAGE_BEGIN.length;
  int p;
  for (int i=0; i < centeredimage.getHeight(); i+=8) {
    System.arraycopy(getImageHeader(),0,bData,index,getImageHeader().length);
    index+=getImageHeader().length;
    bData[index++]=(byte)(iWidth % 256);
    bData[index++]=(byte)(iWidth / 256);
    for (int j=0; j < centeredimage.getWidth(); j++) {
      p=0x00;
      for (int d=0; d < 8; d++) {
        p=p << 1;
        if (centeredimage.isBlack(j,i + d)) {
          p=p | 0x01;
        }
      }
      bData[index++]=(byte)p;
    }
    System.arraycopy(getNewLine(),0,bData,index,getNewLine().length);
    index+=getNewLine().length;
  }
  System.arraycopy(IMAGE_END,0,bData,index,IMAGE_END.length);
  index+=IMAGE_END.length;
  return bData;
}

Fixed version (ground truth):
@Override public byte[] transImage(BufferedImage image){
  CenteredImage centeredimage=new CenteredImage(image,getImageWidth());
  int iWidth=centeredimage.getWidth();
  int iHeight=(centeredimage.getHeight() + 7) / 8;
  byte[] bData=new byte[IMAGE_BEGIN.length + (getImageHeader().length + 2 + iWidth+ getNewLine().length) * iHeight + IMAGE_END.length];
  int index=0;
  System.arraycopy(IMAGE_BEGIN,0,bData,index,IMAGE_BEGIN.length);
  index+=IMAGE_BEGIN.length;
  int p;
  for (int i=0; i < centeredimage.getHeight(); i+=8) {
    System.arraycopy(getImageHeader(),0,bData,index,getImageHeader().length);
    index+=getImageHeader().length;
    bData[index++]=(byte)(iWidth % 256);
    bData[index++]=(byte)(iWidth / 256);
    for (int j=0; j < centeredimage.getWidth(); j++) {
      p=0x00;
      for (int d=0; d < 8; d++) {
        p=p << 1;
        if (centeredimage.isBlack(j,i + d)) {
          p=p | 0x01;
        }
      }
      bData[index++]=(byte)p;
    }
    System.arraycopy(getNewLine(),0,bData,index,getNewLine().length);
    index+=getNewLine().length;
  }
  System.arraycopy(IMAGE_END,0,bData,index,IMAGE_END.length);
  index+=IMAGE_END.length;
  return bData;
}
Program: 20230
Project: 20230
Buggy source:
protected void internalWrite(byte[] data){
  try {
    if (m_out == null) {
      m_PortIdPrinter=CommPortIdentifier.getPortIdentifier(m_sPortPrinter);
      m_CommPortPrinter=m_PortIdPrinter.open("String_Node_Str",2000);
      m_out=m_CommPortPrinter.getOutputStream();
      if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_SERIAL) {
        ((SerialPort)m_CommPortPrinter).setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
      }
 else       if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
        ((ParallelPort)m_CommPortPrinter).setMode(1);
      }
    }
    m_out.write(data);
  }
 catch (  NoSuchPortException e) {
    System.err.println(e);
  }
catch (  PortInUseException e) {
    System.err.println(e);
  }
catch (  UnsupportedCommOperationException e) {
    System.err.println(e);
  }
catch (  IOException e) {
    System.err.println(e);
  }
}

Fixed version (ground truth):
protected void internalWrite(byte[] data){
  try {
    if (m_out == null) {
      m_PortIdPrinter=CommPortIdentifier.getPortIdentifier(m_sPortPrinter);
      m_CommPortPrinter=m_PortIdPrinter.open("String_Node_Str",2000);
      m_out=m_CommPortPrinter.getOutputStream();
      if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_SERIAL) {
        ((SerialPort)m_CommPortPrinter).setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
      }
    }
    m_out.write(data);
  }
 catch (  NoSuchPortException e) {
    System.err.println(e);
  }
catch (  PortInUseException e) {
    System.err.println(e);
  }
catch (  UnsupportedCommOperationException e) {
    System.err.println(e);
  }
catch (  IOException e) {
    System.err.println(e);
  }
}
Program: 20232
Project: 20232
Buggy source:
private void checkTracks(){
  if (m_cCardType != 'B')   return;
  String sCardNumber1=(m_aTrack1 == null || m_aTrack1.size() < 1) ? null : (String)m_aTrack1.get(0);
  String sCardNumber2=(m_aTrack2 == null || m_aTrack2.size() < 1) ? null : (String)m_aTrack2.get(0);
  String sHolderName=(m_aTrack1 == null || m_aTrack1.size() < 2) ? null : (String)m_aTrack1.get(1);
  String sExpDate1=(m_aTrack1 == null || m_aTrack1.size() < 3) ? null : ((String)m_aTrack1.get(2)).substring(0,4);
  String sExpDate2=(m_aTrack2 == null || m_aTrack2.size() < 2) ? null : ((String)m_aTrack2.get(1)).substring(0,4);
  if (!checkCardNumber(sCardNumber1) || (sCardNumber2 != null && !sCardNumber1.equals(sCardNumber2)))   return;
  if (sHolderName == null)   return;
  if ((sExpDate1 != null || !checkExpDate(sExpDate2)) && (!checkExpDate(sExpDate1) || !sExpDate1.equals(sExpDate2)))   return;
  m_sCardNumber=sCardNumber1;
  m_sHolderName=formatHolderName(sHolderName);
  m_sExpirationDate=sExpDate1 == null ? sExpDate2 : sExpDate1;
}

Fixed version (ground truth):
private void checkTracks(){
  if (m_cCardType != 'B')   return;
  String sCardNumber1=(m_aTrack1 == null || m_aTrack1.size() < 1) ? null : (String)m_aTrack1.get(0);
  String sCardNumber2=(m_aTrack2 == null || m_aTrack2.size() < 1) ? null : (String)m_aTrack2.get(0);
  String sHolderName=(m_aTrack1 == null || m_aTrack1.size() < 2) ? null : (String)m_aTrack1.get(1);
  String sExpDate1=(m_aTrack1 == null || m_aTrack1.size() < 3) ? null : ((String)m_aTrack1.get(2)).substring(0,4);
  String sExpDate2=(m_aTrack2 == null || m_aTrack2.size() < 2) ? null : ((String)m_aTrack2.get(1)).substring(0,4);
  if (!checkCardNumber(sCardNumber1) || (sCardNumber2 != null && !sCardNumber1.equals(sCardNumber2)))   return;
  if (sHolderName == null)   return;
  if ((sExpDate1 != null || !checkExpDate(sExpDate2)) && (!checkExpDate(sExpDate1) || !sExpDate1.equals(sExpDate2)))   return;
  m_sCardNumber=sCardNumber1;
  m_sHolderName=formatHolderName(sHolderName);
  String yymm=sExpDate1 == null ? sExpDate2 : sExpDate1;
  m_sExpirationDate=yymm.substring(2,4) + yymm.substring(0,2);
}
Program: 20233
Project: 20233
Buggy source:
private void m_jEditLineActionPerformed(java.awt.event.ActionEvent evt){
  int i=m_ticketlines.getSelectedIndex();
  if (i < 0) {
    Toolkit.getDefaultToolkit().beep();
  }
 else {
    TicketLineInfo newline=JProductLineEdit.showMessage(this,m_App,m_oTicket.getLine(i));
    if (newline != null) {
      paintTicketLine(i,newline);
    }
  }
}

Fixed version (ground truth):
private void m_jEditLineActionPerformed(java.awt.event.ActionEvent evt){
  int i=m_ticketlines.getSelectedIndex();
  if (i < 0) {
    Toolkit.getDefaultToolkit().beep();
  }
 else {
    try {
      TicketLineInfo newline=JProductLineEdit.showMessage(this,m_App,m_oTicket.getLine(i));
      if (newline != null) {
        paintTicketLine(i,newline);
      }
    }
 catch (    BasicException e) {
      new MessageInf(e).show(this);
    }
  }
}
Program: 20234
Project: 20234
Buggy source:
private TicketLineInfo init(AppView app,TicketLineInfo oLine){
  initComponents();
  m_oLine=new TicketLineInfo(oLine);
  m_bunitsok=true;
  m_bpriceok=true;
  m_jName.setEnabled(m_oLine.getProductID() == null && app.getAppUserView().getUser().hasPermission("String_Node_Str"));
  m_jPrice.setEnabled(app.getAppUserView().getUser().hasPermission("String_Node_Str"));
  m_jPriceTax.setEnabled(app.getAppUserView().getUser().hasPermission("String_Node_Str"));
  m_jName.setText(m_oLine.getProperty("String_Node_Str"));
  m_jUnits.setDoubleValue(oLine.getMultiply());
  m_jPrice.setDoubleValue(oLine.getPrice());
  m_jPriceTax.setDoubleValue(oLine.getPriceTax());
  m_jTaxrate.setText(oLine.getTaxInfo().getName());
  m_jName.addPropertyChangeListener("String_Node_Str",new RecalculateName());
  m_jUnits.addPropertyChangeListener("String_Node_Str",new RecalculateUnits());
  m_jPrice.addPropertyChangeListener("String_Node_Str",new RecalculatePrice());
  m_jPriceTax.addPropertyChangeListener("String_Node_Str",new RecalculatePriceTax());
  m_jName.addEditorKeys(m_jKeys);
  m_jUnits.addEditorKeys(m_jKeys);
  m_jPrice.addEditorKeys(m_jKeys);
  m_jPriceTax.addEditorKeys(m_jKeys);
  if (m_jName.isEnabled()) {
    m_jName.activate();
  }
 else {
    m_jUnits.activate();
  }
  printTotals();
  getRootPane().setDefaultButton(m_jButtonOK);
  returnLine=null;
  setVisible(true);
  return returnLine;
}

Fixed version (ground truth):
private TicketLineInfo init(AppView app,TicketLineInfo oLine) throws BasicException {
  initComponents();
  if (oLine.getTaxInfo() == null) {
    throw new BasicException(AppLocal.getIntString("String_Node_Str"));
  }
  m_oLine=new TicketLineInfo(oLine);
  m_bunitsok=true;
  m_bpriceok=true;
  m_jName.setEnabled(m_oLine.getProductID() == null && app.getAppUserView().getUser().hasPermission("String_Node_Str"));
  m_jPrice.setEnabled(app.getAppUserView().getUser().hasPermission("String_Node_Str"));
  m_jPriceTax.setEnabled(app.getAppUserView().getUser().hasPermission("String_Node_Str"));
  m_jName.setText(m_oLine.getProperty("String_Node_Str"));
  m_jUnits.setDoubleValue(oLine.getMultiply());
  m_jPrice.setDoubleValue(oLine.getPrice());
  m_jPriceTax.setDoubleValue(oLine.getPriceTax());
  m_jTaxrate.setText(oLine.getTaxInfo().getName());
  m_jName.addPropertyChangeListener("String_Node_Str",new RecalculateName());
  m_jUnits.addPropertyChangeListener("String_Node_Str",new RecalculateUnits());
  m_jPrice.addPropertyChangeListener("String_Node_Str",new RecalculatePrice());
  m_jPriceTax.addPropertyChangeListener("String_Node_Str",new RecalculatePriceTax());
  m_jName.addEditorKeys(m_jKeys);
  m_jUnits.addEditorKeys(m_jKeys);
  m_jPrice.addEditorKeys(m_jKeys);
  m_jPriceTax.addEditorKeys(m_jKeys);
  if (m_jName.isEnabled()) {
    m_jName.activate();
  }
 else {
    m_jUnits.activate();
  }
  printTotals();
  getRootPane().setDefaultButton(m_jButtonOK);
  returnLine=null;
  setVisible(true);
  return returnLine;
}
Program: 20235
Project: 20235
Buggy source:
public static TicketLineInfo showMessage(Component parent,AppView app,TicketLineInfo oLine){
  Window window=getWindow(parent);
  JProductLineEdit myMsg;
  if (window instanceof Frame) {
    myMsg=new JProductLineEdit((Frame)window,true);
  }
 else {
    myMsg=new JProductLineEdit((Dialog)window,true);
  }
  return myMsg.init(app,oLine);
}

Fixed version (ground truth):
public static TicketLineInfo showMessage(Component parent,AppView app,TicketLineInfo oLine) throws BasicException {
  Window window=getWindow(parent);
  JProductLineEdit myMsg;
  if (window instanceof Frame) {
    myMsg=new JProductLineEdit((Frame)window,true);
  }
 else {
    myMsg=new JProductLineEdit((Dialog)window,true);
  }
  return myMsg.init(app,oLine);
}
Program: 20236
Project: 20236
Buggy source:
public void fillPermissions(DataLogicSystem dlSystem){
  m_apermissions=new HashSet<String>();
  m_apermissions.add("String_Node_Str");
  m_apermissions.add("String_Node_Str");
  String sRolePermisions=dlSystem.findRolePermissions(m_sRole);
  if (sRolePermisions != null) {
    try {
      if (m_sp == null) {
        SAXParserFactory spf=SAXParserFactory.newInstance();
        m_sp=spf.newSAXParser();
      }
      m_sp.parse(new InputSource(new StringReader(sRolePermisions)),new ConfigurationHandler());
    }
 catch (    ParserConfigurationException ePC) {
      logger.log(Level.WARNING,"String_Node_Str",ePC);
    }
catch (    SAXException eSAX) {
      logger.log(Level.WARNING,"String_Node_Str",eSAX);
    }
catch (    IOException eIO) {
      logger.log(Level.WARNING,"String_Node_Str",eIO);
    }
  }
}

Fixed version (ground truth):
public void fillPermissions(DataLogicSystem dlSystem){
  m_apermissions=new HashSet<String>();
  m_apermissions.add("String_Node_Str");
  m_apermissions.add("String_Node_Str");
  String sRolePermisions=dlSystem.findRolePermissions(m_sRole);
  if (sRolePermisions != null) {
    try {
      if (m_sp == null) {
        SAXParserFactory spf=SAXParserFactory.newInstance();
        m_sp=spf.newSAXParser();
      }
      m_sp.parse(new InputSource(new StringReader(sRolePermisions)),new ConfigurationHandler());
    }
 catch (    ParserConfigurationException ePC) {
      logger.log(Level.WARNING,LocalRes.getIntString("String_Node_Str"),ePC);
    }
catch (    SAXException eSAX) {
      logger.log(Level.WARNING,LocalRes.getIntString("String_Node_Str"),eSAX);
    }
catch (    IOException eIO) {
      logger.log(Level.WARNING,LocalRes.getIntString("String_Node_Str"),eIO);
    }
  }
}
Program: 20237
Project: 20237
Buggy source:
public final SentenceExec getCatalogCategoryAdd(){
  return new StaticSentence(s,"String_Node_Str",SerializerWriteString.INSTANCE);
}

Fixed version (ground truth):
public final SentenceExec getCatalogCategoryAdd(){
  return new StaticSentence(s,"String_Node_Str" + s.DB.INTEGER_NULL() + "String_Node_Str",SerializerWriteString.INSTANCE);
}
Program: 20241
Project: 20241
Buggy source:
private void restoreProperties(){
  AppConfig config=new AppConfig(configfile);
  if (config.delete()) {
    loadProperties();
  }
 else {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str")));
  }
}

Fixed version (ground truth):
private void restoreProperties(){
  if (config.delete()) {
    loadProperties();
  }
 else {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str")));
  }
}
Program: 20242
Project: 20242
Buggy source:
public JPanelConfiguration(AppProperties props){
  configfile=props.getConfigFile();
  initComponents();
  m_panelconfig=new ArrayList<PanelConfig>();
  m_panelconfig.add(new JPanelConfigDatabase());
  m_panelconfig.add(new JPanelConfigGeneral());
  m_panelconfig.add(new JPanelConfigLocale());
  m_panelconfig.add(new JPanelConfigPayment());
  for (  PanelConfig c : m_panelconfig) {
    m_jConfigOptions.add(c.getConfigComponent());
  }
}

Fixed version (ground truth):
public JPanelConfiguration(AppProperties props){
  config=new AppConfig(props.getConfigFile());
  initComponents();
  m_panelconfig=new ArrayList<PanelConfig>();
  m_panelconfig.add(new JPanelConfigDatabase());
  m_panelconfig.add(new JPanelConfigGeneral());
  m_panelconfig.add(new JPanelConfigLocale());
  m_panelconfig.add(new JPanelConfigPayment());
  for (  PanelConfig c : m_panelconfig) {
    m_jConfigOptions.add(c.getConfigComponent());
  }
}
Program: 20243
Project: 20243
Buggy source:
private void saveProperties(){
  AppConfig config=new AppConfig(configfile);
  for (  PanelConfig c : m_panelconfig) {
    c.saveProperties(config);
  }
  try {
    config.save();
    JOptionPane.showMessageDialog(this,AppLocal.getIntString("String_Node_Str"),AppLocal.getIntString("String_Node_Str"),JOptionPane.INFORMATION_MESSAGE);
  }
 catch (  IOException e) {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str"),e));
  }
}

Fixed version (ground truth):
private void saveProperties(){
  for (  PanelConfig c : m_panelconfig) {
    c.saveProperties(config);
  }
  try {
    config.save();
    JOptionPane.showMessageDialog(this,AppLocal.getIntString("String_Node_Str"),AppLocal.getIntString("String_Node_Str"),JOptionPane.INFORMATION_MESSAGE);
  }
 catch (  IOException e) {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str"),e));
  }
}
Program: 20244
Project: 20244
Buggy source:
private void loadProperties(){
  AppConfig config=new AppConfig(configfile);
  config.load();
  for (  PanelConfig c : m_panelconfig) {
    c.loadProperties(config);
  }
}

Fixed version (ground truth):
private void loadProperties(){
  config.load();
  for (  PanelConfig c : m_panelconfig) {
    c.loadProperties(config);
  }
}
Program: 20245
Project: 20245
Buggy source:
public List<ProductInfoExt> getProductCatalog(String category) throws BasicException {
  return new PreparedSentence(s,"String_Node_Str" + "String_Node_Str" + "String_Node_Str" + s.DB.FALSE() + "String_Node_Str"+ "String_Node_Str",SerializerWriteString.INSTANCE,ProductInfoExt.getSerializerRead()).list(category);
}

Fixed version (ground truth):
public List<ProductInfoExt> getProductCatalog(String category) throws BasicException {
  return new PreparedSentence(s,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",SerializerWriteString.INSTANCE,ProductInfoExt.getSerializerRead()).list(category);
}
Program: 20247
Project: 20247
Buggy source:
public String getTrack2(){
  return track1;
}

Fixed version (ground truth):
public String getTrack2(boolean framingChar){
  return (framingChar) ? track2 : track2.substring(1,track2.length() - 2);
}
Program: 20248
Project: 20248
Buggy source:
public String getTrack1(){
  return track1;
}

Fixed version (ground truth):
/** 
 * Get tracks of magnetic card. Framing characters:  - start sentinel (SS) - end sentinel (ES)  - LRC 
 * @param framingChar true: including framing characters false: exluding framing characters
 * @return tracks of the magnetic card
 */
public String getTrack1(boolean framingChar){
  return (framingChar) ? track1 : track1.substring(1,track1.length() - 2);
}
Program: 20249
Project: 20249
Buggy source:
public String getTrack3(){
  return track1;
}

Fixed version (ground truth):
public String getTrack3(boolean framingChar){
  return (framingChar) ? track3 : track3.substring(1,track3.length() - 2);
}
Program: 20250
Project: 20250
Buggy source:
public byte transChar(char sChar){
  if ((sChar >= 0x0000) && (sChar < 0x0080)) {
    return (byte)sChar;
  }
 else {
switch (sChar) {
case '\u00c1':
      return 0x41;
case '\u00c9':
    return 0x45;
case '\u00cd':
  return 0x49;
case '\u00d3':
return 0x4F;
case '\u00da':
return 0x55;
case '\u00FC':
return -0x7F;
case '\u00E9':
return -0x7E;
case '\u00DC':
return -0x66;
case '\u00A3':
return -0x64;
case '\u00A5':
return -0x63;
case '\u00E1':
return -0x60;
case '\u00ED':
return -0x5F;
case '\u00F3':
return -0x5E;
case '\u00FA':
return -0x5D;
case '\u00F1':
return -0x5C;
case '\u00D1':
return -0x5B;
case '\u00BF':
return -0x58;
case '\u00A1':
return -0x53;
case '\u20AC':
return -0x12;
default :
return 0x3F;
}
}
}

Fixed version (ground truth):
public byte transChar(char sChar){
  if ((sChar >= 0x0000) && (sChar < 0x0080)) {
    return (byte)sChar;
  }
 else {
switch (sChar) {
case '\u00c1':
      return 0x41;
case '\u00c9':
    return 0x45;
case '\u00cd':
  return 0x49;
case '\u00d3':
return 0x4F;
case '\u00da':
return 0x55;
case '\u00C7':
return -0x80;
case '\u00FC':
return -0x7F;
case '\u00E9':
return -0x7E;
case '\u00E4':
return -0x7C;
case '\u00E5':
return -0x7A;
case '\u00E7':
return -0x79;
case '\u00C4':
return -0x72;
case '\u00C5':
return -0x71;
case '\u00F6':
return -0x6C;
case '\u00D6':
return -0x67;
case '\u00DC':
return -0x66;
case '\u00A3':
return -0x64;
case '\u00A5':
return -0x63;
case '\u00E1':
return -0x60;
case '\u00ED':
return -0x5F;
case '\u00F3':
return -0x5E;
case '\u00FA':
return -0x5D;
case '\u00F1':
return -0x5C;
case '\u00D1':
return -0x5B;
case '\u00BF':
return -0x58;
case '\u00A1':
return -0x53;
case '\u20AC':
return -0x12;
default :
return 0x3F;
}
}
}
Program: 20252
Project: 20252
Buggy source:
private void defaultValues(){
  jListTickets.setModel(new MyListData(new ArrayList()));
  jcboUser.setSelectedItem(null);
  jtxtTicketID.reset();
  jtxtTicketID.activate();
  jCheckBoxSales.setSelected(false);
  jCheckBoxRefunds.setSelected(false);
  jcboUser.setSelectedItem(null);
  jcboMoney.setSelectedItem(((ListQBFModelNumber)jcboMoney.getModel()).getElementAt(0));
  jcboMoney.revalidate();
  jcboMoney.repaint();
  jtxtMoney.reset();
}

Fixed version (ground truth):
private void defaultValues(){
  jListTickets.setModel(new MyListData(new ArrayList()));
  jcboUser.setSelectedItem(null);
  jtxtTicketID.reset();
  jtxtTicketID.activate();
  jCheckBoxSales.setSelected(false);
  jCheckBoxRefunds.setSelected(false);
  jcboUser.setSelectedItem(null);
  jcboMoney.setSelectedItem(((ListQBFModelNumber)jcboMoney.getModel()).getElementAt(0));
  jcboMoney.revalidate();
  jcboMoney.repaint();
  jtxtMoney.reset();
  jParamsDatesInterval1.setStartDate(null);
  jParamsDatesInterval1.setEndDate(null);
}
Program: 20253
Project: 20253
Buggy source:
public void add(double dValue){
  subtotal+=dValue;
  taxtotal=RoundUtils.round(subtotal * tax.getRate());
}

Fixed version (ground truth):
public void add(double dValue){
  subtotal+=dValue;
  taxtotal=subtotal * tax.getRate();
}
Program: 20254
Project: 20254
Buggy source:
public void updateCurDebt(Double ammount,Date d){
  curdebt=RoundUtils.round(RoundUtils.getValue(curdebt) + ammount);
  if (RoundUtils.compare(curdebt,0.0) > 0) {
    if (curdate == null) {
      curdate=d;
    }
  }
 else   if (RoundUtils.compare(curdebt,0.0) == 0) {
    curdebt=null;
    curdate=null;
  }
 else {
    curdate=null;
  }
}

Fixed version (ground truth):
public void updateCurDebt(Double ammount,Date d){
  curdebt=curdebt + ammount;
  if (RoundUtils.compare(curdebt,0.0) > 0) {
    if (curdate == null) {
      curdate=d;
    }
  }
 else   if (RoundUtils.compare(curdebt,0.0) == 0) {
    curdebt=null;
    curdate=null;
  }
 else {
    curdate=null;
  }
}
Program: 20255
Project: 20255
Buggy source:
public void actionPerformed(ActionEvent e){
  Double tendered=m_jTendered.getDoubleValue();
  if (tendered == null) {
    m_jTendered.setDoubleValue(RoundUtils.round(amount));
  }
 else {
    m_jTendered.setDoubleValue(RoundUtils.round(tendered + amount));
  }
  printState();
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  Double tendered=m_jTendered.getDoubleValue();
  if (tendered == null) {
    m_jTendered.setDoubleValue(amount);
  }
 else {
    m_jTendered.setDoubleValue(tendered + amount);
  }
  printState();
}
Program: 20256
Project: 20256
Buggy source:
public double getTax(){
  double sum=0.0;
  if (hasTaxesCalculated()) {
    for (    TicketTaxInfo tax : taxes) {
      sum+=tax.getTax();
    }
  }
 else {
    for (    TicketLineInfo line : m_aLines) {
      sum+=RoundUtils.round(line.getTax());
    }
  }
  return sum;
}

Fixed version (ground truth):
public double getTax(){
  double sum=0.0;
  if (hasTaxesCalculated()) {
    for (    TicketTaxInfo tax : taxes) {
      sum+=tax.getTax();
    }
  }
 else {
    for (    TicketLineInfo line : m_aLines) {
      sum+=line.getTax();
    }
  }
  return sum;
}
Program: 20257
Project: 20257
Buggy source:
public void add(double dValue){
  subtotal+=dValue;
  taxtotal=RoundUtils.round(subtotal * tax.getRate());
}

Fixed version (ground truth):
public void add(double dValue){
  subtotal+=dValue;
  taxtotal=subtotal * tax.getRate();
}
Program: 20259
Project: 20259
Buggy source:
private void reload() throws BasicException {
  String attsetid=(String)filter.createValue();
  bd.setEditable(attsetid != null);
  bd.actionLoad();
  editor.setInsertId(attsetid);
}

Fixed version (ground truth):
private void reload() throws BasicException {
  String attsetid=(String)filter.createValue();
  editor.setInsertId(attsetid);
  bd.setEditable(attsetid != null);
  bd.actionLoad();
}
Program: 20260
Project: 20260
Buggy source:
private void reload() throws BasicException {
  String attid=(String)filter.createValue();
  bd.setEditable(attid != null);
  bd.actionLoad();
  editor.setInsertId(attid);
}

Fixed version (ground truth):
private void reload() throws BasicException {
  String attid=(String)filter.createValue();
  editor.setInsertId(attid);
  bd.setEditable(attid != null);
  bd.actionLoad();
}
Program: 20261
Project: 20261
Buggy source:
/** 
 * Creates new form JPaymentSelect 
 */
protected JPaymentSelect(java.awt.Dialog parent,boolean modal,ComponentOrientation o){
  super(parent,modal);
  initComponents();
  this.applyComponentOrientation(o);
  getRootPane().setDefaultButton(m_jButtonOK);
}

Fixed version (ground truth):
/** 
 * Creates new form JPaymentSelect 
 */
protected JPaymentSelect(java.awt.Dialog parent,boolean modal,ComponentOrientation o){
  super(parent,modal);
  initComponents();
  this.applyComponentOrientation(o);
}
Program: 20262
Project: 20262
Buggy source:
public boolean showDialog(double total,CustomerInfoExt customerext){
  m_aPaymentInfo=new PaymentInfoList();
  accepted=false;
  m_dTotal=total;
  this.customerext=customerext;
  m_jButtonPrint.setSelected(printselected);
  m_jTotalEuros.setText(Formats.CURRENCY.formatValue(new Double(m_dTotal)));
  addTabs();
  if (m_jTabPayment.getTabCount() == 0) {
    m_aPaymentInfo.add(getDefaultPayment(total));
    accepted=true;
  }
 else {
    printState();
    setVisible(true);
  }
  printselected=m_jButtonPrint.isSelected();
  m_jTabPayment.removeAll();
  return accepted;
}

Fixed version (ground truth):
public boolean showDialog(double total,CustomerInfoExt customerext){
  m_aPaymentInfo=new PaymentInfoList();
  accepted=false;
  m_dTotal=total;
  this.customerext=customerext;
  m_jButtonPrint.setSelected(printselected);
  m_jTotalEuros.setText(Formats.CURRENCY.formatValue(new Double(m_dTotal)));
  addTabs();
  if (m_jTabPayment.getTabCount() == 0) {
    m_aPaymentInfo.add(getDefaultPayment(total));
    accepted=true;
  }
 else {
    getRootPane().setDefaultButton(m_jButtonOK);
    printState();
    setVisible(true);
  }
  printselected=m_jButtonPrint.isSelected();
  m_jTabPayment.removeAll();
  return accepted;
}