nus-yam/ex-repair huggingface dataset:
Program: 5933
Project: 5933
Buggy source:
private void selectCategoryPanel(String catid){
  try {
    if (!m_categoriesset.contains(catid)) {
      JCatalogTab jcurrTab=new JCatalogTab();
      m_jProducts.add(jcurrTab,catid);
      m_categoriesset.add(catid);
      if (showDiscounts && catid.equals(AppLocal.getIntString("String_Node_Str"))) {
        java.util.List<DiscountInfo> discounts=(m_dlSales.getDiscountList()).list();
        for (        DiscountInfo d : discounts) {
          jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(null,d.getName())),new SelectedAction(d));
        }
      }
 else {
        java.util.List<CategoryInfo> categories=m_dlSales.getSubcategories(catid);
        for (        CategoryInfo cat : categories) {
          jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(cat.getImage(),cat.getName())),new SelectedCategory(cat));
        }
        java.util.List<ProductInfoExt> products=m_dlSales.getProductCatalog(catid);
        for (        ProductInfoExt prod : products) {
          prod.setMatCat(m_dlSales.getProductMatCat(prod.getID()).get(0).getID());
          jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(),getProductLabel(prod))),new SelectedAction(prod));
        }
      }
    }
    CardLayout cl=(CardLayout)(m_jProducts.getLayout());
    cl.show(m_jProducts,catid);
  }
 catch (  BasicException e) {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str"),e));
  }
}

Fixed version (ground truth):
private void selectCategoryPanel(String catid){
  try {
    if (!m_categoriesset.contains(catid)) {
      JCatalogTab jcurrTab=new JCatalogTab();
      m_jProducts.add(jcurrTab,catid);
      m_categoriesset.add(catid);
      if (showDiscounts && catid.equals(AppLocal.getIntString("String_Node_Str"))) {
        java.util.List<DiscountInfo> discounts=(m_dlSales.getDiscountList()).list();
        for (        DiscountInfo d : discounts) {
          jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(null,d.getName())),new SelectedAction(d));
        }
      }
 else {
        java.util.List<CategoryInfo> categories=m_dlSales.getSubcategories(catid);
        for (        CategoryInfo cat : categories) {
          jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(cat.getImage(),cat.getName())),new SelectedCategory(cat));
        }
        java.util.List<ProductInfoExt> products=m_dlSales.getProductCatalog(catid);
        for (        ProductInfoExt prod : products) {
          prod.setMatCat(m_dlSales.getProductMatCat(prod.getID()).get(0).getMatCatID());
          jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(),getProductLabel(prod))),new SelectedAction(prod));
        }
      }
    }
    CardLayout cl=(CardLayout)(m_jProducts.getLayout());
    cl.show(m_jProducts,catid);
  }
 catch (  BasicException e) {
    JMessageDialog.showMessage(this,new MessageInf(MessageInf.SGN_WARNING,AppLocal.getIntString("String_Node_Str"),e));
  }
}
Program: 5934
Project: 5934
Buggy source:
public final List<ProdMatCatsInfo> getProductMatCat(String id) throws BasicException {
  return new PreparedSentence(s,"String_Node_Str",SerializerWriteString.INSTANCE,new SerializerReadClass(ProdMatCatsInfo.class)).list(id);
}

Fixed version (ground truth):
public final List<ProdMatCatsInfo> getProductMatCat(String id) throws BasicException {
  return new PreparedSentence(s,"String_Node_Str" + "String_Node_Str",SerializerWriteString.INSTANCE,new SerializerReadClass(ProdMatCatsInfo.class)).list(id);
}
Program: 5935
Project: 5935
Buggy source:
public void readValues(DataRead dr) throws BasicException {
  c_ID=dr.getString(0);
}

Fixed version (ground truth):
public void readValues(DataRead dr) throws BasicException {
  c_ID=dr.getString(1);
}
Program: 5936
Project: 5936
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);
        ((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);
  }
}

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: 5937
Project: 5937
Buggy source:
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  attsetinstid=dr.getString(4);
  multiply=dr.getDouble(5);
  price=dr.getDouble(6);
  tax=new TaxInfo(dr.getString(7),dr.getString(8),dr.getString(9),dr.getTimestamp(10),dr.getString(11),dr.getString(12),dr.getDouble(13),dr.getBoolean(14),dr.getInt(15));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(15);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  attsetinstid=dr.getString(4);
  multiply=dr.getDouble(5);
  price=dr.getDouble(6);
  tax=new TaxInfo(dr.getString(7),dr.getString(8),dr.getString(9),dr.getTimestamp(10),dr.getString(11),dr.getString(12),dr.getDouble(13),dr.getBoolean(14),dr.getInt(15));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(16);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}
Program: 5939
Project: 5939
Buggy source:
public void beginReceipt(){
  m_ticketcurrent=new BasicTicket();
}

Fixed version (ground truth):
public void beginReceipt(){
  m_ticketcurrent=new BasicTicketForScreen();
}
Program: 5940
Project: 5940
Buggy source:
public void printImage(BufferedImage image){
  PrintItem pi=new PrintItemImage(image,IMAGE_SCALE);
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}

Fixed version (ground truth):
public void printImage(BufferedImage image){
  PrintItem pi=new PrintItemImage(image,getImageScale());
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}
Program: 5941
Project: 5941
Buggy source:
public void printBarCode(String type,String position,String code){
  PrintItem pi=new PrintItemBarcode(type,position,code,IMAGE_SCALE);
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}

Fixed version (ground truth):
public void printBarCode(String type,String position,String code){
  PrintItem pi=new PrintItemBarcode(type,position,code,getImageScale());
  m_aCommands.add(pi);
  m_iBodyHeight+=pi.getHeight();
}
Program: 5942
Project: 5942
Buggy source:
public void beginLine(int iTextSize){
  pil=new PrintItemLine(iTextSize,BASEFONT,FONTHEIGHT);
}

Fixed version (ground truth):
public void beginLine(int iTextSize){
  pil=new PrintItemLine(iTextSize,getBaseFont(),getFontHeight());
}
Program: 5943
Project: 5943
Buggy source:
public String printHost(){
  return m_sHost;
}

Fixed version (ground truth):
public String printHost(){
  return StringUtils.encodeXML(m_sHost);
}
Program: 5944
Project: 5944
Buggy source:
void btnPrintActionPerformed(java.awt.event.ActionEvent evt){
  Thread thread=new Thread(new Runnable(){
    public void run(){
      try {
        btnPrint.setEnabled(false);
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        JasperPrintManager.printReport(jasperPrint,true);
      }
 catch (      Exception ex) {
        ex.printStackTrace();
        JOptionPane.showMessageDialog(JRViewer300.this,getBundleString("String_Node_Str"));
      }
 finally {
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        btnPrint.setEnabled(true);
      }
    }
  }
);
  thread.start();
}

Fixed version (ground truth):
void btnPrintActionPerformed(java.awt.event.ActionEvent evt){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      try {
        btnPrint.setEnabled(false);
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        JasperPrintManager.printReport(jasperPrint,true);
      }
 catch (      Exception ex) {
        ex.printStackTrace();
        JOptionPane.showMessageDialog(JRViewer300.this,getBundleString("String_Node_Str"));
      }
 finally {
        JRViewer300.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        btnPrint.setEnabled(true);
      }
    }
  }
);
}
Program: 5945
Project: 5945
Buggy source:
public static boolean checkCC(String cardNumber){
  int sum=0;
  if (!StringUtils.isNumber(cardNumber)) {
    return false;
  }
  for (int i=0; i < cardNumber.length(); i++) {
    int k=Integer.parseInt(cardNumber.substring(i,i + 1));
    if (i % 2 == 0) {
      k*=2;
      if (k > 9) {
        k-=9;
      }
    }
    sum+=k;
  }
  return (sum % 10 == 0);
}

Fixed version (ground truth):
public static boolean checkCC(String cardNumber){
  int sum=0;
  int flip=0;
  if (!StringUtils.isNumber(cardNumber)) {
    return false;
  }
  for (int i=cardNumber.length() - 1; i >= 0; i--) {
    int k=Character.digit(cardNumber.charAt(i),10);
    flip++;
    if (flip % 2 == 0) {
      k*=2;
      if (k > 9) {
        k-=9;
      }
    }
    sum+=k;
  }
  return (sum % 10 == 0);
}
Program: 5946
Project: 5946
Buggy source:
public String printReason(){
  return m_reason.toString();
}

Fixed version (ground truth):
public String printReason(){
  return StringUtils.encodeXML(m_reason.toString());
}
Program: 5947
Project: 5947
Buggy source:
public String printLocation(){
  return m_locationOri.toString();
}

Fixed version (ground truth):
public String printLocation(){
  return StringUtils.encodeXML(m_locationOri.toString());
}
Program: 5949
Project: 5949
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.setAttribute("String_Node_Str",request.getAttribute("String_Node_Str"));
  request.setAttribute("String_Node_Str",subcategories);
  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.getSession().setAttribute("String_Node_Str",(String)inputFormPlace.get("String_Node_Str"));
  return mapping.findForward(SUCCESS);
}
Program: 5950
Project: 5950
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: 5952
Project: 5952
Buggy source:
protected Connection getConnection() throws Exception {
  try {
    Class.forName(properties.getDriverName());
    return DriverManager.getConnection(properties.getUrl(),properties.getDBUser(),properties.getDBPassword());
  }
 catch (  SQLException sqlex) {
    sqlex.printStackTrace();
  }
catch (  Exception ex) {
    ex.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
protected Connection getConnection() throws Exception {
  try {
    Class.forName(properties.getDriverName());
    boolean ju=isPostgre();
    return DriverManager.getConnection(properties.getUrl(),properties.getDBUser(),properties.getDBPassword());
  }
 catch (  SQLException sqlex) {
    sqlex.printStackTrace();
  }
catch (  Exception ex) {
    ex.printStackTrace();
  }
  return null;
}
Program: 5953
Project: 5953
Buggy source:
public List<ProductInfo> findProductsByCategory(String categoryId){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  List<ProductInfo> vos=null;
  String sqlStr="String_Node_Str" + "String_Node_Str";
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,categoryId);
    rs=ps.executeQuery();
    vos=transformSet(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return vos;
}

Fixed version (ground truth):
public List<ProductInfo> findProductsByCategory(String categoryId){
  Connection con=null;
  PreparedStatement ps=null;
  ResultSet rs=null;
  List<ProductInfo> vos=null;
  String sqlStr=isPostgre() ? "String_Node_Str" + "String_Node_Str" : "String_Node_Str" + "String_Node_Str";
  try {
    con=getConnection();
    ps=con.prepareStatement(sqlStr);
    ps.setString(1,categoryId);
    rs=ps.executeQuery();
    vos=transformSet(rs);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      if (ps != null) {
        ps.close();
      }
      if (con != null) {
        con.close();
      }
    }
 catch (    SQLException sqlee) {
      sqlee.printStackTrace();
    }
  }
  return vos;
}
Program: 5954
Project: 5954
Buggy source:
public String printName(){
  return m_sProdName;
}

Fixed version (ground truth):
public String printName(){
  return StringUtils.encodeXML(m_sProdName);
}
Program: 5955
Project: 5955
Buggy source:
public List<Place> findAllBusyTable(String floor){
  place=new PlaceDAO();
  return place.findAllBusyPlaceByFloor(floor);
}

Fixed version (ground truth):
public List<Place> findAllBusyTable(String floor){
  place=new PlaceDAO();
  return place.findAllBusyPlacesByFloor(floor);
}
Program: 5956
Project: 5956
Buggy source:
public String printCardNumber(){
  if (m_sCardNumber.length() > 4) {
    return "String_Node_Str" + m_sCardNumber.substring(m_sCardNumber.length() - 4);
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
public String printCardNumber(){
  if (m_sCardNumber.length() > 4) {
    return m_sCardNumber.substring(0,m_sCardNumber.length() - 4).replaceAll("String_Node_Str","String_Node_Str") + m_sCardNumber.substring(m_sCardNumber.length() - 4);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 5957
Project: 5957
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: 5958
Project: 5958
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: 5959
Project: 5959
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: 5960
Project: 5960
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);
    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";
  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;
}
Program: 5961
Project: 5961
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: 5962
Project: 5962
Buggy source:
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);
}

Fixed version (ground truth):
public BigDecimal getTotalOfaTicket(String place){
  double total=0;
  for (  TicketLineInfo line : findTicket(place).getM_aLines()) {
    total+=line.getMultiply() * line.getPrice();
  }
  return BigDecimal.valueOf(total);
}
Program: 5963
Project: 5963
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=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.getTaxcat()));
  obj.addLine(line);
  ticket.updateTicket(ticketId,obj);
  refreshTax(obj);
}
Program: 5964
Project: 5964
Buggy source:
public double getPrice(){
  return price;
}

Fixed version (ground truth):
public double getPrice(){
  try {
    return price + (price * getTax().getRate());
  }
 catch (  NullPointerException ex) {
    return price;
  }
}
Program: 5965
Project: 5965
Buggy source:
public double getValue(){
  return price * multiply;
}

Fixed version (ground truth):
public double getValue(){
  return getPrice() * multiply;
}
Program: 5970
Project: 5970
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: 5971
Project: 5971
Buggy source:
protected void paintComponent(Graphics g){
  paintBorder(g);
  Graphics2D g2d=(Graphics2D)g;
  Insets i=getInsets();
  g2d.setPaint(new GradientPaint(getWidth() - i.left - i.right- 100,getHeight() - i.top - i.bottom- 100,getBackground(),getWidth() - i.left - i.right,getHeight() - i.top - i.bottom,new Color(0xf0f0f0),true));
  g2d.fillRect(i.left,i.top,getWidth() - i.left - i.right,getHeight() - i.top - i.bottom);
  g.setColor(getForeground());
  basict.draw(g2d,i.left + H_GAP,i.top + V_GAP,LINEWIDTH);
}

Fixed version (ground truth):
protected void paintComponent(Graphics g){
  paintBorder(g);
  Graphics2D g2d=(Graphics2D)g;
  if (desktophints != null) {
    g2d.addRenderingHints(desktophints);
  }
  Insets i=getInsets();
  g2d.setPaint(new GradientPaint(getWidth() - i.left - i.right- 100,getHeight() - i.top - i.bottom- 100,getBackground(),getWidth() - i.left - i.right,getHeight() - i.top - i.bottom,new Color(0xf0f0f0),true));
  g2d.fillRect(i.left,i.top,getWidth() - i.left - i.right,getHeight() - i.top - i.bottom);
  g.setColor(getForeground());
  basict.draw(g2d,i.left + H_GAP,i.top + V_GAP,LINEWIDTH);
}
Program: 5972
Project: 5972
Buggy source:
/** 
 * Creates new form JTicket 
 */
public JTicket(BasicTicket t){
  basict=t;
  initComponents();
}

Fixed version (ground truth):
/** 
 * Creates new form JTicket 
 */
public JTicket(BasicTicket t){
  basict=t;
  desktophints=(Map)Toolkit.getDefaultToolkit().getDesktopProperty("String_Node_Str");
  initComponents();
}
Program: 5973
Project: 5973
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: 5974
Project: 5974
Buggy source:
public void writeValues(DataWrite dp) throws BasicException {
  dp.setString(1,m_sTicket);
  dp.setInt(2,new Integer(m_iLine));
  dp.setString(3,productid);
  dp.setDouble(4,new Double(multiply));
  dp.setDouble(5,new Double(price));
  dp.setString(6,tax.getId());
  try {
    ByteArrayOutputStream o=new ByteArrayOutputStream();
    attributes.storeToXML(o,AppLocal.APP_NAME,"String_Node_Str");
    dp.setBytes(7,o.toByteArray());
  }
 catch (  IOException e) {
    dp.setBytes(7,null);
  }
}

Fixed version (ground truth):
public void writeValues(DataWrite dp) throws BasicException {
  dp.setString(1,m_sTicket);
  dp.setInt(2,new Integer(m_iLine));
  dp.setString(3,productid);
  dp.setString(4,attsetinstid);
  dp.setDouble(5,new Double(multiply));
  dp.setDouble(6,new Double(price));
  dp.setString(7,tax.getId());
  try {
    ByteArrayOutputStream o=new ByteArrayOutputStream();
    attributes.storeToXML(o,AppLocal.APP_NAME,"String_Node_Str");
    dp.setBytes(8,o.toByteArray());
  }
 catch (  IOException e) {
    dp.setBytes(8,null);
  }
}
Program: 5975
Project: 5975
Buggy source:
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  multiply=dr.getDouble(4);
  price=dr.getDouble(5);
  tax=new TaxInfo(dr.getString(6),dr.getString(7),dr.getString(8),dr.getString(9),dr.getString(10),dr.getDouble(11),dr.getBoolean(12),dr.getInt(13));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(14);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void readValues(DataRead dr) throws BasicException {
  m_sTicket=dr.getString(1);
  m_iLine=dr.getInt(2).intValue();
  productid=dr.getString(3);
  attsetinstid=dr.getString(4);
  multiply=dr.getDouble(5);
  price=dr.getDouble(6);
  tax=new TaxInfo(dr.getString(7),dr.getString(8),dr.getString(9),dr.getString(10),dr.getString(11),dr.getDouble(12),dr.getBoolean(13),dr.getInt(14));
  attributes=new Properties();
  try {
    byte[] img=dr.getBytes(15);
    if (img != null) {
      attributes.loadFromXML(new ByteArrayInputStream(img));
    }
  }
 catch (  IOException e) {
  }
}
Program: 5976
Project: 5976
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: 5978
Project: 5978
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: 5979
Project: 5979
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: 5980
Project: 5980
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: 5981
Project: 5981
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: 5982
Project: 5982
Buggy source:
private String formatDouble(Double dvalue){
  String sNumber=dvalue.toString();
  if (sNumber.endsWith("String_Node_Str")) {
    sNumber=sNumber.substring(0,sNumber.length() - 2);
  }
  return sNumber;
}

Fixed version (ground truth):
private String formatDouble(Double value){
  String sNumber=Double.toString(DoubleUtils.fixDecimals(value));
  if (sNumber.endsWith("String_Node_Str")) {
    sNumber=sNumber.substring(0,sNumber.length() - 2);
  }
  return sNumber;
}
Program: 5983
Project: 5983
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: 5984
Project: 5984
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: 5985
Project: 5985
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: 5986
Project: 5986
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: 5987
Project: 5987
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: 5988
Project: 5988
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);
}