nus-yam/ex-repair huggingface dataset:
Program: 51530
Project: 51530
Buggy source:
@Override public int getPlaceholderIndex(String placeholderName){
  if (m_placeholders == null)   throw new IllegalArgumentException("String_Node_Str");
  Integer idx=m_placeholders.get(placeholderName);
  if (idx == null) {
    idx=m_where.getPlaceholderIndex(placeholderName);
    if (idx == null)     throw new IllegalArgumentException("String_Node_Str");
  }
  return idx;
}

Fixed version (ground truth):
@Override public int getPlaceholderIndex(String placeholderName){
  if (m_placeholders == null)   throw new IllegalArgumentException("String_Node_Str");
  Integer idx=m_placeholders.get(placeholderName);
  if (idx == null) {
    idx=m_where.getPlaceholderIndex(placeholderName);
    if (idx == 0)     throw new IllegalArgumentException("String_Node_Str");
  }
  return idx;
}
Program: 51533
Project: 51533
Buggy source:
@Override public String getQueryString(){
  if (m_fields == null || m_table == null || m_placeholders == null)   throw new IllegalStateException("String_Node_Str");
  StringBuilder builder=new StringBuilder("String_Node_Str");
  builder.append(QbCommonImp.protectTableName(m_table));
  builder.append('(');
  for (  QbField field : m_fields) {
    builder.append(field.toString());
    builder.append(',');
    builder.append(' ');
  }
  builder.append("String_Node_Str");
  for (int i=0; i < m_fields.size(); i++) {
    builder.append('?');
    builder.append(',');
    builder.append(' ');
  }
  builder.append(')');
  return builder.toString();
}

Fixed version (ground truth):
@Override public String getQueryString(){
  if (m_fields == null || m_table == null || m_placeholders == null)   throw new IllegalStateException("String_Node_Str");
  StringBuilder builder=new StringBuilder("String_Node_Str");
  builder.append(QbCommonImp.protectTableName(m_table));
  builder.append('(');
  int fieldCnt=0;
  for (  QbField field : m_fields) {
    builder.append(field.toString());
    if (fieldCnt != m_fields.size() - 1) {
      builder.append(',');
      builder.append(' ');
    }
    fieldCnt++;
  }
  builder.append("String_Node_Str");
  for (int i=0; i < m_fields.size(); i++) {
    builder.append('?');
    builder.append(',');
    builder.append(' ');
  }
  builder.append(')');
  return builder.toString();
}
Program: 51534
Project: 51534
Buggy source:
@Override public int getPlaceholderIndex(String placeholderName){
  if (m_placeholders == null)   throw new IllegalArgumentException("String_Node_Str");
  Integer idx=m_placeholders.get(placeholderName);
  if (idx == null)   throw new IllegalArgumentException("String_Node_Str");
 else   return idx;
}

Fixed version (ground truth):
@Override public int getPlaceholderIndex(String placeholderName){
  if (m_placeholders == null)   throw new IllegalArgumentException("String_Node_Str");
  Integer idx=m_placeholders.get(placeholderName);
  if (idx == null) {
    idx=m_where.getPlaceholderIndex(placeholderName);
    if (idx == null)     throw new IllegalArgumentException("String_Node_Str");
  }
  return idx;
}
Program: 51535
Project: 51535
Buggy source:
public static void main(String... args){
  QbFactory fac=new QbFactoryImp();
  insertTests(fac);
  deleteTests(fac);
  selectTests(fac);
  placeholderTests(fac);
  whereTests(fac);
}

Fixed version (ground truth):
public static void main(String... args){
  QbFactory fac=new QbFactoryImp();
  insertTests(fac);
  deleteTests(fac);
  selectTests(fac);
  placeholderTests(fac);
  whereTests(fac);
  updateTests(fac);
}
Program: 51536
Project: 51536
Buggy source:
static void whereTests(QbFactory fac){
  QbSelect sel=fac.newSelectQuery();
  sel.select(fac.newStdField("String_Node_Str")).from("String_Node_Str").where().where(fac.newStdField("String_Node_Str"),QbWhereOperator.NOT_EQUALS,"String_Node_Str").orWhere(fac.newStdField("String_Node_Str"),"String_Node_Str");
  assert(sel.getQueryString().equals("String_Node_Str"));
  assert(sel.getPlaceholderIndex("String_Node_Str") == 2);
  sel=fac.newSelectQuery();
  sel.select(fac.newStdField("String_Node_Str")).from("String_Node_Str").where().where("String_Node_Str").whereNotIn(fac.newStdField("String_Node_Str"),"String_Node_Str",10).orWhereNotIn(fac.newStdField("String_Node_Str"),"String_Node_Str",5);
  assert(sel.getQueryString().equals("String_Node_Str"));
  assert(sel.getPlaceholderIndex("String_Node_Str") == 11);
}

Fixed version (ground truth):
static void whereTests(QbFactory fac){
  QbSelect sel=fac.newSelectQuery();
  sel.select(fac.newStdField("String_Node_Str")).from("String_Node_Str").where().where(fac.newStdField("String_Node_Str"),QbWhereOperator.NOT_EQUALS,"String_Node_Str").orWhere(fac.newStdField("String_Node_Str"),"String_Node_Str");
  assert(sel.getQueryString().equals("String_Node_Str"));
  assert(sel.getPlaceholderIndex("String_Node_Str") == 2);
  sel=fac.newSelectQuery();
  sel.select(fac.newStdField("String_Node_Str")).from("String_Node_Str").where().where("String_Node_Str").whereNotIn(fac.newStdField("String_Node_Str"),"String_Node_Str",10).orWhereNotIn(fac.newStdField("String_Node_Str"),"String_Node_Str",5);
  assert(sel.getQueryString().equals("String_Node_Str"));
  assert(sel.getPlaceholderIndex("String_Node_Str") == 11);
  sel=fac.newSelectQuery();
  sel.select(fac.newStdField("String_Node_Str")).from("String_Node_Str").where().where(fac.newStdField("String_Node_Str"),QbWhereOperator.LIKE,"String_Node_Str");
  assert(sel.getQueryString().equals("String_Node_Str"));
  assert(sel.getPlaceholderIndex("String_Node_Str") == 1);
  sel=fac.newSelectQuery();
  sel.select(fac.newStdField("String_Node_Str"),fac.newStdField("String_Node_Str")).from("String_Node_Str").where().where(fac.newStdField("String_Node_Str"),"String_Node_Str").orWhere(fac.newStdField("String_Node_Str"),QbWhereOperator.NOT_LIKE,"String_Node_Str");
  assert(sel.getQueryString().equals("String_Node_Str"));
  assert(sel.getPlaceholderIndex("String_Node_Str") == 1);
  assert(sel.getPlaceholderIndex("String_Node_Str") == 2);
}
Program: 51539
Project: 51539
Buggy source:
/** 
 * The default page render for Events, inclusive of ordering of EiEvents based on their start DateTime, in ascending order
 * @return the rendered views.html.events page with a sorted list of EiEventsfrom the EiEventComparator class
 */
@SuppressWarnings("String_Node_Str") @Transactional public static Result events(){
  /** 
 * Comparator to return the ordering of the two EiEvents based on start time
 * @author Jeff LaJoie       
 */
class EiEventComparator implements Comparator<EiEvent> {
    public int compare(    EiEvent eventOne,    EiEvent eventTwo){
      return eventOne.getEiActivePeriod().getProperties().getDtstart().getDateTime().getValue().compare(eventTwo.getEiActivePeriod().getProperties().getDtstart().getDateTime().getValue());
    }
  }
  Date currentDate=new Date();
  GregorianCalendar calendar=new GregorianCalendar();
  calendar.setTime(currentDate);
  XMLGregorianCalendar xCalendar=datatypeFactory.newXMLGregorianCalendar(calendar);
  xCalendar.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
  List<EiEvent> eiEvents=JPA.em().createQuery("String_Node_Str").getResultList();
  Collections.sort(eiEvents,new EiEventComparator());
  for (  EiEvent e : eiEvents) {
    e.getEventDescriptor().withCreatedDateTime(new DateTime().withValue(xCalendar));
    if (!e.getEventDescriptor().getEventStatus().equals(EventStatusEnumeratedType.CANCELLED))     e.getEventDescriptor().setEventStatus(updateStatus(e,e.getEiEventSignals().getEiEventSignals().size()));
    for (    EiEventSignal eventSignal : e.getEiEventSignals().getEiEventSignals()) {
      eventSignal.setCurrentValue(new CurrentValue().withPayloadFloat(new PayloadFloat().withValue(updateSignalPayload(e))));
    }
  }
  return ok(views.html.events.render(eiEvents,new Event()));
}

Fixed version (ground truth):
/** 
 * The default page render for Events, inclusive of ordering of EiEvents based on their start DateTime, in ascending order
 * @return the rendered views.html.events page with a sorted list of EiEventsfrom the EiEventComparator class
 */
@SuppressWarnings("String_Node_Str") @Transactional public static Result events(){
  return ok(views.html.events.render());
}
Program: 51541
Project: 51541
Buggy source:
public static XmppService getInstance(){
  if (instance == null) {
synchronized (XMPPService.class) {
      if (instance == null) {
        try {
          instance=new XmppService();
        }
 catch (        XMPPException e) {
          e.printStackTrace();
        }
catch (        InstantiationException e) {
          e.printStackTrace();
        }
catch (        IllegalAccessException e) {
          e.printStackTrace();
        }
catch (        JAXBException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return instance;
}

Fixed version (ground truth):
public static XmppService getInstance(){
  if (instance == null) {
synchronized (XmppService.class) {
      if (instance == null) {
        try {
          instance=new XmppService();
        }
 catch (        XMPPException e) {
          e.printStackTrace();
        }
catch (        InstantiationException e) {
          e.printStackTrace();
        }
catch (        IllegalAccessException e) {
          e.printStackTrace();
        }
catch (        JAXBException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return instance;
}
Program: 51542
Project: 51542
Buggy source:
public PacketFilter oadrPacketFilter(){
  return new PacketFilter(){
    @Override public boolean accept(    Packet packet){
      return packet.getExtension(OADR2_XMLNS) != null;
    }
  }
;
}

Fixed version (ground truth):
public PacketFilter oadrPacketFilter(){
  return new PacketFilter(){
    @Override public boolean accept(    Packet packet){
      Logger.info("String_Node_Str");
      return packet.getExtension(OADR2_XMLNS) != null;
    }
  }
;
}
Program: 51543
Project: 51543
Buggy source:
public PacketListener oadrPacketListener(){
  return new PacketListener(){
    @Override public void processPacket(    Packet packet){
      Logger.info(packet.toString());
    }
  }
;
}

Fixed version (ground truth):
public PacketListener oadrPacketListener(){
  return new PacketListener(){
    @Override public void processPacket(    Packet packet){
      Logger.info("String_Node_Str");
      Logger.info(packet.toString());
    }
  }
;
}
Program: 51544
Project: 51544
Buggy source:
@Override public void processPacket(Packet packet){
  Logger.info(packet.toString());
}

Fixed version (ground truth):
@Override public void processPacket(Packet packet){
  Logger.info("String_Node_Str");
  Logger.info(packet.toString());
}
Program: 51545
Project: 51545
Buggy source:
@Override public boolean accept(Packet packet){
  return packet.getExtension(OADR2_XMLNS) != null;
}

Fixed version (ground truth):
@Override public boolean accept(Packet packet){
  Logger.info("String_Node_Str");
  return packet.getExtension(OADR2_XMLNS) != null;
}
Program: 51546
Project: 51546
Buggy source:
public static XmppService getInstance(){
  if (instance == null) {
synchronized (XmppService.class) {
      if (instance == null) {
        try {
          instance=new XmppService();
        }
 catch (        XMPPException e) {
          e.printStackTrace();
        }
catch (        InstantiationException e) {
          e.printStackTrace();
        }
catch (        IllegalAccessException e) {
          e.printStackTrace();
        }
catch (        JAXBException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return instance;
}

Fixed version (ground truth):
public static XmppService getInstance(){
  if (instance == null) {
synchronized (XmppService.class) {
      if (instance == null) {
        try {
          instance=new XmppService();
        }
 catch (        XMPPException e) {
          Logger.error("String_Node_Str",e);
        }
catch (        InstantiationException e) {
          Logger.error("String_Node_Str",e);
        }
catch (        IllegalAccessException e) {
          Logger.error("String_Node_Str",e);
        }
catch (        JAXBException e) {
          Logger.error("String_Node_Str",e);
        }
      }
    }
  }
  return instance;
}
Program: 51547
Project: 51547
Buggy source:
@Transactional public static Result deleteUser(long id){
  createNewEm();
  entityManager.remove(entityManager.find(UserForm.class,id));
  entityManager.getTransaction().commit();
  flash("String_Node_Str","String_Node_Str");
  return redirect(routes.Events.events());
}

Fixed version (ground truth):
@Transactional public static Result deleteUser(Long id){
  createNewEm();
  entityManager.remove(entityManager.find(UserForm.class,id));
  entityManager.getTransaction().commit();
  flash("String_Node_Str","String_Node_Str");
  return redirect(routes.Users.users());
}
Program: 51549
Project: 51549
Buggy source:
/** 
 * Notifies all methods,that have called waitForContinueTask() to continue their operation.
 */
public void continueTask(){
synchronized (this) {
    notify();
  }
  return;
}

Fixed version (ground truth):
/** 
 * Notifies all methods,that have called waitForContinueTask() to continue their operation.
 */
public void continueTask(){
synchronized (lock) {
    lock.notify();
  }
  return;
}
Program: 51551
Project: 51551
Buggy source:
/** 
 * Notifies all currents tasks to be interrupted once they are able to read the new value of interruptSent. Immediate interruption means that all tasks should end without any further activities, while non-immediate interruption means that some tasks may pause to wait for continueTask() to notify them before ending completely.
 * @param immediate If this is true, then continueTask is being waited beforethe previous job ends. If this is false, then it stops immediately and next job can start right after calling this.
 */
private void interruptCurrentTasks(boolean immediate){
  if (immediate == true) {
    currentState=INTERRUPTED_WITHOUT_PAUSE;
  }
 else {
    currentState=INTERRUPTED_WITH_PAUSE;
  }
  interruptSent=true;
synchronized (this) {
    notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * Notifies all currents tasks to be interrupted once they are able to read the new value of interruptSent. Immediate interruption means that all tasks should end without any further activities, while non-immediate interruption means that some tasks may pause to wait for continueTask() to notify them before ending completely.
 * @param immediate If this is true, then continueTask is being waited beforethe previous job ends. If this is false, then it stops immediately and next job can start right after calling this.
 */
private void interruptCurrentTasks(boolean immediate){
  if (immediate == true) {
    currentState=INTERRUPTED_WITHOUT_PAUSE;
  }
 else {
    currentState=INTERRUPTED_WITH_PAUSE;
  }
  interruptSent=true;
synchronized (lock) {
    lock.notifyAll();
  }
}
Program: 51552
Project: 51552
Buggy source:
/** 
 * A method can call this, if it wants enter into pause mode and wait for someone to call continueTask() or continueTaskWithoutPauses() methods. This method cannot however be used, unless the method which is calling this hasn't been set to run in a thread of its own. eg. by calling new GUIThreader()
 */
public void waitForContinueTask(){
synchronized (this) {
    try {
      wait();
    }
 catch (    InterruptedException e) {
      System.out.println("String_Node_Str");
    }
  }
  return;
}

Fixed version (ground truth):
/** 
 * A method can call this, if it wants enter into pause mode and wait for someone to call continueTask() or continueTaskWithoutPauses() methods. This method cannot however be used, unless the method which is calling this hasn't been set to run in a thread of its own. eg. by calling new GUIThreader()
 */
public void waitForContinueTask(){
synchronized (lock) {
    try {
      lock.wait();
    }
 catch (    InterruptedException e) {
      System.out.println("String_Node_Str");
    }
  }
  return;
}
Program: 51553
Project: 51553
Buggy source:
/** 
 * Notifies all methods, that have called waitForContinueTask() to continue their operation plus informs them that waitForContinueTask() should no longer be called during current operation.
 */
public void continueTaskWithoutPauses(){
  noPauses=true;
synchronized (this) {
    notify();
  }
  return;
}

Fixed version (ground truth):
/** 
 * Notifies all methods, that have called waitForContinueTask() to continue their operation plus informs them that waitForContinueTask() should no longer be called during current operation.
 */
public void continueTaskWithoutPauses(){
  noPauses=true;
synchronized (lock) {
    lock.notify();
  }
  return;
}
Program: 51554
Project: 51554
Buggy source:
/** 
 * This method corresponds to the menu option File -> Erase memory.
 */
public synchronized void menuEraseMemory(){
  interruptCurrentTasks(true);
  if (threadRunning == true) {
    waitForContinueTask();
  }
  control.eraseMemory();
  gui.updateReg(GUI.R0,0);
  gui.updateReg(GUI.R1,0);
  gui.updateReg(GUI.R2,0);
  gui.updateReg(GUI.R3,0);
  gui.updateReg(GUI.R4,0);
  gui.updateReg(GUI.R5,0);
  gui.updateReg(GUI.R6,0);
  gui.updateReg(GUI.R7,0);
  gui.updateReg(GUI.PC,0);
  gui.resetAll();
  gui.updateStatusBar(new Message("String_Node_Str").toString());
  gui.setGUIView(1);
  currentState=NONE;
  setGUICommandsForCurrentState();
  display.setMem(control.getPhysicalMemory());
}

Fixed version (ground truth):
/** 
 * This method corresponds to the menu option File -> Erase memory.
 */
public void menuEraseMemory(){
  interruptCurrentTasks(true);
synchronized (lock) {
    if (threadRunning == true) {
      waitForContinueTask();
    }
    control.eraseMemory();
    gui.updateReg(GUI.R0,0);
    gui.updateReg(GUI.R1,0);
    gui.updateReg(GUI.R2,0);
    gui.updateReg(GUI.R3,0);
    gui.updateReg(GUI.R4,0);
    gui.updateReg(GUI.R5,0);
    gui.updateReg(GUI.R6,0);
    gui.updateReg(GUI.R7,0);
    gui.updateReg(GUI.PC,0);
    gui.resetAll();
    gui.updateStatusBar(new Message("String_Node_Str").toString());
    gui.setGUIView(1);
    currentState=NONE;
    setGUICommandsForCurrentState();
    display.setMem(control.getPhysicalMemory());
  }
}
Program: 51556
Project: 51556
Buggy source:
@Override public void setPort(int n,int value){
  if (n == 0) {
switch (value) {
case 0:
      flagged=0;
    break;
case 1:
  disabled=true;
break;
case 2:
disabled=false;
break;
}
}
 else if (n == 1) {
flagged=flagged & value;
enabled=value;
}
throw new RuntimeException("String_Node_Str" + n);
}

Fixed version (ground truth):
@Override public void setPort(int n,int value){
  if (n == 0) {
switch (value) {
case 0:
      flagged=0;
    return;
case 1:
  disabled=true;
return;
case 2:
disabled=false;
return;
}
}
 else if (n == 1) {
flagged=flagged & value;
enabled=value;
return;
}
throw new RuntimeException("String_Node_Str" + n);
}
Program: 51557
Project: 51557
Buggy source:
@Override public void setPort(int n,int value){
  if (n == 0)   rnd=new Random(value);
  throw new RuntimeException("String_Node_Str" + n);
}

Fixed version (ground truth):
@Override public void setPort(int n,int value){
  if (n == 0) {
    rnd=new Random(value);
    return;
  }
  throw new RuntimeException("String_Node_Str" + n);
}
Program: 51558
Project: 51558
Buggy source:
/** 
 * Returns a value, which is the length of the longest text in a certain column.
 * @param column Number of the column. 0 is the leftmost, next to the right is 1, and so on.
 * @return The lenght of the longest text in the given column, in pixel.
 */
public int getMaxTextLengthInColumn(int column){
  int maxLength=0;
  int rowForMaxLength=0;
  for (int i=0; i < this.getRowCount(); i++) {
    String str=(String)((DefaultTableModel)getModel()).getValueAt(i,column);
    if (str.length() > maxLength) {
      maxLength=str.length();
      rowForMaxLength=i;
    }
  }
  return getTextLength(rowForMaxLength,column);
}

Fixed version (ground truth):
/** 
 * Returns a value, which is the length of the longest text in a certain column.
 * @param column Number of the column. 0 is the leftmost, next to the right is 1, and so on.
 * @return The lenght of the longest text in the given column, in pixel.
 */
public int getMaxTextLengthInColumn(int column){
  int maxLength=0;
  int rowForMaxLength=0;
  for (int i=0; i < this.getRowCount(); i++) {
    String str=(String)((DefaultTableModel)getModel()).getValueAt(i,column);
    if (str.length() > maxLength) {
      maxLength=str.length();
      rowForMaxLength=i;
    }
  }
  return getRowCount() != 0 ? getTextLength(rowForMaxLength,column) : 0;
}
Program: 51559
Project: 51559
Buggy source:
/** 
 * This method tests whether a label name contains at least one  non-number and consists of 0-9, A-� and _.  It does not check whether the label is in use already or if it is a reserved word.
 * @param labelName The label name to test.
 * @return True if the label consists of valid characters, false otherwise. 
 */
private boolean validLabelName(String labelName){
  if (labelName.matches("String_Node_Str") && labelName.matches("String_Node_Str")) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * This method tests whether a label name contains at least one  non-number and consists of 0-9, A-Ö and _.  It does not check whether the label is in use already or if it is a reserved word.
 * @param labelName The label name to test.
 * @return True if the label consists of valid characters, false otherwise. 
 */
private boolean validLabelName(String labelName){
  if (labelName.matches("String_Node_Str") && labelName.matches("String_Node_Str")) {
    return true;
  }
  return false;
}
Program: 51565
Project: 51565
Buggy source:
/** 
 * The control panel handles one simulation at a time, this should be "registered" using this method. Load all the windows, one per display
 * @param sim - simulation object
 * @param simFile - new file to load (can be null)
 * @throws ConnectionError
 * @throws ContentError
 * @throws RuntimeError
 * @throws ParseError
 */
public void registerSimulation(Sim sim,File simFile) throws ConnectionError, ContentError, RuntimeError, ParseError {
  simulation=sim;
  if (simFile != null) {
    workingFile=simFile;
    statusLabel.setText(workingFile.getName());
  }
  loadRunConfigsFromSimulation();
  positionViewers();
}

Fixed version (ground truth):
/** 
 * The control panel handles one simulation at a time, this should be "registered" using this method. Load all the windows, one per display
 * @param sim - simulation object
 * @param simFile - new file to load (can be null)
 * @throws ConnectionError
 * @throws ContentError
 * @throws RuntimeError
 * @throws ParseError
 */
protected void registerSimulation(Sim sim,File simFile){
  simulation=sim;
  if (sim == null)   return;
  if (simFile != null) {
    setNewWorkingFile(simFile);
  }
  loadRunConfigsFromSimulation();
  positionViewers();
}
Program: 51566
Project: 51566
Buggy source:
/** 
 * load the runConfigs from the simulation into the runConfigs map. The runConfigs map is indexed for easy referencing
 */
private void loadRunConfigsFromSimulation(){
  int index=-1;
  for (  RunConfig conf : simulation.getRunConfigs()) {
    runConfigs.put(index++,conf);
  }
}

Fixed version (ground truth):
/** 
 * load the runConfigs from the simulation into the runConfigs map. The runConfigs map is indexed for easy referencing
 */
protected void loadRunConfigsFromSimulation(){
  int index=-1;
  for (  RunConfig conf : simulation.getRunConfigs()) {
    runConfigs.put(index++,conf);
  }
}
Program: 51567
Project: 51567
Buggy source:
private void clearCurrentSimulation(){
  for (  String key : simulation.getDvHM().keySet()) {
    if (simulation.getDvHM().get(key) instanceof StandaloneViewer) {
      StandaloneViewer viewer=((StandaloneViewer)simulation.getDvHM().get(key));
      viewerRects.put(key,viewer.getViewerRectangle());
      viewer.close();
    }
  }
}

Fixed version (ground truth):
protected void clearCurrentSimulation(){
  for (  String key : simulation.getDvHM().keySet()) {
    if (simulation.getDvHM().get(key) instanceof StandaloneViewer) {
      StandaloneViewer viewer=((StandaloneViewer)simulation.getDvHM().get(key));
      viewerRects.put(key,viewer.getViewerRectangle());
      viewer.close();
    }
  }
}
Program: 51569
Project: 51569
Buggy source:
private void importFile(){
  FileInclusionReader fir=new FileInclusionReader(workingFile);
  try {
    Sim sim=new Sim(fir.read());
    sim.readModel();
    sim.build();
    ControlPanel.getInstance().registerSimulation(sim,null);
  }
 catch (  Exception e) {
    JOptionPane.showMessageDialog(new JFrame(),String.format("String_Node_Str",e.getMessage()),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
protected abstract Sim importFile(File sourceFile);
Program: 51571
Project: 51571
Buggy source:
/** 
 * When simulation.run() is called from the actionPerformed method below, it holds up the  Java Swing display thread and we don't get the nice animation, so call run() in its own thread here.
 */
private void runSimulationInNewThread(){
  for (  final Entry<Integer,RunConfig> conf : runConfigs.entrySet()) {
    multiThreadService.execute(new Runnable(){
      @Override public void run(){
        try {
          simulation.run(conf.getValue(),false);
        }
 catch (        Exception ex) {
          JOptionPane.showMessageDialog(new JFrame(),String.format("String_Node_Str",ex.getMessage()),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * When simulation.run() is called from the actionPerformed method below, it holds up the  Java Swing display thread and we don't get the nice animation, so call run() in its own thread here.
 */
protected void runSimulationInNewThread(){
  for (  final Entry<Integer,RunConfig> conf : runConfigs.entrySet()) {
    multiThreadService.execute(new Runnable(){
      @Override public void run(){
        try {
          simulation.run(conf.getValue(),false);
        }
 catch (        Exception ex) {
          JOptionPane.showMessageDialog(new JFrame(),String.format("String_Node_Str",ex.getMessage()),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
        }
      }
    }
);
  }
}
Program: 51572
Project: 51572
Buggy source:
private void addToMenu(String[] actions,JMenu jm){
  for (  String s : actions) {
    JMenuItem jmi=new JMenuItem(s);
    jmi.setActionCommand(s.toLowerCase());
    jmi.addActionListener(this);
    jm.add(jmi);
  }
}

Fixed version (ground truth):
protected void addToMenu(String[] actions,JMenu jm){
  for (  String s : actions) {
    JMenuItem jmi=new JMenuItem(s);
    jmi.setActionCommand(s.toLowerCase());
    jmi.addActionListener(this);
    jm.add(jmi);
  }
}
Program: 51573
Project: 51573
Buggy source:
public void actionPerformed(ActionEvent e){
  String sev=e.getActionCommand();
  if (sev.equals("String_Node_Str")) {
    importNewFile();
    runSimulationInNewThread();
  }
 else   if (sev.equals("String_Node_Str")) {
    frame.dispatchEvent(new WindowEvent(frame,WindowEvent.WINDOW_CLOSING));
  }
 else   if (sev.equals("String_Node_Str")) {
    bringAllViewersToForeground();
  }
 else   if (sev.equals("String_Node_Str")) {
    if (simulation != null) {
      clearCurrentSimulation();
      importFile();
      runSimulationInNewThread();
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  String sev=e.getActionCommand();
  if (sev.equals("String_Node_Str")) {
    File newfile=SwingDialogs.getInstance().getFileToRead();
    if (newfile == null)     return;
    clearAll();
    try {
      setNewWorkingFile(newfile);
      Sim sim=importFile(newfile);
      registerSimulation(sim,workingFile);
    }
 catch (    Exception ex) {
      setPrevWorkingFile();
      restoreViewerWindows();
      JOptionPane.showMessageDialog(new JFrame(),String.format("String_Node_Str",ex.getMessage()),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    }
    runSimulationInNewThread();
  }
 else   if (sev.equals("String_Node_Str")) {
    frame.dispatchEvent(new WindowEvent(frame,WindowEvent.WINDOW_CLOSING));
  }
 else   if (sev.equals("String_Node_Str")) {
    restoreViewerWindows();
  }
 else   if (sev.equals("String_Node_Str")) {
    if (simulation != null) {
      clearCurrentSimulation();
      try {
        Sim sim=importFile(workingFile);
        registerSimulation(sim,null);
      }
 catch (      Exception ex) {
        restoreViewerWindows();
        JOptionPane.showMessageDialog(new JFrame(),String.format("String_Node_Str",ex.getMessage()),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      }
      runSimulationInNewThread();
    }
  }
}
Program: 51574
Project: 51574
Buggy source:
private ControlPanel(){
  frame=new JFrame("String_Node_Str");
  frame.setPreferredSize(windowDimension);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  Container ctr=frame.getContentPane();
  JMenuBar jmb=new JMenuBar();
  JMenu jm=new JMenu("String_Node_Str");
  String[] actions={"String_Node_Str","String_Node_Str"};
  addToMenu(actions,jm);
  jmb.add(jm);
  JMenu jvm=new JMenu("String_Node_Str");
  String[] viewActions={"String_Node_Str"};
  addToMenu(viewActions,jvm);
  jmb.add(jvm);
  JMenu jmsimulation=new JMenu("String_Node_Str");
  addToMenuWithShortcut("String_Node_Str",jmsimulation,KeyEvent.VK_F6,0);
  jmb.add(jmsimulation);
  frame.setJMenuBar(jmb);
  statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
  statusLabel.setVerticalAlignment(SwingConstants.TOP);
  statusLabel.setFont(new Font(statusLabel.getFont().getFontName(),10,10));
  statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
  JPanel statusPanel=new JPanel();
  statusPanel.setBorder(BorderFactory.createLineBorder(Color.GRAY));
  statusPanel.setLayout(new BoxLayout(statusPanel,BoxLayout.X_AXIS));
  statusPanel.add(statusLabel);
  ctr.add(pmain,BorderLayout.SOUTH);
  ctr.add(statusPanel,BorderLayout.SOUTH);
  createToolbar();
  show();
}

Fixed version (ground truth):
public ControlPanel(){
  frame=new JFrame("String_Node_Str");
  frame.setPreferredSize(windowDimension);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  Container ctr=frame.getContentPane();
  JMenuBar jmb=new JMenuBar();
  JMenu jm=new JMenu("String_Node_Str");
  String[] actions={"String_Node_Str","String_Node_Str"};
  addToMenu(actions,jm);
  jmb.add(jm);
  JMenu jvm=new JMenu("String_Node_Str");
  String[] viewActions={"String_Node_Str"};
  addToMenu(viewActions,jvm);
  jmb.add(jvm);
  JMenu jmsimulation=new JMenu("String_Node_Str");
  menuItemReloadAndRun=addToMenuWithShortcut("String_Node_Str",jmsimulation,KeyEvent.VK_F6,0);
  jmb.add(jmsimulation);
  frame.setJMenuBar(jmb);
  statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
  statusLabel.setVerticalAlignment(SwingConstants.TOP);
  statusLabel.setFont(new Font(statusLabel.getFont().getFontName(),10,10));
  statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
  JPanel statusPanel=new JPanel();
  statusPanel.setBorder(BorderFactory.createLineBorder(Color.GRAY));
  statusPanel.setLayout(new BoxLayout(statusPanel,BoxLayout.X_AXIS));
  statusPanel.add(statusLabel);
  ctr.add(pmain,BorderLayout.SOUTH);
  ctr.add(statusPanel,BorderLayout.SOUTH);
  createToolbar();
  setRunSimulationEnabled(false);
  show();
}
Program: 51575
Project: 51575
Buggy source:
/** 
 * @param action - The name of the action item
 * @param jm - the menu for this item to be added to
 * @param key - int representing the ID of KeyEvent (eg KeyEvent.VK_F6)
 * @param modifier - int representing the ID of ActionEvent (eg ActionEvent.ALT_MASK , 0 for no modifier)
 */
private void addToMenuWithShortcut(String action,JMenu jm,int key,int modifier){
  JMenuItem jmi=new JMenuItem(action);
  jmi.setActionCommand(action.toLowerCase());
  jmi.addActionListener(this);
  jmi.setAccelerator(KeyStroke.getKeyStroke(key,modifier));
  jm.add(jmi);
}

Fixed version (ground truth):
/** 
 * @param action - The name of the action item
 * @param jm - the menu for this item to be added to
 * @param key - int representing the ID of KeyEvent (eg KeyEvent.VK_F6)
 * @param modifier - int representing the ID of ActionEvent (eg ActionEvent.ALT_MASK , 0 for no modifier)
 */
protected JMenuItem addToMenuWithShortcut(String action,JMenu jm,int key,int modifier){
  JMenuItem jmi=new JMenuItem(action);
  jmi.setActionCommand(action.toLowerCase());
  jmi.addActionListener(this);
  jmi.setAccelerator(KeyStroke.getKeyStroke(key,modifier));
  jm.add(jmi);
  return jmi;
}
Program: 51576
Project: 51576
Buggy source:
private String mapEs(String frm,String to,String str){
  int strlen=str.length();
  String ret="String_Node_Str";
  int lastmatch=0;
  int newmatch=str.indexOf(frm);
  while (newmatch >= 0) {
    ret+=str.substring(lastmatch,newmatch);
    if (newmatch + 3 < strlen && numberHS.contains(str.substring(newmatch + 2,newmatch + 3))) {
      ret+=to;
    }
 else {
      ret+=frm;
    }
    lastmatch=newmatch + frm.length();
    newmatch=str.indexOf(frm,lastmatch);
  }
  ret+=str.substring(lastmatch,str.length());
  return ret;
}

Fixed version (ground truth):
private String mapEs(String frm,String to,String str){
  int strlen=str.length();
  String ret="String_Node_Str";
  int lastmatch=0;
  int newmatch=str.indexOf(frm);
  while (newmatch >= 0) {
    ret+=str.substring(lastmatch,newmatch);
    if (newmatch + 3 <= strlen && numberHS.contains(str.substring(newmatch + 2,newmatch + 3))) {
      ret+=to;
    }
 else {
      ret+=frm;
    }
    lastmatch=newmatch + frm.length();
    newmatch=str.indexOf(frm,lastmatch);
  }
  ret+=str.substring(lastmatch,str.length());
  return ret;
}
Program: 51577
Project: 51577
Buggy source:
public ArrayList<Node> tokenize(String e){
  ArrayList<Node> ret=new ArrayList<Node>();
  String ewk=disambiguate(e);
  for (  String op : opHM.keySet()) {
    ewk=replaceAll(ewk,op,"String_Node_Str" + op + "String_Node_Str");
  }
  ewk=replaceAll(ewk,"String_Node_Str","String_Node_Str");
  ewk=replaceAll(ewk,"String_Node_Str","String_Node_Str");
  ewk=reambiguate(ewk);
  if (verbose) {
    E.info("String_Node_Str" + ewk);
  }
  Node pretok=null;
  String[] bits=ewk.split("String_Node_Str");
  for (int i=0; i < bits.length; i++) {
    String stok=bits[i];
    stok=stok.trim();
    if (stok.length() > 0) {
      Node n=null;
      if (stok.equals("String_Node_Str")) {
        n=new GroupNode();
      }
 else       if (stok.equals("String_Node_Str")) {
        n=new OpenNode();
      }
 else       if (funcHS.contains(stok)) {
        n=new FunctionNode(stok);
      }
 else       if (opHM.containsKey(stok)) {
        n=opHM.get(stok).copy();
        if (n instanceof MinusNode && pretok instanceof AbstractOperatorNode) {
          n=new UnaryMinusNode();
        }
      }
 else       if (snum.indexOf(stok.substring(0,1)) >= 0) {
        n=new ConstantNode(stok);
      }
 else {
        n=new VariableNode(stok);
      }
      if (pretok != null) {
        pretok.linkNext(n);
      }
      pretok=n;
      ret.add(n);
    }
  }
  return ret;
}

Fixed version (ground truth):
public ArrayList<Node> tokenize(String e){
  ArrayList<Node> ret=new ArrayList<Node>();
  String ewk=disambiguate(e);
  if (verbose) {
    E.info("String_Node_Str" + ewk);
  }
  for (  String op : opHM.keySet()) {
    ewk=replaceAll(ewk,op,"String_Node_Str" + op + "String_Node_Str");
  }
  ewk=replaceAll(ewk,"String_Node_Str","String_Node_Str");
  ewk=replaceAll(ewk,"String_Node_Str","String_Node_Str");
  ewk=reambiguate(ewk);
  if (verbose) {
    E.info("String_Node_Str" + ewk);
  }
  Node pretok=null;
  String[] bits=ewk.split("String_Node_Str");
  for (int i=0; i < bits.length; i++) {
    String stok=bits[i];
    stok=stok.trim();
    if (stok.length() > 0) {
      Node n=null;
      if (stok.equals("String_Node_Str")) {
        n=new GroupNode();
      }
 else       if (stok.equals("String_Node_Str")) {
        n=new OpenNode();
      }
 else       if (funcHS.contains(stok)) {
        n=new FunctionNode(stok);
      }
 else       if (opHM.containsKey(stok)) {
        n=opHM.get(stok).copy();
        if (n instanceof MinusNode && pretok instanceof AbstractOperatorNode) {
          n=new UnaryMinusNode();
        }
      }
 else       if (snum.indexOf(stok.substring(0,1)) >= 0) {
        n=new ConstantNode(stok);
      }
 else {
        n=new VariableNode(stok);
      }
      if (pretok != null) {
        pretok.linkNext(n);
      }
      pretok=n;
      ret.add(n);
    }
  }
  return ret;
}
Program: 51579
Project: 51579
Buggy source:
/** 
 * Read the instance's associated keystore file into memory.
 */
public void loadStoreFile(){
  try {
    BufferedInputStream bis=new BufferedInputStream(new FileInputStream(this.storeFile));
    JSONTokener jsonTokener=new JSONTokener(new InputStreamReader(bis));
    JSONArray array=new JSONArray(jsonTokener);
    bis.close();
    this.keys=new ConcurrentHashMap<String,Key>(array.length());
    for (int i=0, j=array.length(); i < j; i+=1) {
      JSONObject obj=array.getJSONObject(i);
      Key key=new Key(obj.getString("String_Node_Str"),obj.getString("String_Node_Str"));
      this.addKey(key);
    }
  }
 catch (  FileNotFoundException e) {
    log.error("String_Node_Str");
    log.debug(e.toString());
  }
catch (  JSONException e) {
    log.error("String_Node_Str");
    log.debug(e.toString());
  }
catch (  IOException e) {
    log.error("String_Node_Str");
    log.debug(e.toString());
  }
}

Fixed version (ground truth):
/** 
 * Read the instance's associated keystore file into memory.
 */
public void loadStoreFile(){
  try {
    BufferedInputStream bis=new BufferedInputStream(new FileInputStream(this.storeFile));
    JSONTokener jsonTokener=new JSONTokener(new InputStreamReader(bis));
    JSONArray array=new JSONArray(jsonTokener);
    bis.close();
    this.keys=new ConcurrentHashMap<String,Key>(array.length());
    for (int i=0, j=array.length(); i < j; i+=1) {
      JSONObject obj=array.getJSONObject(i);
      Key key=new Key(obj.getString("String_Node_Str"),obj.getString("String_Node_Str"));
      log.debug("String_Node_Str",key.name());
      this.addKey(key);
    }
  }
 catch (  FileNotFoundException e) {
    log.error("String_Node_Str");
    log.debug(e.toString());
  }
catch (  JSONException e) {
    log.error("String_Node_Str");
    log.debug(e.toString());
  }
catch (  IOException e) {
    log.error("String_Node_Str");
    log.debug(e.toString());
  }
}
Program: 51580
Project: 51580
Buggy source:
/** 
 * Set the instance's keystore file to the given   {@link File}.
 * @param file The JSON file.
 */
public void setStoreFile(File file){
  this.storeFile=storeFile;
}

Fixed version (ground truth):
/** 
 * Set the instance's keystore file to the given   {@link File}. This will also invoke  {@link edu.clayton.cas.support.token.keystore.JSONKeystore#loadStoreFile()}. Thus, you should be sure that the instance is okay to re-initialize.
 * @param file The JSON file.
 */
public void setStoreFile(File file){
  this.storeFile=file;
  this.loadStoreFile();
}
Program: 51581
Project: 51581
Buggy source:
@Before public void buildStore() throws URISyntaxException {
  URL url=this.getClass().getClassLoader().getResource("String_Node_Str");
  File file=new File(url.toURI());
  this.keystore=new JSONKeystore(file);
}

Fixed version (ground truth):
@Before public void buildStore() throws URISyntaxException {
  URL url=this.getClass().getClassLoader().getResource("String_Node_Str");
  this.keystoreFile=new File(url.toURI());
  this.keystore=new JSONKeystore(this.keystoreFile);
}
Program: 51582
Project: 51582
Buggy source:
@Override public int yearsBetweenDates(LocalDate startDate,LocalDate endDate){
  return endDate.getYear() - startDate.getYear();
}

Fixed version (ground truth):
@Override public int yearsBetweenDates(LocalDate startDate,LocalDate endDate){
  return YEARS.between(startDate,endDate).getAmountInt();
}
Program: 51583
Project: 51583
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected void runOneIteration() throws Exception {
  logger.info("String_Node_Str");
  Tweet tweet=recentTweet.get();
  try {
    logger.info("String_Node_Str");
    if (tweet != null) {
      this.endpointUriBuilder=this.endpointUriBuilder.replaceQueryParam("String_Node_Str",tweet.getId());
    }
  }
 catch (  IllegalArgumentException iae) {
    logger.error(iae,"String_Node_Str");
    throw iae;
  }
 finally {
    logger.info("String_Node_Str");
  }
  Tweet[] tweets;
  try {
    logger.info("String_Node_Str");
    final URI uri=this.endpointUriBuilder.build();
    logger.info("String_Node_Str");
    tweets=this.httpClient.get(uri,MediaType.APPLICATION_JSON_TYPE,Tweet[].class);
  }
 catch (  RuntimeException re) {
    logger.error(re,"String_Node_Str");
    throw re;
  }
 finally {
    logger.info("String_Node_Str");
  }
  if (tweets == null)   tweets=new Tweet[0];
  logger.info("String_Node_Str",tweets.length);
  if (tweets.length > 0)   eventBus.post(tweets);
  if (tweets.length > 0) {
    if (tweet == null)     tweet=tweets[0];
    for (    Tweet t : tweets) {
      if (tweet.getCreatedAt().isBefore(t.getCreatedAt()))       tweet=t;
    }
  }
  this.recentTweet=Optional.fromNullable(tweet);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected void runOneIteration() throws Exception {
  logger.info("String_Node_Str");
  Tweet tweet=null;
  try {
    if (recentTweet.isPresent()) {
      tweet=recentTweet.get();
      this.endpointUriBuilder=this.endpointUriBuilder.replaceQueryParam("String_Node_Str",tweet.getId());
    }
  }
 catch (  IllegalArgumentException iae) {
    logger.error(iae,"String_Node_Str");
    throw iae;
  }
  Tweet[] tweets;
  try {
    logger.info("String_Node_Str");
    final URI uri=this.endpointUriBuilder.build();
    logger.info("String_Node_Str");
    tweets=this.httpClient.get(uri,MediaType.APPLICATION_JSON_TYPE,Tweet[].class);
  }
 catch (  RuntimeException re) {
    logger.error(re,"String_Node_Str");
    throw re;
  }
 finally {
    logger.info("String_Node_Str");
  }
  if (tweets == null)   tweets=new Tweet[0];
  logger.info("String_Node_Str",tweets.length);
  if (tweets.length > 0)   eventBus.post(tweets);
  if (tweets.length > 0) {
    if (tweet == null)     tweet=tweets[0];
    for (    Tweet t : tweets) {
      if (tweet.getCreatedAt().isBefore(t.getCreatedAt()))       tweet=t;
    }
  }
  this.recentTweet=Optional.fromNullable(tweet);
}
Program: 51584
Project: 51584
Buggy source:
@EventHandler public void onTransaction(TraderTransactionEvent event) throws IOException {
  String name=event.getNPC().getName();
  int stra=event.getStatus().equals(TraderStatus.SELL) ? 1 : 0;
  int btra=event.getStatus().equals(TraderStatus.BUY) ? 1 : 0;
  URL dtl=new URL("String_Node_Str" + CitizensTrader.getInstance().getServer().getName() + "String_Node_Str"+ name+ "String_Node_Str"+ stra+ "String_Node_Str"+ btra);
  URLConnection dtlCon=dtl.openConnection();
  dtlCon.connect();
}

Fixed version (ground truth):
@EventHandler public void onTransaction(TraderTransactionEvent event) throws IOException {
  String name=event.getNPC().getName();
  int stra=event.getResult().equals(TransactionResult.SUCCESS_SELL) ? 1 : 0;
  int btra=event.getStatus().equals(TransactionResult.SUCCESS_BUY) ? 1 : 0;
  URL dtl=new URL("String_Node_Str" + CitizensTrader.getInstance().getServer().getServerName() + "String_Node_Str"+ name+ "String_Node_Str"+ stra+ "String_Node_Str"+ btra);
  URLConnection dtlCon=dtl.openConnection();
  dtlCon.getInputStream();
}
Program: 51585
Project: 51585
Buggy source:
@Override public int hashCode(){
  System.out.print(key);
  return key.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return key.hashCode();
}
Program: 51586
Project: 51586
Buggy source:
public void sendMessage(CommandSender sender,String key,Object... obj){
  if (!cache.containsKey(new LocaleEntry(key,pver))) {
    locale.set(buildPath("String_Node_Str",key),"String_Node_Str");
    cache.put(new LocaleEntry(key,pver),"String_Node_Str");
    save();
  }
  String msg=cache.get(new LocaleEntry(key,pver));
  for (int i=0; i < obj.length; ) {
    if (obj[i] instanceof String) {
      System.out.print(obj[i + 1]);
      if (!keywords.containsKey(new LocaleEntry((String)obj[i + 1],pver)) && ((String)obj[i + 1]).startsWith("String_Node_Str")) {
        locale.set(buildPath("String_Node_Str",((String)obj[i + 1]).substring(1)),"String_Node_Str");
        keywords.put(new LocaleEntry((String)obj[i + 1],pver),"String_Node_Str");
        save();
      }
      msg=msg.replaceAll("String_Node_Str" + (String)obj[i] + "String_Node_Str",keywords.get(new LocaleEntry((String)obj[i + 1],pver)));
      i+=2;
    }
 else     ++i;
  }
  sender.sendMessage(msg.replace('^','§'));
}

Fixed version (ground truth):
public void sendMessage(CommandSender sender,String key,Object... obj){
  if (!cache.containsKey(new LocaleEntry(key,pver))) {
    locale.set(buildPath("String_Node_Str",key),"String_Node_Str");
    cache.put(new LocaleEntry(key,pver),"String_Node_Str");
    save();
  }
  String msg=cache.get(new LocaleEntry(key,pver));
  for (int i=0; i < obj.length; ) {
    if (obj[i] instanceof String) {
      if (!keywords.containsKey(new LocaleEntry((String)obj[i + 1],pver)) && ((String)obj[i + 1]).startsWith("String_Node_Str")) {
        locale.set(buildPath("String_Node_Str",((String)obj[i + 1]).substring(1)),"String_Node_Str");
        keywords.put(new LocaleEntry((String)obj[i + 1],pver),"String_Node_Str");
        save();
      }
      msg=msg.replaceAll("String_Node_Str" + (String)obj[i] + "String_Node_Str",keywords.get(new LocaleEntry((String)obj[i + 1],pver)));
      i+=2;
    }
 else     ++i;
  }
  sender.sendMessage(msg.replace('^','§'));
}
Program: 51588
Project: 51588
Buggy source:
@EventHandler public void onInventoryClick(InventoryClickEvent event){
  if (!(event.getWhoClicked() instanceof Player))   return;
  Player p=(Player)event.getWhoClicked();
  if (p.getGameMode().equals(GameMode.CREATIVE) && event.getView().getType().equals(InventoryType.PLAYER))   return;
  if ((p.getGameMode().equals(GameMode.SURVIVAL) || p.getGameMode().equals(GameMode.SURVIVAL)) && event.getView().getType().equals(InventoryType.CRAFTING))   return;
  tNPC economyNpc=playerInteraction.get(p.getName());
  if (economyNpc == null)   return;
  if (economyNpc.locked()) {
    economyNpc.managerMode(event);
    return;
  }
  if (economyNpc instanceof Banker) {
    if (((Banker)economyNpc).getStatus().settings()) {
      economyNpc.settingsMode(event);
      return;
    }
  }
  economyNpc.simpleMode(event);
}

Fixed version (ground truth):
@EventHandler public void onInventoryClick(InventoryClickEvent event){
  if (!(event.getWhoClicked() instanceof Player))   return;
  Player p=(Player)event.getWhoClicked();
  if (p.getGameMode().equals(GameMode.CREATIVE) && event.getView().getType().equals(InventoryType.PLAYER))   return;
  if ((p.getGameMode().equals(GameMode.SURVIVAL) || p.getGameMode().equals(GameMode.ADVENTURE)) && event.getView().getType().equals(InventoryType.CRAFTING))   return;
  tNPC economyNpc=playerInteraction.get(p.getName());
  if (economyNpc == null)   return;
  if (economyNpc.locked()) {
    economyNpc.managerMode(event);
    return;
  }
  if (economyNpc instanceof Banker) {
    if (((Banker)economyNpc).getStatus().settings()) {
      economyNpc.settingsMode(event);
      return;
    }
  }
  economyNpc.simpleMode(event);
}