nus-yam/ex-repair huggingface dataset:
Program: 152131
Project: 152131
Buggy source:
@Override public void windowGainedFocus(WindowEvent e){
  frame.getToolbar().repaint();
}

Fixed version (ground truth):
@Override public void windowGainedFocus(WindowEvent e){
  frame.getToolbar().setBorder(activeBorder);
}
Program: 152133
Project: 152133
Buggy source:
/** 
 * Constructor for OperatorConnector. 
 */
public OperatorConnector(){
  client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
  client.getParams().setParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,true);
  client.getParams().setParameter(HttpMethodParams.USER_AGENT,USER_AGENT);
  client.getParams().setParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS,true);
  client.getParams().setParameter(HttpClientParams.REJECT_RELATIVE_REDIRECT,false);
  client.getParams().setParameter(HttpClientParams.MAX_REDIRECTS,50);
}

Fixed version (ground truth):
/** 
 * Constructor for OperatorConnector. 
 */
public OperatorConnector(){
  client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
  client.getParams().setParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,true);
  client.getParams().setParameter(HttpMethodParams.USER_AGENT,USER_AGENT);
  client.getParams().setParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS,true);
  client.getParams().setParameter(HttpClientParams.REJECT_RELATIVE_REDIRECT,false);
  client.getParams().setParameter(HttpClientParams.MAX_REDIRECTS,50);
  client.getParams().setParameter(HttpClientParams.HTTP_CONTENT_CHARSET,"String_Node_Str");
}
Program: 152136
Project: 152136
Buggy source:
/** 
 * set sms to display and edit 
 */
public void setSMS(final SMS sms){
  recipientField.setNumber(sms.getNumber());
  smsTextPane.setText(sms.getText());
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      operatorComboBox.setSelectedOperator(sms.getOperator());
      smsTextPane.requestFocusInWindow();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * set sms to display and edit 
 */
public void setSMS(final SMS sms){
  recipientField.setNumber(sms.getNumber());
  smsTextPane.setText(sms.getText());
  smsTextUndoManager.discardAllEdits();
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      operatorComboBox.setSelectedOperator(sms.getOperator());
      smsTextPane.requestFocusInWindow();
    }
  }
);
}
Program: 152137
Project: 152137
Buggy source:
/** 
 * Escape text using html entities. Fixes bug in OpenJDK where scaron entity is not replaced by 'š'.
 * @see ​StringEscapeUtils#escapeHtml(String)
 */
public static String escapeHtml(String input){
  if (input == null) {
    return input;
  }
  String output=StringEscapeUtils.escapeHtml(input);
  output=output.replaceAll("String_Node_Str","String_Node_Str");
  output=output.replaceAll("String_Node_Str","String_Node_Str");
  return output;
}

Fixed version (ground truth):
/** 
 * Escape text using html entities. Fixes bug in OpenJDK where scaron entity is not replaced by 'š'.
 * @see ​StringEscapeUtils#escapeHtml(String)
 */
public static String escapeHtml(String input){
  if (input == null) {
    return input;
  }
  String output=StringEscapeUtils.escapeHtml(input);
  output=output.replaceAll("String_Node_Str","String_Node_Str");
  output=output.replaceAll("String_Node_Str","String_Node_Str");
  output=output.replaceAll("String_Node_Str","String_Node_Str");
  return output;
}
Program: 152138
Project: 152138
Buggy source:
/** 
 * Constructor for OperatorConnector. 
 */
public OperatorConnector(){
  client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
  client.getParams().setParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,true);
  client.getParams().setParameter(HttpMethodParams.USER_AGENT,USER_AGENT);
}

Fixed version (ground truth):
/** 
 * Constructor for OperatorConnector. 
 */
public OperatorConnector(){
  client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
  client.getParams().setParameter(HttpMethodParams.SINGLE_COOKIE_HEADER,true);
  client.getParams().setParameter(HttpMethodParams.USER_AGENT,USER_AGENT);
  client.getParams().setParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS,true);
  client.getParams().setParameter(HttpClientParams.REJECT_RELATIVE_REDIRECT,false);
  client.getParams().setParameter(HttpClientParams.MAX_REDIRECTS,100);
}
Program: 152139
Project: 152139
Buggy source:
/** 
 * save sms history
 * @return true if saved ok; false otherwise
 */
private boolean saveHistory(){
  if (config.isReducedHistory()) {
    List<Record> records=history.getRecords();
    Calendar limitCal=Calendar.getInstance();
    limitCal.add(Calendar.DAY_OF_MONTH,-config.getReducedHistoryCount());
    Date limit=limitCal.getTime();
    logger.fine("String_Node_Str" + limit);
    ListIterator<Record> iter=records.listIterator();
    while (iter.hasNext()) {
      Record record=iter.next();
      if (record.getDate().before(limit)) {
        iter.remove();
      }
 else {
        break;
      }
    }
  }
  try {
    persistenceManager.saveHistory();
    return true;
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,"String_Node_Str",ex);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * save sms history
 * @return true if saved ok; false otherwise
 */
private boolean saveHistory(){
  if (config.isReducedHistory()) {
    Calendar limitCal=Calendar.getInstance();
    limitCal.add(Calendar.DAY_OF_MONTH,-config.getReducedHistoryCount());
    Date limit=limitCal.getTime();
    history.removeRecordsOlderThan(limit);
  }
  try {
    persistenceManager.saveHistory();
    return true;
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,"String_Node_Str",ex);
    return false;
  }
}
Program: 152140
Project: 152140
Buggy source:
/** 
 * Get currently edited contact 
 */
public Contact getContact(){
  String name=nameTextField.getText();
  String number=numberTextField.getText();
  String operator=operatorComboBox.getSelectedOperatorName();
  if (StringUtils.isEmpty(name) || StringUtils.isEmpty(number) || StringUtils.isEmpty(operator)) {
    return null;
  }
 else {
    return new Contact(name,number,operator);
  }
}

Fixed version (ground truth):
/** 
 * Get currently edited contact 
 */
public Contact getContact(){
  String name=nameTextField.getText();
  String number=numberTextField.getText();
  String operator=operatorComboBox.getSelectedOperatorName();
  if (!multiMode && (StringUtils.isEmpty(name) || StringUtils.isEmpty(number) || StringUtils.isEmpty(operator))) {
    return null;
  }
 else {
    return new Contact(name,number,operator);
  }
}
Program: 152146
Project: 152146
Buggy source:
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component c=lafRenderer.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  Contact contact=(Contact)value;
  JLabel label=((JLabel)c);
  Operator operator=OperatorUtil.getOperator(contact.getOperator());
  label.setIcon(operator != null ? operator.getIcon() : Icons.OPERATOR_BLANK);
  String tooltip="String_Node_Str" + contactIconURI + "String_Node_Str"+ StringEscapeUtils.escapeHtml(contact.getName())+ "String_Node_Str"+ OperatorUtil.stripCountryPrefix(contact.getNumber())+ "String_Node_Str"+ StringEscapeUtils.escapeHtml(contact.getOperator())+ "String_Node_Str";
  label.setToolTipText(tooltip);
  if (!searchContactAction.getSearchString().equals("String_Node_Str") && !searchContactAction.isContactMatched(contact)) {
    label.setBackground(label.getBackground().darker());
    label.setForeground(label.getForeground().darker());
  }
  return label;
}

Fixed version (ground truth):
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component c=lafRenderer.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  Contact contact=(Contact)value;
  JLabel label=((JLabel)c);
  Operator operator=OperatorUtil.getOperator(contact.getOperator());
  label.setIcon(operator != null ? operator.getIcon() : Icons.OPERATOR_BLANK);
  String tooltip="String_Node_Str" + contactIconURI + "String_Node_Str"+ Workarounds.escapeHtml(contact.getName())+ "String_Node_Str"+ OperatorUtil.stripCountryPrefix(contact.getNumber())+ "String_Node_Str"+ Workarounds.escapeHtml(contact.getOperator())+ "String_Node_Str";
  label.setToolTipText(tooltip);
  if (!searchContactAction.getSearchString().equals("String_Node_Str") && !searchContactAction.isContactMatched(contact)) {
    label.setBackground(label.getBackground().darker());
    label.setForeground(label.getForeground().darker());
  }
  return label;
}
Program: 152147
Project: 152147
Buggy source:
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component c=lafRenderer.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  Log.Record record=(Log.Record)value;
  String text="String_Node_Str" + timeFormat.format(record.getTime()) + "String_Node_Str"+ record.getMessage();
  ((JLabel)c).setText("String_Node_Str" + StringEscapeUtils.escapeHtml(text) + "String_Node_Str");
  ((JLabel)c).setIcon(record.getIcon() != null ? record.getIcon() : Icons.STATUS_BLANK);
  return c;
}

Fixed version (ground truth):
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component c=lafRenderer.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  Log.Record record=(Log.Record)value;
  String text="String_Node_Str" + timeFormat.format(record.getTime()) + "String_Node_Str"+ record.getMessage();
  ((JLabel)c).setText("String_Node_Str" + Workarounds.escapeHtml(text) + "String_Node_Str");
  ((JLabel)c).setIcon(record.getIcon() != null ? record.getIcon() : Icons.STATUS_BLANK);
  return c;
}
Program: 152149
Project: 152149
Buggy source:
/** 
 * Prints message to status bar
 * @param message text
 * @param printTime show timestamp before text
 * @param icon show icon with text. Use null for no icon.
 * @param addToLog whether the message should be logged
 */
public void setStatusMessage(String message,boolean printTime,ImageIcon icon,boolean addToLog){
  String messageEsc=StringEscapeUtils.escapeHtml(message);
  Date time=new Date();
  if (printTime) {
    String timestamp=shortTimeFormat.format(new Date());
    statusMessageLabel.setText("String_Node_Str" + timestamp + "String_Node_Str"+ messageEsc+ "String_Node_Str");
  }
 else {
    statusMessageLabel.setText("String_Node_Str" + messageEsc + "String_Node_Str");
  }
  statusMessageLabel.setIcon(icon);
  if (addToLog) {
    addToLog(message,time,icon);
  }
}

Fixed version (ground truth):
/** 
 * Prints message to status bar
 * @param message text
 * @param printTime show timestamp before text
 * @param icon show icon with text. Use null for no icon.
 * @param addToLog whether the message should be logged
 */
public void setStatusMessage(String message,boolean printTime,ImageIcon icon,boolean addToLog){
  String messageEsc=Workarounds.escapeHtml(message);
  Date time=new Date();
  if (printTime) {
    String timestamp=shortTimeFormat.format(new Date());
    statusMessageLabel.setText("String_Node_Str" + timestamp + "String_Node_Str"+ messageEsc+ "String_Node_Str");
  }
 else {
    statusMessageLabel.setText("String_Node_Str" + messageEsc + "String_Node_Str");
  }
  statusMessageLabel.setIcon(icon);
  if (addToLog) {
    addToLog(message,time,icon);
  }
}
Program: 152150
Project: 152150
Buggy source:
private void licenseButtonActionPerformed(java.awt.event.ActionEvent evt){
  try {
    Dimension d=Toolkit.getDefaultToolkit().getScreenSize();
    URL url=getClass().getResource(RES + "String_Node_Str");
    JTextPane tp=new JTextPane();
    tp.setPage(url);
    tp.setEditable(false);
    tp.setPreferredSize(new Dimension((int)d.getWidth() / 2,(int)d.getHeight() / 2));
    String option="String_Node_Str";
    JOptionPane op=new JOptionPane(new JScrollPane(tp),JOptionPane.INFORMATION_MESSAGE,JOptionPane.DEFAULT_OPTION,null,new Object[]{option},option);
    JDialog dialog=op.createDialog(this,"String_Node_Str");
    dialog.setResizable(true);
    dialog.setVisible(true);
  }
 catch (  IOException ex) {
    logger.log(Level.WARNING,"String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private void licenseButtonActionPerformed(java.awt.event.ActionEvent evt){
  try {
    Dimension d=Toolkit.getDefaultToolkit().getScreenSize();
    URL url=getClass().getResource(RES + "String_Node_Str");
    JTextPane tp=new JTextPane();
    tp.setPage(url);
    tp.setEditable(false);
    tp.setPreferredSize(new Dimension((int)d.getWidth() / 2,(int)d.getHeight() / 2));
    String option="String_Node_Str";
    JOptionPane op=new JOptionPane(new JScrollPane(tp),JOptionPane.INFORMATION_MESSAGE,JOptionPane.DEFAULT_OPTION,null,new Object[]{option},option);
    JDialog dialog=op.createDialog(this,"String_Node_Str");
    dialog.setResizable(true);
    dialog.pack();
    dialog.setVisible(true);
  }
 catch (  IOException ex) {
    logger.log(Level.WARNING,"String_Node_Str",ex);
  }
}
Program: 152151
Project: 152151
Buggy source:
private void creditsButtonActionPerformed(java.awt.event.ActionEvent evt){
  try {
    URL url=getClass().getResource(RES + "String_Node_Str");
    JTextPane tp=new JTextPane();
    tp.setContentType("String_Node_Str");
    tp.setPage(url);
    tp.setEditable(false);
    tp.setPreferredSize(new Dimension(450,400));
    tp.addHyperlinkListener(new HyperlinkListener(){
      @Override public void hyperlinkUpdate(      final HyperlinkEvent e){
        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && Desktop.isDesktopSupported()) {
          try {
            Desktop.getDesktop().browse(e.getURL().toURI());
          }
 catch (          Exception ex) {
            logger.log(Level.SEVERE,"String_Node_Str" + e.getURL(),ex);
          }
        }
      }
    }
);
    String option="String_Node_Str";
    JOptionPane op=new JOptionPane(new JScrollPane(tp),JOptionPane.INFORMATION_MESSAGE,JOptionPane.DEFAULT_OPTION,null,new Object[]{option},option);
    JDialog dialog=op.createDialog(this,"String_Node_Str");
    dialog.setResizable(true);
    dialog.setVisible(true);
  }
 catch (  IOException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void creditsButtonActionPerformed(java.awt.event.ActionEvent evt){
  try {
    URL url=getClass().getResource(RES + "String_Node_Str");
    JTextPane tp=new JTextPane();
    tp.setContentType("String_Node_Str");
    tp.setPage(url);
    tp.setEditable(false);
    tp.setPreferredSize(new Dimension(450,400));
    tp.addHyperlinkListener(new HyperlinkListener(){
      @Override public void hyperlinkUpdate(      final HyperlinkEvent e){
        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && Desktop.isDesktopSupported()) {
          try {
            Desktop.getDesktop().browse(e.getURL().toURI());
          }
 catch (          Exception ex) {
            logger.log(Level.SEVERE,"String_Node_Str" + e.getURL(),ex);
          }
        }
      }
    }
);
    String option="String_Node_Str";
    JOptionPane op=new JOptionPane(new JScrollPane(tp),JOptionPane.INFORMATION_MESSAGE,JOptionPane.DEFAULT_OPTION,null,new Object[]{option},option);
    JDialog dialog=op.createDialog(this,"String_Node_Str");
    dialog.setResizable(true);
    dialog.pack();
    dialog.setVisible(true);
  }
 catch (  IOException e) {
    logger.log(Level.WARNING,"String_Node_Str",e);
  }
}
Program: 152154
Project: 152154
Buggy source:
@Override public void run(){
  MainFrame.getInstance().setVisible(true);
}

Fixed version (ground truth):
@Override public void run(){
  MainFrame.getInstance().startAndShow();
}
Program: 152155
Project: 152155
Buggy source:
/** 
 * get length of signature needed to be substracted from message length 
 */
private int getSignatureLength(Contact c){
  Operator operator=OperatorUtil.getOperator(c.getOperator());
  if (operator != null && config.isUseSenderID() && config.getSenderName() != null && config.getSenderName().length() != 0) {
    return operator.getSignatureExtraLength() + config.getSenderName().length();
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
/** 
 * get length of signature needed to be substracted from message length 
 */
private int getSignatureLength(Contact c){
  Operator operator=OperatorUtil.getOperator(c.getOperator());
  if (operator != null && config.isUseSenderID() && config.getSenderName() != null && config.getSenderName().length() > 0) {
    return operator.getSignatureExtraLength() + config.getSenderName().length();
  }
 else {
    return 0;
  }
}
Program: 152156
Project: 152156
Buggy source:
/** 
 * get number of sms from these characters 
 */
public int getSMSCount(int chars){
  int worstOperator=Integer.MAX_VALUE;
  for (  Contact c : contacts) {
    Operator operator=OperatorUtil.getOperator(c.getOperator());
    if (operator == null)     continue;
    worstOperator=Math.min(worstOperator,operator.getSMSLength() - getSignatureLength(c));
  }
  int count=chars / worstOperator;
  if (chars % worstOperator != 0)   count++;
  return count;
}

Fixed version (ground truth):
/** 
 * get number of sms from these characters 
 */
public int getSMSCount(int chars){
  int worstOperator=Integer.MAX_VALUE;
  for (  Contact c : contacts) {
    Operator operator=OperatorUtil.getOperator(c.getOperator());
    if (operator == null)     continue;
    worstOperator=Math.min(worstOperator,operator.getSMSLength());
  }
  chars+=getSignatureLength();
  int count=chars / worstOperator;
  if (chars % worstOperator != 0)   count++;
  return count;
}
Program: 152159
Project: 152159
Buggy source:
private void themeComboBoxActionPerformed(java.awt.event.ActionEvent evt){
  String laf=(String)lafComboBox.getSelectedItem();
  if (laf.equals(LAF_JGOODIES)) {
    config.setLafJGoodiesTheme((String)themeComboBox.getSelectedItem());
  }
 else   if (laf.equals(LAF_SUBSTANCE)) {
    config.setLafSubstanceSkin((String)themeComboBox.getSelectedItem());
  }
  if (fullyInicialized && lafWhenLoaded.equals(lafComboBox.getSelectedItem())) {
    try {
      ThemeManager.setLaF();
      SwingUtilities.updateComponentTreeUI(MainFrame.getInstance());
      SwingUtilities.updateComponentTreeUI(this);
    }
 catch (    Exception ex) {
      logger.log(Level.SEVERE,"String_Node_Str",ex);
    }
  }
}

Fixed version (ground truth):
private void themeComboBoxActionPerformed(java.awt.event.ActionEvent evt){
  String laf=(String)lafComboBox.getSelectedItem();
  if (laf.equals(LAF_JGOODIES)) {
    config.setLafJGoodiesTheme((String)themeComboBox.getSelectedItem());
  }
 else   if (laf.equals(LAF_SUBSTANCE)) {
    config.setLafSubstanceSkin((String)themeComboBox.getSelectedItem());
  }
  if (fullyInicialized && lafWhenLoaded.equals(lafComboBox.getSelectedItem())) {
    try {
      ThemeManager.setLaF();
      SwingUtilities.updateComponentTreeUI(MainFrame.getInstance());
      SwingUtilities.updateComponentTreeUI(this);
    }
 catch (    Throwable ex) {
      logger.log(Level.SEVERE,"String_Node_Str",ex);
    }
  }
}
Program: 152160
Project: 152160
Buggy source:
/** 
 * load program configuration 
 */
private void loadConfig(){
  if (config.isRememberLayout()) {
    Dimension mainDimension=config.getMainDimension();
    Integer horizontalSplitPaneLocation=config.getHorizontalSplitPaneLocation();
    Integer verticalSplitPaneLocation=config.getVerticalSplitPaneLocation();
    if (mainDimension != null)     this.setSize(mainDimension);
    if (horizontalSplitPaneLocation != null)     horizontalSplitPane.setDividerLocation(horizontalSplitPaneLocation);
    if (verticalSplitPaneLocation != null)     verticalSplitPane.setDividerLocation(verticalSplitPaneLocation);
  }
  if (config.isStartCentered()) {
    setLocationRelativeTo(null);
  }
  if (history.getRecords().size() > 0)   contactPanel.setSelectedContact(history.getRecord(0).getName());
}

Fixed version (ground truth):
/** 
 * load program configuration 
 */
private void loadConfig(){
  if (config.isRememberLayout()) {
    Dimension mainDimension=config.getMainDimension();
    Integer horizontalSplitPaneLocation=config.getHorizontalSplitPaneLocation();
    Integer verticalSplitPaneLocation=config.getVerticalSplitPaneLocation();
    if (mainDimension != null)     this.setSize(mainDimension);
    if (horizontalSplitPaneLocation != null)     horizontalSplitPane.setDividerLocation(horizontalSplitPaneLocation);
    if (verticalSplitPaneLocation != null)     verticalSplitPane.setDividerLocation(verticalSplitPaneLocation);
  }
  if (config.isStartCentered()) {
    setLocationRelativeTo(null);
  }
  if (history.getRecords().size() > 0) {
    contactPanel.setSelectedContact(history.getRecord(history.getRecords().size() - 1).getName());
  }
}
Program: 152161
Project: 152161
Buggy source:
/** 
 * Creates a new instance of PersistenceManager 
 */
private PersistenceManager() throws IOException {
  String path=System.getenv("String_Node_Str");
  if ((path == null || path.equals("String_Node_Str")) && System.getProperty("String_Node_Str").toLowerCase().contains("String_Node_Str"))   path=System.getenv("String_Node_Str");
  if (path != null && !path.equals("String_Node_Str")) {
    setProgramDir(path + File.separator + PROGRAM_DIRNAME);
  }
  boolean ok=true;
  if (!PROGRAM_DIR.exists())   ok=PROGRAM_DIR.mkdirs();
  if (!ok)   throw new IOException("String_Node_Str");
  if (!(PROGRAM_DIR.canWrite() && PROGRAM_DIR.canExecute()))   throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a new instance of PersistenceManager 
 */
private PersistenceManager() throws IOException {
  if (!customPathSet) {
    String path=System.getenv("String_Node_Str");
    if ((path == null || path.equals("String_Node_Str")) && System.getProperty("String_Node_Str").toLowerCase().contains("String_Node_Str")) {
      path=System.getenv("String_Node_Str");
    }
    if (path != null && !path.equals("String_Node_Str")) {
      setProgramDir(path + File.separator + PROGRAM_DIRNAME);
    }
  }
  boolean ok=true;
  if (!PROGRAM_DIR.exists())   ok=PROGRAM_DIR.mkdirs();
  if (!ok)   throw new IOException("String_Node_Str");
  if (!(PROGRAM_DIR.canWrite() && PROGRAM_DIR.canExecute()))   throw new IOException("String_Node_Str");
}
Program: 152162
Project: 152162
Buggy source:
public static void setProgramDir(String path){
  if (persistenceManager != null)   throw new IllegalStateException("String_Node_Str");
  PROGRAM_DIR=new File(path);
  CONFIG_FILE=new File(PROGRAM_DIR,CONFIG_FILENAME);
  CONTACTS_FILE=new File(PROGRAM_DIR,CONTACTS_FILENAME);
  QUEUE_FILE=new File(PROGRAM_DIR,QUEUE_FILENAME);
  HISTORY_FILE=new File(PROGRAM_DIR,HISTORY_FILENAME);
}

Fixed version (ground truth):
public static void setProgramDir(String path){
  if (persistenceManager != null)   throw new IllegalStateException("String_Node_Str");
  PROGRAM_DIR=new File(path);
  CONFIG_FILE=new File(PROGRAM_DIR,CONFIG_FILENAME);
  CONTACTS_FILE=new File(PROGRAM_DIR,CONTACTS_FILENAME);
  QUEUE_FILE=new File(PROGRAM_DIR,QUEUE_FILENAME);
  HISTORY_FILE=new File(PROGRAM_DIR,HISTORY_FILENAME);
  customPathSet=true;
}
Program: 152163
Project: 152163
Buggy source:
public static void main(String[] args) throws IOException {
  String configFile="String_Node_Str" + File.separator + "String_Node_Str";
  String msg="String_Node_Str";
  if (args.length > 0) {
    File f=new File(args[0]);
    if (f.exists()) {
      configFile=f.getName();
    }
 else {
      msg+="String_Node_Str" + f.getCanonicalPath();
      msg+='\n' + displayConfigDefaulting(configFile);
    }
  }
 else {
    msg+="String_Node_Str";
    msg+='\n' + displayConfigDefaulting(configFile);
  }
  Config.initConfig(configFile);
  Logger.println(msg);
  if (Config.LS_PASS == null || Config.LS_PASS.equals("String_Node_Str")) {
    if (new File("String_Node_Str","String_Node_Str").exists()) {
      devMode=true;
    }
 else {
      System.out.println("String_Node_Str");
      System.exit(0);
    }
  }
  world=Instance.getWorld();
  Logger.println(Config.SERVER_NAME + "String_Node_Str" + (Config.members ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str");
  server=new Server();
  Instance.dataStore().dispose();
  try (Scanner scan=new Scanner(System.in)){
    CommandHandler handler=new CommandHandler();
    String command;
    while ((command=scan.nextLine()) != null) {
      handler.handle(new Command(command));
    }
  }
 }

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  String configFile="String_Node_Str" + File.separator + "String_Node_Str";
  String msg="String_Node_Str";
  if (args.length > 0) {
    File f=new File(args[0]);
    if (f.exists()) {
      configFile=f.getName();
    }
 else {
      msg+="String_Node_Str" + f.getCanonicalPath();
      msg+='\n' + displayConfigDefaulting(configFile);
    }
  }
 else {
    msg+="String_Node_Str";
    msg+='\n' + displayConfigDefaulting(configFile);
  }
  Config.initConfig(configFile);
  Logger.println(msg);
  if (Config.LS_PASS == null || Config.LS_PASS.equals("String_Node_Str")) {
    if (new File("String_Node_Str","String_Node_Str").exists()) {
      devMode=true;
      System.out.println("String_Node_Str");
    }
 else {
      System.out.println("String_Node_Str");
      System.exit(0);
    }
  }
  world=Instance.getWorld();
  Logger.println(Config.SERVER_NAME + "String_Node_Str" + (Config.members ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str");
  server=new Server();
  Instance.dataStore().dispose();
  try (Scanner scan=new Scanner(System.in)){
    CommandHandler handler=new CommandHandler();
    String command;
    while ((command=scan.nextLine()) != null) {
      handler.handle(new Command(command));
    }
  }
 }
Program: 152164
Project: 152164
Buggy source:
public static void main(String[] args) throws IOException {
  String configFile="String_Node_Str" + File.separator + "String_Node_Str";
  if (args.length > 0) {
    File f=new File(args[0]);
    if (f.exists()) {
      configFile=f.getName();
    }
 else {
      System.out.println("String_Node_Str" + f.getCanonicalPath());
      displayConfigDefaulting(configFile);
    }
  }
 else {
    System.out.println("String_Node_Str");
    displayConfigDefaulting(configFile);
  }
  Config.initConfig(configFile);
  if (Config.LS_CONNECT_PASS == null || Config.LS_CONNECT_PASS.equals("String_Node_Str")) {
    if (new File("String_Node_Str","String_Node_Str").exists()) {
      devMode=true;
    }
 else {
      System.out.println("String_Node_Str");
      System.exit(0);
    }
  }
  System.out.println("String_Node_Str");
  try {
    storage=StorageMediumFactory.create(Config.STORAGE_MEDIUM);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return;
  }
  System.out.println("String_Node_Str" + storage.getClass().getSimpleName());
  Server.getServer();
  if (Config.USE_REDDIT) {
    RedditTasks.start();
  }
  try (Scanner scan=new Scanner(System.in)){
    CommandHandler handler=new CommandHandler();
    String command;
    while ((command=scan.nextLine()) != null) {
      handler.handle(new Command(command));
    }
  }
 }

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  String configFile="String_Node_Str" + File.separator + "String_Node_Str";
  if (args.length > 0) {
    File f=new File(args[0]);
    if (f.exists()) {
      configFile=f.getName();
    }
 else {
      System.out.println("String_Node_Str" + f.getCanonicalPath());
      displayConfigDefaulting(configFile);
    }
  }
 else {
    System.out.println("String_Node_Str");
    displayConfigDefaulting(configFile);
  }
  Config.initConfig(configFile);
  if (Config.LS_CONNECT_PASS == null || Config.LS_CONNECT_PASS.equals("String_Node_Str")) {
    if (new File("String_Node_Str","String_Node_Str").exists()) {
      devMode=true;
      System.out.println("String_Node_Str");
    }
 else {
      System.out.println("String_Node_Str");
      System.exit(0);
    }
  }
  System.out.println("String_Node_Str");
  try {
    storage=StorageMediumFactory.create(Config.STORAGE_MEDIUM);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return;
  }
  System.out.println("String_Node_Str" + storage.getClass().getSimpleName());
  Server.getServer();
  if (Config.USE_REDDIT) {
    RedditTasks.start();
  }
  try (Scanner scan=new Scanner(System.in)){
    CommandHandler handler=new CommandHandler();
    String command;
    while ((command=scan.nextLine()) != null) {
      handler.handle(new Command(command));
    }
  }
 }
Program: 152166
Project: 152166
Buggy source:
/** 
 * Increments and returns the current count.
 * @param hash - The hash of the player.
 */
private int incrementAndGet(long hash){
  final int count;
synchronized (playerToPacketCount) {
    Integer i=playerToPacketCount.get(hash);
    if (i == null) {
      count=1;
    }
 else {
      count=i + 1;
    }
    playerToPacketCount.put(hash,count);
  }
  return count;
}

Fixed version (ground truth):
/** 
 * Increments and returns the current count.
 * @param hash - The hash of the player.
 */
private int incrementAndGet(long hash){
  final int count;
  try {
    lock.lock();
    Integer i=playerToPacketCount.get(hash);
    if (i == null) {
      count=1;
    }
 else {
      count=i + 1;
    }
    playerToPacketCount.put(hash,count);
  }
  finally {
    lock.unlock();
  }
  return count;
}
Program: 152167
Project: 152167
Buggy source:
@Override public void run(){
  playerToPacketCount.clear();
}

Fixed version (ground truth):
@Override public void run(){
  try {
    lock.lock();
    playerToPacketCount.clear();
  }
  finally {
    lock.unlock();
  }
}
Program: 152168
Project: 152168
Buggy source:
private PacketThrottler(){
  Instance.getDelayedEventHandler().add(new DelayedEvent(null,1000){
    @Override public void run(){
      playerToPacketCount.clear();
    }
  }
);
}

Fixed version (ground truth):
private PacketThrottler(){
  Instance.getDelayedEventHandler().add(new DelayedEvent(null,1000){
    @Override public void run(){
      try {
        lock.lock();
        playerToPacketCount.clear();
      }
  finally {
        lock.unlock();
      }
    }
  }
);
}
Program: 152169
Project: 152169
Buggy source:
/** 
 * Invoked whenever an exception is thrown by MINA or this IoHandler.
 * @param session The associated session
 * @param cause The exception thrown
 */
public void exceptionCaught(IoSession session,Throwable cause){
}

Fixed version (ground truth):
/** 
 * Invoked whenever an exception is thrown by MINA or this IoHandler.
 * @param session The associated session
 * @param cause The exception thrown
 */
public void exceptionCaught(IoSession session,Throwable cause){
  cause.printStackTrace();
}
Program: 152170
Project: 152170
Buggy source:
public void messageReceived(IoSession session,Object message){
  Player player=(Player)session.getAttachment();
  if (session.isClosing() || player.destroyed()) {
    return;
  }
  RSCPacket p=(RSCPacket)message;
  if (p.getID() == 55)   player.addInterval();
  System.out.println("String_Node_Str" + p.getID());
  packets.add(p);
}

Fixed version (ground truth):
public void messageReceived(IoSession session,Object message){
  Player player=(Player)session.getAttachment();
  if (session.isClosing() || player.destroyed()) {
    return;
  }
  RSCPacket p=(RSCPacket)message;
  if (p.getID() == 55)   player.addInterval();
  packets.add(p);
}
Program: 152171
Project: 152171
Buggy source:
/** 
 * Invoked whenever a packet is sent.
 * @param session The associated session
 * @param message The packet sent
 */
public void messageSent(IoSession session,Object message){
  RSCPacket p=(RSCPacket)message;
  System.out.println(p.getID());
}

Fixed version (ground truth):
/** 
 * Invoked whenever a packet is sent.
 * @param session The associated session
 * @param message The packet sent
 */
public void messageSent(IoSession session,Object message){
}
Program: 152172
Project: 152172
Buggy source:
public void updateViewedNpcs(){
  List<Npc> npcsInView=viewArea.getNpcsInView();
  for (  Npc n : npcsInView) {
    if ((!watchedNpcs.contains(n) || watchedNpcs.isRemoving(n)) && withinRange(n)) {
      if (n.inCombat()) {
        watchedNpcs.add(n);
      }
    }
  }
}

Fixed version (ground truth):
public void updateViewedNpcs(){
  List<Npc> npcsInView=viewArea.getNpcsInView();
  for (  Npc n : npcsInView) {
    if ((!watchedNpcs.contains(n) || watchedNpcs.isRemoving(n)) && withinRange(n)) {
      watchedNpcs.add(n);
    }
  }
}
Program: 152173
Project: 152173
Buggy source:
public int getRangePoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    if (item.wielded) {
      points+=EntityHandler.getItemWieldableDef(item.id).getRangePoints();
    }
  }
  return points < 1 ? 1 : points;
}

Fixed version (ground truth):
public int getRangePoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    ItemWieldableDef def=ItemAttributes.getWieldable(item.id);
    if (item.wielded && def != null) {
      points+=def.getRangePoints();
    }
  }
  return points < 1 ? 1 : points;
}
Program: 152174
Project: 152174
Buggy source:
public int getWeaponAimPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    if (item.wielded) {
      points+=EntityHandler.getItemWieldableDef(item.id).getWeaponAimPoints();
    }
  }
  points-=1;
  return points < 1 ? 1 : points;
}

Fixed version (ground truth):
public int getWeaponAimPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    ItemWieldableDef def=ItemAttributes.getWieldable(item.id);
    if (item.wielded && def != null) {
      points+=def.getWeaponAimPoints();
    }
  }
  points-=1;
  return points < 1 ? 1 : points;
}
Program: 152175
Project: 152175
Buggy source:
public int getMagicPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    if (item.wielded) {
      points+=EntityHandler.getItemWieldableDef(item.id).getMagicPoints();
    }
  }
  return points < 1 ? 1 : points;
}

Fixed version (ground truth):
public int getMagicPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    ItemWieldableDef def=ItemAttributes.getWieldable(item.id);
    if (item.wielded && def != null) {
      points+=def.getMagicPoints();
    }
  }
  return points < 1 ? 1 : points;
}
Program: 152176
Project: 152176
Buggy source:
public void updateWornItems(){
  List<InvItem> items=getInventory().getItems();
  for (  InvItem i : items) {
    ItemWieldableDef def=ItemAttributes.getWieldable(i.id);
    Logger.println("String_Node_Str" + getPlayerAppearance().getSprite(def.getWieldPos()));
    Logger.println("String_Node_Str" + def.getSprite());
    wornItems[def.getWieldPos()]=getPlayerAppearance().getSprite(def.getWieldPos());
  }
  super.ourAppearanceChanged=true;
}

Fixed version (ground truth):
public void updateWornItems(int index,int id){
  wornItems[index]=id;
  super.ourAppearanceChanged=true;
}
Program: 152177
Project: 152177
Buggy source:
public int getWeaponPowerPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    if (item.wielded) {
      points+=EntityHandler.getItemWieldableDef(item.id).getWeaponPowerPoints();
    }
  }
  points-=1;
  return points < 1 ? 1 : points;
}

Fixed version (ground truth):
public int getWeaponPowerPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    ItemWieldableDef def=ItemAttributes.getWieldable(item.id);
    if (item.wielded && def != null) {
      points+=def.getWeaponPowerPoints();
    }
  }
  points-=1;
  return points < 1 ? 1 : points;
}
Program: 152178
Project: 152178
Buggy source:
public int getArmourPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    if (item.wielded) {
      points+=EntityHandler.getItemWieldableDef(item.id).getArmourPoints();
    }
  }
  return points < 1 ? 1 : points;
}

Fixed version (ground truth):
public int getArmourPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    ItemWieldableDef def=ItemAttributes.getWieldable(item.id);
    if (item.wielded && def != null) {
      points+=def.getArmourPoints();
    }
  }
  return points < 1 ? 1 : points;
}
Program: 152179
Project: 152179
Buggy source:
public int getPrayerPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    if (item.wielded) {
      points+=EntityHandler.getItemWieldableDef(item.id).getPrayerPoints();
    }
  }
  return points < 1 ? 1 : points;
}

Fixed version (ground truth):
public int getPrayerPoints(){
  int points=1;
  for (  InvItem item : inventory.getItems()) {
    ItemWieldableDef def=ItemAttributes.getWieldable(item.id);
    if (item.wielded && def != null) {
      points+=def.getPrayerPoints();
    }
  }
  return points < 1 ? 1 : points;
}
Program: 152180
Project: 152180
Buggy source:
public void killedBy(Mob mob,boolean stake){
  if (mob instanceof Player) {
    Player player=(Player)mob;
    player.getActionSender().sendSound("String_Node_Str");
    if (this.isScripted()) {
      Instance.getPluginHandler().getNpcAIHandler(getID()).onNpcDeath(this,player);
    }
  }
  Mob opponent=super.getOpponent();
  if (opponent != null) {
    opponent.resetCombat(CombatState.WON);
  }
  resetCombat(CombatState.LOST);
  world.unregisterNpc(this);
  remove();
  Player owner=mob instanceof Player ? (Player)mob : null;
  ItemDropDef[] drops=def.getDrops();
  int total=0;
  for (  ItemDropDef drop : drops) {
    total+=drop.getWeight();
  }
  int hit=DataConversions.random(0,total);
  total=0;
  if (!this.getDef().name.equalsIgnoreCase("String_Node_Str")) {
    for (    ItemDropDef drop : drops) {
      if (drop == null) {
        continue;
      }
      if (drop.getWeight() == 0) {
        world.registerItem(new Item(drop.getID(),getX(),getY(),drop.getAmount(),owner));
        continue;
      }
      if (hit >= total && hit < (total + drop.getWeight())) {
        if (drop.getID() != -1) {
          if (EntityHandler.getItemDef(drop.getID()).members && World.isMembers()) {
            world.registerItem(new Item(drop.getID(),getX(),getY(),drop.getAmount(),owner));
            break;
          }
        }
      }
      total+=drop.getWeight();
    }
  }
  World.getQuestManager().handleNpcKilled(this,owner);
}

Fixed version (ground truth):
public void killedBy(Mob mob,boolean stake){
  if (mob instanceof Player) {
    Player player=(Player)mob;
    player.getActionSender().sendSound("String_Node_Str");
    if (this.isScripted()) {
      Instance.getPluginHandler().getNpcAIHandler(getID()).onNpcDeath(this,player);
    }
  }
  Mob opponent=super.getOpponent();
  if (opponent != null) {
    opponent.resetCombat(CombatState.WON);
  }
  resetCombat(CombatState.LOST);
  world.unregisterNpc(this);
  remove();
  Player owner=mob instanceof Player ? (Player)mob : null;
  ItemDropDef[] drops=def.getDrops();
  int total=0;
  for (  ItemDropDef drop : drops) {
    total+=drop.getWeight();
  }
  int hit=DataConversions.random(0,total);
  total=0;
  if (!this.getDef().name.equalsIgnoreCase("String_Node_Str")) {
    for (    ItemDropDef drop : drops) {
      if (drop == null) {
        continue;
      }
      if (drop.getWeight() == 0) {
        Item i=new Item(drop.getID(),getX(),getY(),drop.getAmount(),owner);
        if (i.getDef().members && !Server.isMembers())         continue;
        world.registerItem(i);
        continue;
      }
      if (hit >= total && hit < (total + drop.getWeight())) {
        if (drop.getID() != -1) {
          if (EntityHandler.getItemDef(drop.getID()).members && World.isMembers()) {
            world.registerItem(new Item(drop.getID(),getX(),getY(),drop.getAmount(),owner));
            break;
          }
        }
      }
      total+=drop.getWeight();
    }
  }
  World.getQuestManager().handleNpcKilled(this,owner);
}
Program: 152181
Project: 152181
Buggy source:
public double getCombatPortion(){
  return getCombatDamage() / getTotalDamage();
}

Fixed version (ground truth):
public double getCombatPortion(){
  if (getTotalDamage() == 0) {
    return 0;
  }
  return getCombatDamage() / getTotalDamage();
}
Program: 152182
Project: 152182
Buggy source:
public double getMagicPortion(){
  return getMagicDamage() / getTotalDamage();
}

Fixed version (ground truth):
public double getMagicPortion(){
  if (getTotalDamage() == 0) {
    return 0;
  }
  return getMagicDamage() / getTotalDamage();
}
Program: 152183
Project: 152183
Buggy source:
public double getRangePortion(){
  return getRangeDamage() / getTotalDamage();
}

Fixed version (ground truth):
public double getRangePortion(){
  if (getTotalDamage() == 0) {
    return 0;
  }
  return getRangeDamage() / getTotalDamage();
}
Program: 152184
Project: 152184
Buggy source:
public static void main(String[] args) throws IOException {
  String configFile="String_Node_Str" + File.separator + "String_Node_Str";
  if (args.length > 0) {
    File f=new File(args[0]);
    if (f.exists()) {
      configFile=f.getName();
    }
 else {
      System.out.println("String_Node_Str" + f.getCanonicalPath());
      displayConfigDefaulting(configFile);
    }
  }
 else {
    System.out.println("String_Node_Str");
    displayConfigDefaulting(configFile);
  }
  Config.initConfig(configFile);
  world=Instance.getWorld();
  world.wl.loadObjects();
  World.initilizeDB();
  Logger.println(Config.SERVER_NAME + "String_Node_Str" + (Config.members ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str");
  server=new Server();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  String configFile="String_Node_Str" + File.separator + "String_Node_Str";
  if (args.length > 0) {
    File f=new File(args[0]);
    if (f.exists()) {
      configFile=f.getName();
    }
 else {
      System.out.println("String_Node_Str" + f.getCanonicalPath());
      displayConfigDefaulting(configFile);
    }
  }
 else {
    System.out.println("String_Node_Str");
    displayConfigDefaulting(configFile);
  }
  Config.initConfig(configFile);
  world=Instance.getWorld();
  try {
    world.wl.loadObjects();
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(0);
  }
  World.initilizeDB();
  Logger.println(Config.SERVER_NAME + "String_Node_Str" + (Config.members ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str");
  server=new Server();
}
Program: 152185
Project: 152185
Buggy source:
/** 
 * Constructs a new game engine with an empty packet queue.
 */
public GameEngine(){
  captcha=new Captcha();
  captcha.init();
  packetQueue=new PacketQueue<RSCPacket>();
  loadPacketHandlers();
  for (  Shop shop : world.getShops()) {
    shop.initRestock();
  }
  redirectSystemStreams();
}

Fixed version (ground truth):
/** 
 * Constructs a new game engine with an empty packet queue.
 */
public GameEngine(){
  captcha=new Captcha();
  captcha.init();
  packetQueue=new PacketQueue<RSCPacket>();
  try {
    loadPacketHandlers();
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(0);
  }
  for (  Shop shop : world.getShops()) {
    shop.initRestock();
  }
  redirectSystemStreams();
}
Program: 152186
Project: 152186
Buggy source:
/** 
 * Loads the packet handling classes from the persistence manager.
 */
protected void loadPacketHandlers(){
  PacketHandlerDef[] handlerDefs=Instance.getDataStore().loadPacketHandlerDefs();
  for (  PacketHandlerDef handlerDef : handlerDefs) {
    try {
      String className=handlerDef.getClassName();
      Class<?> c=Class.forName(className);
      if (c != null) {
        PacketHandler handler=(PacketHandler)c.newInstance();
        for (        int packetID : handlerDef.getAssociatedPackets()) {
          packetHandlers.put(packetID,handler);
        }
      }
    }
 catch (    Exception e) {
      Logger.error(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Loads the packet handling classes from the persistence manager.
 * @throws Exception 
 */
protected void loadPacketHandlers() throws Exception {
  PacketHandlerDef[] handlerDefs=Instance.getDataStore().loadPacketHandlerDefs();
  for (  PacketHandlerDef handlerDef : handlerDefs) {
    try {
      String className=handlerDef.getClassName();
      Class<?> c=Class.forName(className);
      if (c != null) {
        PacketHandler handler=(PacketHandler)c.newInstance();
        for (        int packetID : handlerDef.getAssociatedPackets()) {
          packetHandlers.put(packetID,handler);
        }
      }
    }
 catch (    Exception e) {
      Logger.error(e);
    }
  }
}
Program: 152187
Project: 152187
Buggy source:
public LoginConnector(){
  packetQueue=new PacketQueue<LSPacket>();
  loadPacketHandlers();
  reconnect();
}

Fixed version (ground truth):
public LoginConnector(){
  packetQueue=new PacketQueue<LSPacket>();
  try {
    loadPacketHandlers();
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(0);
  }
  reconnect();
}
Program: 152188
Project: 152188
Buggy source:
private void loadPacketHandlers(){
  PacketHandlerDef[] handlerDefs=Instance.getDataStore().loadLSPacketHandlerDefs();
  for (  PacketHandlerDef handlerDef : handlerDefs) {
    try {
      String className=handlerDef.getClassName();
      Class<?> c=Class.forName(className);
      if (c != null) {
        PacketHandler handler=(PacketHandler)c.newInstance();
        for (        int packetID : handlerDef.getAssociatedPackets()) {
          packetHandlers.put(packetID,handler);
        }
      }
    }
 catch (    Exception e) {
      Logger.error(e);
    }
  }
}

Fixed version (ground truth):
private void loadPacketHandlers() throws Exception {
  PacketHandlerDef[] handlerDefs=Instance.getDataStore().loadLSPacketHandlerDefs();
  for (  PacketHandlerDef handlerDef : handlerDefs) {
    try {
      String className=handlerDef.getClassName();
      Class<?> c=Class.forName(className);
      if (c != null) {
        PacketHandler handler=(PacketHandler)c.newInstance();
        for (        int packetID : handlerDef.getAssociatedPackets()) {
          packetHandlers.put(packetID,handler);
        }
      }
    }
 catch (    Exception e) {
      Logger.error(e);
    }
  }
}
Program: 152189
Project: 152189
Buggy source:
public void loadWorld(World world){
  try {
    tileArchive=new ZipFile(new File(Config.CONF_DIR,"String_Node_Str"));
  }
 catch (  Exception e) {
    Logger.error(e);
  }
  long now=System.currentTimeMillis();
  for (int lvl=0; lvl < 4; lvl++) {
    int wildX=2304;
    int wildY=1776 - (lvl * 944);
    for (int sx=0; sx < 1000; sx+=48) {
      for (int sy=0; sy < 1000; sy+=48) {
        int x=(sx + wildX) / 48;
        int y=(sy + (lvl * 944) + wildY) / 48;
        loadSection(x,y,lvl,world,sx,sy + (944 * lvl));
      }
    }
  }
  Logger.error((System.currentTimeMillis() - now) / 1000 + "String_Node_Str");
  for (  Shop shop : Instance.getDataStore().loadShops()) {
    world.registerShop(shop);
  }
  System.gc();
}

Fixed version (ground truth):
public void loadWorld(World world) throws Exception {
  try {
    tileArchive=new ZipFile(new File(Config.CONF_DIR,"String_Node_Str"));
  }
 catch (  Exception e) {
    Logger.error(e);
  }
  long now=System.currentTimeMillis();
  for (int lvl=0; lvl < 4; lvl++) {
    int wildX=2304;
    int wildY=1776 - (lvl * 944);
    for (int sx=0; sx < 1000; sx+=48) {
      for (int sy=0; sy < 1000; sy+=48) {
        int x=(sx + wildX) / 48;
        int y=(sy + (lvl * 944) + wildY) / 48;
        loadSection(x,y,lvl,world,sx,sy + (944 * lvl));
      }
    }
  }
  Logger.error((System.currentTimeMillis() - now) / 1000 + "String_Node_Str");
  for (  Shop shop : Instance.getDataStore().loadShops()) {
    world.registerShop(shop);
  }
  System.gc();
}