nus-yam/ex-repair huggingface dataset:
Program: 87424
Project: 87424
Buggy source:
@Override public List<AmendableWidget> findInjectionPoints(final AmendmentController amendmentController,final AmendableWidget root,final DocumentController documentController){
  final List<AmendableWidget> injectionPoints=new ArrayList<AmendableWidget>();
  final AmendableWidgetWalker.AmendableVisitor visitor=new AmendableWidgetWalker.AmendableVisitor(){
    public AmendableWidget found=null;
    @Override public boolean visit(    final AmendableWidget visited){
      if (visited != null) {
        if (amendmentController.getAmendment().getSourceReference().getElement().equalsIgnoreCase(visited.getId())) {
          injectionPoints.add(visited);
        }
      }
      return true;
    }
    public AmendableWidget getFound(){
      return found;
    }
  }
;
  documentController.walk(root,visitor);
  return injectionPoints;
}

Fixed version (ground truth):
@Override public List<AmendableWidget> findInjectionPoints(final AmendmentController amendmentController,final AmendableWidget root,final DocumentController documentController){
  final List<AmendableWidget> injectionPoints=new ArrayList<AmendableWidget>();
  final String path=amendmentController.getAmendment().getSourceReference().getPath();
  final AmendableWidgetWalker.AmendableVisitor visitor;
  if (path.startsWith("String_Node_Str")) {
    visitor=new AmendableWidgetWalker.AmendableVisitor(){
      @Override public boolean visit(      final AmendableWidget visited){
        if (visited != null) {
          if (path.substring(1).equalsIgnoreCase(visited.getId())) {
            injectionPoints.add(visited);
          }
        }
        return true;
      }
    }
;
  }
 else   if (path.startsWith("String_Node_Str")) {
    final String[] parts=path.substring(2).split("String_Node_Str");
    final Counter tracker=new Counter(0);
    visitor=new AmendableWidgetWalker.AmendableVisitor(){
      @Override public boolean visit(      final AmendableWidget visited){
        if (visited != null && tracker.get() < parts.length) {
          final String part=parts[tracker.get()];
          final String partType=part.substring(0,part.indexOf("String_Node_Str"));
          if (visited.getType().equalsIgnoreCase(partType)) {
            final int typeIndex=Integer.parseInt(part.substring(part.indexOf("String_Node_Str") + 1,part.length() - 1));
            if (typeIndex == visited.getTypeIndex()) {
              tracker.increment();
            }
            if (tracker.get() == parts.length) {
              injectionPoints.add(visited);
              return false;
            }
          }
        }
        return true;
      }
    }
;
  }
 else {
    visitor=new AmendableWidgetWalker.AmendableVisitor(){
      @Override public boolean visit(      final AmendableWidget visited){
        if (visited != null) {
          if (path.equalsIgnoreCase(visited.getId())) {
            injectionPoints.add(visited);
          }
        }
        return true;
      }
    }
;
  }
  documentController.walk(root,visitor);
  return injectionPoints;
}
Program: 87425
Project: 87425
Buggy source:
@Override public boolean visit(final AmendableWidget visited){
  if (visited != null) {
    if (amendmentController.getAmendment().getSourceReference().getElement().equalsIgnoreCase(visited.getId())) {
      injectionPoints.add(visited);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visit(final AmendableWidget visited){
  if (visited != null) {
    if (path.equalsIgnoreCase(visited.getId())) {
      injectionPoints.add(visited);
    }
  }
  return true;
}
Program: 87426
Project: 87426
Buggy source:
@Override public AmendableWidget provideInjectionPoint(AmendmentController amendmentController,AmendableWidget root,DocumentController documentController){
  final AmendableWidgetReference reference=amendmentController.getAmendment().getSourceReference();
  if (reference.isCreation()) {
    final AmendableWidget child=documentController.getOverlayFactory().getAmendableWidget(reference.getType());
    child.setOrigin(AmendableWidgetOrigin.AMENDMENT);
    if (reference.isSibling()) {
      final AmendableWidget grandParent=root.getParentAmendableWidget();
      com.google.gwt.user.client.Element parentElement=grandParent.getAmendableElement().cast();
      com.google.gwt.user.client.Element childElement=child.getAmendableElement().cast();
      DOM.insertChild(parentElement,childElement,grandParent.getChildAmendableWidgets().indexOf(root));
      grandParent.addAmendableWidget(child);
    }
 else {
      if (!root.getChildAmendableWidgets().isEmpty() && root.getChildAmendableWidgets().size() > reference.getOffset()) {
        if (root.getChildAmendableWidgets().get(reference.getOffset()).getOrigin() == AmendableWidgetOrigin.AMENDMENT) {
          return root.getChildAmendableWidgets().get(reference.getOffset());
        }
      }
      com.google.gwt.user.client.Element parentElement=root.getAmendableElement().cast();
      com.google.gwt.user.client.Element childElement=child.getAmendableElement().cast();
      DOM.appendChild(parentElement,childElement);
      root.addAmendableWidget(child);
    }
    return child;
  }
 else {
    return root;
  }
}

Fixed version (ground truth):
@Override public AmendableWidget provideInjectionPoint(AmendmentController amendmentController,AmendableWidget root,DocumentController documentController){
  final AmendableWidgetReference reference=amendmentController.getAmendment().getSourceReference();
  if (reference.isCreation()) {
    final AmendableWidget child=documentController.getOverlayFactory().getAmendableWidget(reference.getType());
    child.setOrigin(AmendableWidgetOrigin.AMENDMENT);
    if (!root.getChildAmendableWidgets().isEmpty() && root.getChildAmendableWidgets().size() > reference.getOffset()) {
      if (root.getChildAmendableWidgets().get(reference.getOffset()).getOrigin() == AmendableWidgetOrigin.AMENDMENT) {
        return root.getChildAmendableWidgets().get(reference.getOffset());
      }
    }
    com.google.gwt.user.client.Element parentElement=root.getAmendableElement().cast();
    com.google.gwt.user.client.Element childElement=child.getAmendableElement().cast();
    root.addAmendableWidget(child,reference.getOffset(),true);
    DOM.insertChild(parentElement,childElement,root.getChildAmendableWidgets().indexOf(child));
    LOG.info("String_Node_Str" + child + "String_Node_Str"+ root+ "String_Node_Str"+ reference.getOffset());
    return child;
  }
 else {
    LOG.info("String_Node_Str" + root);
    return root;
  }
}
Program: 87427
Project: 87427
Buggy source:
public static Integer getAssignedNumber(final AmendableWidget amendableWidget){
  if (amendableWidget.getParentAmendableWidget() != null) {
    final Iterator<AmendableWidget> iterator=amendableWidget.getParentAmendableWidget().getChildAmendableWidgets().iterator();
    int count=0;
    while (iterator.hasNext()) {
      final AmendableWidget aw=iterator.next();
      if (aw != null) {
        if (aw.getType().equalsIgnoreCase(amendableWidget.getType())) {
          count++;
        }
        if (aw == amendableWidget) {
          break;
        }
      }
    }
    return count;
  }
  return null;
}

Fixed version (ground truth):
public static Integer getAssignedNumber(final AmendableWidget amendableWidget){
  if (amendableWidget.getParentAmendableWidget() != null) {
    return amendableWidget.getTypeIndex() + 1;
  }
  return null;
}
Program: 87428
Project: 87428
Buggy source:
/** 
 * Add an amendable widget as a child, but do not perform a runtime validation check.
 * @param child             the child to add
 * @param skipValidation    <tt>true</tt> to skip validation.
 */
void addAmendableWidget(AmendableWidget child,boolean skipValidation);

Fixed version (ground truth):
/** 
 * Add an amendable widget as a child at position <tt>index</tt>, but do not perform a runtime validation check.
 * @param child          the child to add
 * @param index          the position to insert the widget at (-1 means it will be added at the end)
 * @param skipValidation <tt>true</tt> to skip validation.
 */
void addAmendableWidget(AmendableWidget child,int index,boolean skipValidation);
Program: 87429
Project: 87429
Buggy source:
public static Integer getAssignedNumber(final AmendableWidget amendableWidget){
  if (amendableWidget.getParentAmendableWidget() != null) {
    final Iterator<AmendableWidget> iterator=amendableWidget.getParentAmendableWidget().getChildAmendableWidgets().iterator();
    int count=1;
    while (iterator.hasNext()) {
      AmendableWidget aw=iterator.next();
      if (aw != null) {
        if (aw.getType().equalsIgnoreCase(amendableWidget.getType())) {
          count++;
        }
        if (aw == amendableWidget) {
          break;
        }
      }
    }
    return count;
  }
  return null;
}

Fixed version (ground truth):
public static Integer getAssignedNumber(final AmendableWidget amendableWidget){
  if (amendableWidget.getParentAmendableWidget() != null) {
    final Iterator<AmendableWidget> iterator=amendableWidget.getParentAmendableWidget().getChildAmendableWidgets().iterator();
    int count=0;
    while (iterator.hasNext()) {
      final AmendableWidget aw=iterator.next();
      if (aw != null) {
        if (aw.getType().equalsIgnoreCase(amendableWidget.getType())) {
          count++;
        }
        if (aw == amendableWidget) {
          break;
        }
      }
    }
    return count;
  }
  return null;
}
Program: 87430
Project: 87430
Buggy source:
@Override public boolean process(OverlayClass overlayClass){
  final CssOverlayStyle overlayStyle=new CssOverlayStyle(overlayClass);
  try {
    Map<String,Object> rootMap=new HashMap<String,Object>();
    rootMap.put("String_Node_Str",overlayClass);
    rootMap.put("String_Node_Str",CssOverlayStyle.CssOverlayFactory.getInstance());
    rootMap.put("String_Node_Str",styles);
    final Template template=configuration.getTemplate(templateName);
    final DefaultObjectWrapper wrapper=new DefaultObjectWrapper();
    template.process(rootMap,out,wrapper);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  TemplateException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean process(OverlayClass overlayClass){
  try {
    Map<String,Object> rootMap=new HashMap<String,Object>();
    rootMap.put("String_Node_Str",overlayClass);
    rootMap.put("String_Node_Str",CssOverlayStyle.CssOverlayFactory.getInstance());
    rootMap.put("String_Node_Str",styles);
    final Template template=configuration.getTemplate(templateName);
    final DefaultObjectWrapper wrapper=new DefaultObjectWrapper();
    template.process(rootMap,out,wrapper);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  TemplateException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  return true;
}
Program: 87431
Project: 87431
Buggy source:
public static String capitalize(String input){
}

Fixed version (ground truth):
public static String capitalize(String input){
  if (input != null) {
    if ("String_Node_Str".equals(input.trim()))     return input;
    return input.substring(0,1).toUpperCase() + input.substring(1);
  }
  return null;
}
Program: 87432
Project: 87432
Buggy source:
@Override public void onBrowserEvent(final Event event){
  event.stopPropagation();
  if (UIListener != null) {
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
      UIListener.onClick(this);
    break;
case Event.ONDBLCLICK:
  UIListener.onDblClick(this);
break;
case Event.ONMOUSEMOVE:
UIListener.onMouseOver(this);
break;
case Event.ONMOUSEOUT:
UIListener.onMouseOut(this);
break;
}
}
}

Fixed version (ground truth):
@Override public void onBrowserEvent(final Event event){
  event.stopPropagation();
  if (UIListener != null) {
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
      UIListener.onClick(this);
    break;
case Event.ONDBLCLICK:
  UIListener.onDblClick(this);
break;
case Event.ONMOUSEMOVE:
UIListener.onMouseOver(this);
break;
case Event.ONMOUSEOUT:
UIListener.onMouseOut(this);
break;
default :
throw new UnsupportedOperationException("String_Node_Str");
}
}
}
Program: 87433
Project: 87433
Buggy source:
@Override public Element[] getChildren(Element element){
  return new Element[0];
}

Fixed version (ground truth):
@Override public Element[] getChildren(Element element){
  return new Element[]{};
}
Program: 87434
Project: 87434
Buggy source:
@Override public Boolean isImmutable(Element element){
  return null;
}

Fixed version (ground truth):
@Override public Boolean isImmutable(Element element){
  return false;
}
Program: 87435
Project: 87435
Buggy source:
private static boolean isLetter(char c){
  if (Arrays.binarySearch(Alphabet.GREEK_NUMBERING,c) != -1)   return true;
  if (Arrays.binarySearch(Alphabet.CYRILLIC_NUMBERING,c) != -1)   return true;
  return Character.isLetter(c);
}

Fixed version (ground truth):
private static boolean isLetter(char c){
  if (Arrays.binarySearch(Alphabet.getGreekNumbering(),c) != -1)   return true;
  if (Arrays.binarySearch(Alphabet.getCyrillicNumbering(),c) != -1)   return true;
  return Character.isLetter(c);
}
Program: 87436
Project: 87436
Buggy source:
public String[] getDocumentIDs(){
  return documentIDs;
}

Fixed version (ground truth):
public String[] getDocumentIDs(){
  return documentIDs != null ? Arrays.asList(documentIDs).toArray(new String[documentIDs.length]) : null;
}
Program: 87437
Project: 87437
Buggy source:
public HashMap<String,String[]> getParameters(){
  return parameters;
}

Fixed version (ground truth):
public HashMap<String,String[]> getParameters(){
  return parameters != null ? new HashMap<String,String[]>(parameters) : null;
}
Program: 87438
Project: 87438
Buggy source:
public String[] getRoles(){
  return roles;
}

Fixed version (ground truth):
public String[] getRoles(){
  return roles != null ? Arrays.asList(roles).toArray(new String[roles.length]) : null;
}
Program: 87439
Project: 87439
Buggy source:
public Date getDeadline(){
  return deadline;
}

Fixed version (ground truth):
public Date getDeadline(){
  return deadline != null ? new Date(deadline.getTime()) : null;
}
Program: 87440
Project: 87440
Buggy source:
@Override public String getType(){
  return amendableElement.getTagName();
}

Fixed version (ground truth):
@Override public String getType(){
  return amendableElement.getNodeName();
}
Program: 87441
Project: 87441
Buggy source:
@Inject public AmendmentManager(final ClientFactory clientFactory){
  this.clientFactory=clientFactory;
}

Fixed version (ground truth):
@Inject public AmendmentManager(final ClientFactory clientFactory){
  this.clientFactory=clientFactory;
  Log.info("String_Node_Str");
}
Program: 87442
Project: 87442
Buggy source:
private AmendmentController createAmendmentController(final AmendmentContainerDTO amendment){
  AmendmentController amendmentController=new AmendmentController(clientFactory,new AmendmentViewImpl());
  amendmentController.setAmendment(amendment);
  return amendmentController;
}

Fixed version (ground truth):
private AmendmentController createAmendmentController(final AmendmentContainerDTO amendment){
  AmendmentController amendmentController=injector.getAmendmentController();
  amendmentController.setAmendment(amendment);
  return amendmentController;
}
Program: 87443
Project: 87443
Buggy source:
public void setAmendment(AmendmentContainerDTO amendment){
  this.amendment=amendment;
}

Fixed version (ground truth):
public void setAmendment(AmendmentContainerDTO amendment){
  this.amendment=amendment;
  setJustification("String_Node_Str" + amendment.getAmendmentContainerID());
  setTitle("String_Node_Str" + amendment.getAmendmentContainerID());
}
Program: 87444
Project: 87444
Buggy source:
@Inject public AmendmentController(final ClientFactory clientFactory,final AmendmentView view){
  this.clientFactory=clientFactory;
  this.view=view;
  registerListeners();
}

Fixed version (ground truth):
@Inject public AmendmentController(final ClientFactory clientFactory){
  this.clientFactory=clientFactory;
  this.view=amendmentInjector.getAmendmentView();
  this.amendmentEventBus=amendmentInjector.getAmendmentEventBus();
  registerListeners();
}
Program: 87445
Project: 87445
Buggy source:
@Override public void configure(GinBinder binder){
  binder.bind(ClientContext.class).toProvider(DefaultClientContextProvider.class).in(Singleton.class);
  binder.bind(Scheduler.class).toProvider(DefaultSchedulerProvider.class).in(Singleton.class);
  binder.bind(EventBus.class).toProvider(DefaultEventBusProvider.class).in(Singleton.class);
  binder.bind(PlaceController.class).toProvider(DefaultPlaceControllerProvider.class).in(Singleton.class);
}

Fixed version (ground truth):
@Override public void configure(GinBinder binder){
  binder.bind(ClientFactory.class).to(ClientFactoryImpl.class).in(Singleton.class);
  binder.bind(ClientContext.class).toProvider(DefaultClientContextProvider.class).in(Singleton.class);
  binder.bind(Scheduler.class).toProvider(DefaultSchedulerProvider.class).in(Singleton.class);
  binder.bind(EventBus.class).toProvider(DefaultEventBusProvider.class).in(Singleton.class);
  binder.bind(PlaceController.class).toProvider(DefaultPlaceControllerProvider.class).in(Singleton.class);
}
Program: 87446
Project: 87446
Buggy source:
public AuthenticatedEvent(String principal){
  this.principal=principal;
}

Fixed version (ground truth):
public AuthenticatedEvent(ClientContext clientContext){
  this.clientContext=clientContext;
}
Program: 87448
Project: 87448
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: 87449
Project: 87449
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: 87450
Project: 87450
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: 87452
Project: 87452
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: 87454
Project: 87454
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: 87455
Project: 87455
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: 87456
Project: 87456
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: 87457
Project: 87457
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: 87458
Project: 87458
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: 87459
Project: 87459
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: 87460
Project: 87460
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: 87462
Project: 87462
Buggy source:
public void renderDepartures(TextView tv,Activity activity,Long currentTime){
  if (_cachednextDepartures == nextDepartures.size()) {
    if (expectedDeparture - System.currentTimeMillis() > (HelperFunctions.MINUTE * 9)) {
      tv.setText(_cachedSpanned);
      return;
    }
    if (_lastCacheUpdated != 0 && (System.currentTimeMillis() - _lastCacheUpdated) < (CACHE_INVALIDATETIME)) {
      tv.setText(_cachedSpanned);
      return;
    }
  }
  StringBuffer content=new StringBuffer("String_Node_Str");
  renderToContainer(content,activity,currentTime);
  for (  RealtimeDataGeneric nextDeparture : nextDepartures) {
    nextDeparture.renderToContainer(content,activity,currentTime);
  }
  _cachedSpanned=Html.fromHtml(content.toString(),new ImageGetter(activity),null);
  _cachednextDepartures=nextDepartures.size();
  tv.setText(_cachedSpanned);
  _lastCacheUpdated=System.currentTimeMillis();
}

Fixed version (ground truth):
public void renderDepartures(TextView tv,Activity activity,Long currentTime){
  if (_lastCacheUpdated != 0 && _cachednextDepartures == nextDepartures.size()) {
    if (expectedDeparture - System.currentTimeMillis() > (HelperFunctions.MINUTE * 9)) {
      tv.setText(_cachedSpanned);
      return;
    }
    if ((System.currentTimeMillis() - _lastCacheUpdated) < (CACHE_INVALIDATETIME)) {
      tv.setText(_cachedSpanned);
      return;
    }
  }
  StringBuffer content=new StringBuffer("String_Node_Str");
  renderToContainer(content,activity,currentTime);
  for (  RealtimeDataGeneric nextDeparture : nextDepartures) {
    nextDeparture.renderToContainer(content,activity,currentTime);
  }
  _cachedSpanned=Html.fromHtml(content.toString(),new ImageGetter(activity),null);
  _cachednextDepartures=nextDepartures.size();
  tv.setText(_cachedSpanned);
  _lastCacheUpdated=System.currentTimeMillis();
}
Program: 87463
Project: 87463
Buggy source:
public static void renderTime(final StringBuffer txt,Long currentTime,Context context,long time){
  int diffMinutes=Math.round(((float)(time - currentTime)) / MINUTE);
  if (diffMinutes < -1) {
    diffMinutes=diffMinutes * -1;
    txt.append("String_Node_Str");
    txt.append(diffMinutes);
    txt.append("String_Node_Str");
  }
 else   if (diffMinutes < 1) {
    if (nowText == null) {
      nowText=context.getText(R.string.now);
    }
    txt.append(nowText);
  }
 else   if (diffMinutes <= 9) {
    txt.append(diffMinutes);
    txt.append("String_Node_Str");
  }
  txt.append(hourFormater.format(time));
}

Fixed version (ground truth):
public static void renderTime(final StringBuffer txt,Long currentTime,Context context,long time){
  int diffMinutes=Math.round(((float)(time - currentTime)) / MINUTE);
  if (diffMinutes < -1) {
    diffMinutes=diffMinutes * -1;
    txt.append("String_Node_Str");
    txt.append(diffMinutes);
    txt.append("String_Node_Str");
    return;
  }
 else   if (diffMinutes < 1) {
    if (nowText == null) {
      nowText=context.getText(R.string.now);
    }
    txt.append(nowText);
    return;
  }
 else   if (diffMinutes <= 9) {
    txt.append(diffMinutes);
    txt.append("String_Node_Str");
    return;
  }
  txt.append(hourFormater.format(time));
}
Program: 87467
Project: 87467
Buggy source:
@Override public void onPreExecute(){
  try {
    tracker.dispatch();
  }
 catch (  Exception e) {
  }
  setProgressBarIndeterminateVisibility(true);
}

Fixed version (ground truth):
@Override public void onPreExecute(){
  setProgressBarIndeterminateVisibility(true);
}
Program: 87468
Project: 87468
Buggy source:
private void load(){
  if (routeProvider != null)   routeProvider.kill();
  routeList.getList().clear();
  routeList.notifyDataSetChanged();
  tracker.trackEvent("String_Node_Str","String_Node_Str","String_Node_Str",0);
  routeProvider=new TrafikantenRoute(this,routeSearch,new IGenericProviderHandler<RouteProposal>(){
    @Override public void onExtra(    int what,    Object obj){
    }
    @Override public void onData(    RouteProposal data){
      routeList.addItem(data);
      routeList.notifyDataSetChanged();
      infoText.setVisibility(routeList.getCount() > 0 ? View.GONE : View.VISIBLE);
    }
    @Override public void onPostExecute(    Exception exception){
      setProgressBarIndeterminateVisibility(false);
      routeProvider=null;
      if (exception != null) {
        routeList.getList().clear();
        routeList.notifyDataSetChanged();
        Log.w(TAG,"String_Node_Str" + exception);
        infoText.setVisibility(View.VISIBLE);
        if (exception.getClass().getSimpleName().equals("String_Node_Str")) {
          infoText.setText(R.string.trafikantenErrorParse);
        }
 else {
          infoText.setText(R.string.trafikantenErrorOther);
        }
        setProgressBarIndeterminateVisibility(false);
      }
 else {
        infoText.setText(R.string.noRoutesFound);
      }
      loadDevi();
    }
    @Override public void onPreExecute(){
      try {
        tracker.dispatch();
      }
 catch (      Exception e) {
      }
      setProgressBarIndeterminateVisibility(true);
    }
  }
);
}

Fixed version (ground truth):
private void load(){
  if (routeProvider != null)   routeProvider.kill();
  routeList.getList().clear();
  routeList.notifyDataSetChanged();
  tracker.trackEvent("String_Node_Str","String_Node_Str","String_Node_Str",0);
  try {
    tracker.dispatch();
  }
 catch (  Exception e) {
  }
  routeProvider=new TrafikantenRoute(this,routeSearch,new IGenericProviderHandler<RouteProposal>(){
    @Override public void onExtra(    int what,    Object obj){
    }
    @Override public void onData(    RouteProposal data){
      routeList.addItem(data);
      routeList.notifyDataSetChanged();
      infoText.setVisibility(routeList.getCount() > 0 ? View.GONE : View.VISIBLE);
    }
    @Override public void onPostExecute(    Exception exception){
      setProgressBarIndeterminateVisibility(false);
      routeProvider=null;
      if (exception != null) {
        routeList.getList().clear();
        routeList.notifyDataSetChanged();
        Log.w(TAG,"String_Node_Str" + exception);
        infoText.setVisibility(View.VISIBLE);
        if (exception.getClass().getSimpleName().equals("String_Node_Str")) {
          infoText.setText(R.string.trafikantenErrorParse);
        }
 else {
          infoText.setText(R.string.trafikantenErrorOther);
        }
        setProgressBarIndeterminateVisibility(false);
      }
 else {
        infoText.setText(R.string.noRoutesFound);
      }
      loadDevi();
    }
    @Override public void onPreExecute(){
      setProgressBarIndeterminateVisibility(true);
    }
  }
);
}
Program: 87469
Project: 87469
Buggy source:
private void loadDevi(){
  routeDeviLoader=new RouteDeviLoader(this,deviList,new IGenericProviderHandler<Void>(){
    @Override public void onData(    Void data){
    }
    @Override public void onExtra(    int i,    Object data){
    }
    @Override public void onPostExecute(    Exception e){
      Toast.makeText(DetailedRouteView.this,R.string.trafikantenErrorOther,Toast.LENGTH_SHORT).show();
      routeDeviLoader=null;
      routeList.notifyDataSetChanged();
      loadDevi();
    }
    @Override public void onPreExecute(){
    }
  }
);
  if (routeDeviLoader.load(routeProposalList.get(proposalPosition))) {
    setProgressBarIndeterminateVisibility(true);
  }
 else {
    setProgressBarIndeterminateVisibility(false);
  }
}

Fixed version (ground truth):
private void loadDevi(){
  routeDeviLoader=new RouteDeviLoader(this,deviList,new IGenericProviderHandler<Void>(){
    @Override public void onData(    Void data){
    }
    @Override public void onExtra(    int i,    Object data){
    }
    @Override public void onPostExecute(    Exception e){
      Log.e(TAG,"String_Node_Str" + e);
      Toast.makeText(DetailedRouteView.this,R.string.trafikantenErrorOther,Toast.LENGTH_SHORT).show();
      routeDeviLoader=null;
      routeList.notifyDataSetChanged();
      loadDevi();
    }
    @Override public void onPreExecute(){
    }
  }
);
  if (routeDeviLoader.load(routeProposalList.get(proposalPosition))) {
    setProgressBarIndeterminateVisibility(true);
  }
 else {
    setProgressBarIndeterminateVisibility(false);
  }
}
Program: 87471
Project: 87471
Buggy source:
@Override public void onData(RealtimeData item){
  if (item.line.equals(searchLine) && item.destination.equals(destination)) {
    if (routeData.realtimeData == null) {
      routeData.realtimeData=item;
      routeList.notifyDataSetChanged();
    }
 else {
      routeData.realtimeData.addDeparture(item.expectedDeparture,item.realtime,item.stopVisitNote);
      routeList.notifyDataSetChanged();
    }
  }
}

Fixed version (ground truth):
@Override public void onData(RealtimeData item){
  if (item.line.equals(searchLine) && item.destination.equals(searchDestination)) {
    if (routeData.realtimeData == null) {
      routeData.realtimeData=item;
      routeList.notifyDataSetChanged();
    }
 else {
      routeData.realtimeData.addDeparture(item.expectedDeparture,item.realtime,item.stopVisitNote);
      routeList.notifyDataSetChanged();
    }
  }
}
Program: 87472
Project: 87472
Buggy source:
private void loadRouteData(){
  if (routeList.size() == 0) {
    RouteOverlay routeOverlay=new RouteOverlay(iconMapMarker,stationOverlay.items);
    final List<Overlay> overlays=mapView.getOverlays();
    stationOverlay.doPopulate();
    overlays.add(routeOverlay);
    overlays.add(stationOverlay);
    setProgress(10000);
    mapView.invalidate();
    return;
  }
  final RouteData routeData=routeList.get(0);
  routeList.remove(0);
  setProgress((routeLength - routeList.size() + 1) * 10000 / routeLength);
  if (routeData.tourID == 0) {
    stationOverlay.add(GenericMap.this,routeData.fromStation);
    stationOverlay.add(GenericMap.this,routeData.toStation);
    loadRouteData();
    return;
  }
  tracker.trackPageView("String_Node_Str");
  tripProvider=new TrafikantenTrip(this,routeData.tourID,routeData.fromStation.stationId,routeData.toStation.stationId,new IGenericProviderHandler<StationData>(){
    @Override public void onData(    StationData data){
      stationOverlay.add(GenericMap.this,data);
    }
    @Override public void onExtra(    int i,    Object data){
    }
    @Override public void onPostExecute(    Exception exception){
      tripProvider=null;
      if (exception != null) {
        Log.w(TAG,"String_Node_Str" + exception);
        Toast.makeText(GenericMap.this,getText(R.string.trafikantenErrorOther),Toast.LENGTH_SHORT).show();
        setProgress(10000);
      }
 else {
        loadRouteData();
      }
    }
    @Override public void onPreExecute(){
    }
  }
);
}

Fixed version (ground truth):
private void loadRouteData(){
  if (routeList.size() == 0) {
    RouteOverlay routeOverlay=new RouteOverlay(iconMapMarker,stationOverlay.items);
    final List<Overlay> overlays=mapView.getOverlays();
    overlays.add(routeOverlay);
    overlays.add(stationOverlay);
    setProgress(10000);
    mapView.invalidate();
    return;
  }
  final RouteData routeData=routeList.get(0);
  routeList.remove(0);
  setProgress((routeLength - routeList.size() + 1) * 10000 / routeLength);
  if (routeData.tourID == 0) {
    stationOverlay.add(GenericMap.this,routeData.fromStation,false);
    stationOverlay.add(GenericMap.this,routeData.toStation,true);
    loadRouteData();
    return;
  }
  tracker.trackPageView("String_Node_Str");
  tripProvider=new TrafikantenTrip(this,routeData.tourID,routeData.fromStation.stationId,routeData.toStation.stationId,new IGenericProviderHandler<StationData>(){
    @Override public void onData(    StationData data){
      stationOverlay.add(GenericMap.this,data,true);
    }
    @Override public void onExtra(    int i,    Object data){
    }
    @Override public void onPostExecute(    Exception exception){
      tripProvider=null;
      if (exception != null) {
        Log.w(TAG,"String_Node_Str" + exception);
        Toast.makeText(GenericMap.this,getText(R.string.trafikantenErrorOther),Toast.LENGTH_SHORT).show();
        setProgress(10000);
      }
 else {
        loadRouteData();
      }
    }
    @Override public void onPreExecute(){
    }
  }
);
}
Program: 87473
Project: 87473
Buggy source:
@Override public void onData(StationData data){
  stationOverlay.add(GenericMap.this,data);
}

Fixed version (ground truth):
@Override public void onData(StationData data){
  stationOverlay.add(GenericMap.this,data,true);
}
Program: 87474
Project: 87474
Buggy source:
public void add(Activity activity,ArrayList<StationData> stationList){
  for (  StationData station : stationList) {
    add(activity,station);
  }
  populate();
}

Fixed version (ground truth):
public void add(Activity activity,ArrayList<StationData> stationList){
  for (  StationData station : stationList) {
    add(activity,station,false);
  }
  populate();
}
Program: 87476
Project: 87476
Buggy source:
@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.add(0,MAP_ID,0,R.string.map);
  final AdapterView.AdapterContextMenuInfo info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  if (routeList.getDevi(info.position,true).size() > 0) {
    menu.add(0,DEVI_ID,0,R.string.warnings);
  }
  menu.add(0,NOTIFY_ID,0,R.string.alarm);
}

Fixed version (ground truth):
@Override public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){
  super.onCreateContextMenu(menu,v,menuInfo);
  menu.add(0,MAP_ID,0,R.string.map);
  if (routeList.getDevi(((AdapterView.AdapterContextMenuInfo)menuInfo).position,true).size() > 0) {
    menu.add(0,DEVI_ID,0,R.string.warnings);
  }
  menu.add(0,NOTIFY_ID,0,R.string.alarm);
}
Program: 87478
Project: 87478
Buggy source:
@Override protected void onListItemClick(ListView l,View v,int position,long id){
  StationData station=(StationData)stationListAdapter.getItem(position);
  stationSelected(station);
}

Fixed version (ground truth):
@Override protected void onListItemClick(ListView l,View v,int position,long id){
  final StationData station=(StationData)stationListAdapter.getItem(position);
  stationSelected(station);
}
Program: 87479
Project: 87479
Buggy source:
private void refreshMultiSelect(){
  int layout=multiSelect == MULTISELECT_ENABLED ? R.layout.selectstation_list_multiselect : R.layout.selectstation_list;
  setAdapterLayout(layout);
}

Fixed version (ground truth):
private void refreshMultiSelect(){
  int layout=multiSelect == MULTISELECT_ENABLED ? R.layout.selectstation_list_multiselect : R.layout.selectstation_list;
  selectedStations.clear();
  setAdapterLayout(layout);
}