nus-yam/ex-repair huggingface dataset:
Program: 117724
Project: 117724
Buggy source:
@Override public void keyReleased(java.awt.event.KeyEvent evt){
  if (evt.getKeyChar() == KeyEvent.VK_ENTER)   doSearch();
}

Fixed version (ground truth):
@Override public void keyReleased(java.awt.event.KeyEvent evt){
  if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
    doSearch();
  }
}
Program: 117725
Project: 117725
Buggy source:
/** 
 * Creates new form SimilarityPanel
 */
public SimilarityPanel(){
  initComponents();
  message=new SimpleLabel();
  message.setHorizontalAlignment(SimpleLabel.CENTER);
  message.setIcon(UIBox.getIcon("String_Node_Str"));
  similarityTextField.setPreferredSize(new Dimension(200,26));
  similarityThresholdSlider.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  similarityTypeComboBox.removeAllItems();
  similarityTypeComboBox.setEditable(false);
  for (int i=0; i < similarityTypes.length; i++) {
    similarityTypeComboBox.addItem(similarityTypes[i].e1);
  }
  similarityTokenizerComboBox.removeAllItems();
  similarityTokenizerComboBox.setEditable(false);
  for (int i=0; i < similarityTokenizers.length; i++) {
    similarityTokenizerComboBox.addItem(similarityTokenizers[i].e1);
  }
  updateSimilarityOptions();
}

Fixed version (ground truth):
/** 
 * Creates new form SimilarityPanel
 */
public SimilarityPanel(){
  initComponents();
  message=new SimpleLabel();
  message.setHorizontalAlignment(SimpleLabel.CENTER);
  message.setIcon(UIBox.getIcon("String_Node_Str"));
  similarityTextField.setPreferredSize(new Dimension(200,26));
  similarityThresholdSlider.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  similarityTypeComboBox.removeAllItems();
  similarityTypeComboBox.setEditable(false);
  for (int i=0; i < similarityTypes.length; i++) {
    similarityTypeComboBox.addItem(similarityTypes[i].e1);
  }
  similarityTokenizerComboBox.removeAllItems();
  similarityTokenizerComboBox.setEditable(false);
  for (int i=0; i < similarityTokenizers.length; i++) {
    similarityTokenizerComboBox.addItem(similarityTokenizers[i].e1);
  }
  updateSimilarityOptions();
  similarityTextField.addKeyListener(new java.awt.event.KeyAdapter(){
    @Override public void keyReleased(    java.awt.event.KeyEvent evt){
      if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
        doSearch();
      }
    }
  }
);
}
Program: 117726
Project: 117726
Buggy source:
private void searchButtonActionPerformed(java.awt.event.ActionEvent evt){
  try {
    resultPanel.removeAll();
    Wandora wandora=Wandora.getWandora();
    TopicMap topicMap=wandora.getTopicMap();
    Collection<Topic> results=getSimilarTopics(topicMap);
    if (results != null && !results.isEmpty()) {
      resultsTable=new TopicTable(wandora);
      resultsTable.initialize(results);
      resultPanel.add(resultsTable,BorderLayout.NORTH);
    }
 else {
      resultsTable=null;
      message.setText("String_Node_Str");
      resultPanel.add(message,BorderLayout.CENTER);
    }
  }
 catch (  TopicMapException tme) {
    message.setText("String_Node_Str");
    resultPanel.add(message,BorderLayout.CENTER);
    tme.printStackTrace();
  }
catch (  Exception e) {
    message.setText("String_Node_Str");
    resultPanel.add(message,BorderLayout.CENTER);
    e.printStackTrace();
    return;
  }
  revalidate();
  repaint();
}

Fixed version (ground truth):
private void searchButtonActionPerformed(java.awt.event.ActionEvent evt){
  doSearch();
}
Program: 117730
Project: 117730
Buggy source:
@Override public void init(){
  wandora=Wandora.getWandora();
  infoPanel=new JPanel();
  infoPanel.setLayout(new GridBagLayout());
  fieldLabels=new HashMap();
  initInfo();
}

Fixed version (ground truth):
@Override public void init(){
  wandora=Wandora.getWandora();
  infoPanel=new JPanel();
  infoPanel.setLayout(new GridBagLayout());
  fieldLabels=new HashMap();
  initInfo();
  refresher=new Thread(this);
  refresher.start();
}
Program: 117732
Project: 117732
Buggy source:
@Override public void refresh() throws TopicMapException {
  if (infoPanel != null) {
    refreshInfo();
    infoPanel.revalidate();
    infoPanel.repaint();
  }
}

Fixed version (ground truth):
@Override public void refresh() throws TopicMapException {
  if (infoPanel != null) {
    requiresRefresh=true;
  }
}
Program: 117733
Project: 117733
Buggy source:
@Override public void stop(){
}

Fixed version (ground truth):
@Override public void stop(){
  refresher.interrupt();
}
Program: 117734
Project: 117734
Buggy source:
@Override public Object[] getViewMenuStruct(){
  return new Object[]{"String_Node_Str"};
}

Fixed version (ground truth):
@Override public Object[] getViewMenuStruct(){
  return new Object[]{};
}
Program: 117735
Project: 117735
Buggy source:
@Override public void init(){
  searchPanel=new SearchPanel();
  similarityPanel=new SimilarityPanel();
  queryPanel=new QueryPanel();
  tmqlPanel=new TMQLPanel();
  Wandora wandora=Wandora.getWandora();
  this.options=new Options(wandora.getOptions());
  initComponents();
  try {
    tabbedPane.addChangeListener(new ChangeListener(){
      @Override public void stateChanged(      ChangeEvent e){
        setCurrentPanel(tabbedPane.getSelectedComponent());
      }
    }
);
    setCurrentPanel(searchContainerPanel);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void init(){
  searchPanel=new SearchPanel();
  similarityPanel=new SimilarityPanel();
  queryPanel=new QueryPanel();
  tmqlPanel=new TMQLPanel();
  JScrollPane searchResultScrollPanel=searchPanel.getResultScrollPane();
  MouseWheelListener[] mouseWheelListeners=searchResultScrollPanel.getMouseWheelListeners();
  for (  MouseWheelListener listener : mouseWheelListeners) {
    searchResultScrollPanel.removeMouseWheelListener(listener);
  }
  Wandora wandora=Wandora.getWandora();
  this.options=new Options(wandora.getOptions());
  initComponents();
  try {
    tabbedPane.addChangeListener(new ChangeListener(){
      @Override public void stateChanged(      ChangeEvent e){
        setCurrentPanel(tabbedPane.getSelectedComponent());
      }
    }
);
    setCurrentPanel(searchContainerPanel);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 117736
Project: 117736
Buggy source:
public void topicRemoved(Topic t) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicRemoved(lt);
    }
  }
  removeTopicFromIndex(t.getOneSubjectIdentifier());
}

Fixed version (ground truth):
public void topicRemoved(Topic t) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicRemoved(lt);
    }
  }
  removeTopicFromIndex(t.getOneSubjectIdentifier());
}
Program: 117737
Project: 117737
Buggy source:
public void associationRemoved(Association a) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationRemoved(makeLayeredAssociation(a));
    }
  }
}

Fixed version (ground truth):
public void associationRemoved(Association a) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationRemoved(makeLayeredAssociation(a));
    }
  }
}
Program: 117738
Project: 117738
Buggy source:
public void topicDataChanged(Topic t,Topic type,Topic version,String newValue,String oldValue) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=makeLayeredTopic(t);
    LayeredTopic ltype=makeLayeredTopic(type);
    LayeredTopic lversion=makeLayeredTopic(version);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicDataChanged(lt,ltype,lversion,newValue,oldValue);
    }
  }
}

Fixed version (ground truth):
public void topicDataChanged(Topic t,Topic type,Topic version,String newValue,String oldValue) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=makeLayeredTopic(t);
    LayeredTopic ltype=makeLayeredTopic(type);
    LayeredTopic lversion=makeLayeredTopic(version);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicDataChanged(lt,ltype,lversion,newValue,oldValue);
    }
  }
}
Program: 117739
Project: 117739
Buggy source:
public void topicSubjectLocatorChanged(Topic t,Locator newLocator,Locator oldLocator) throws TopicMapException {
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicSubjectLocatorChanged(lt,newLocator,oldLocator);
    }
  }
}

Fixed version (ground truth):
public void topicSubjectLocatorChanged(Topic t,Locator newLocator,Locator oldLocator) throws TopicMapException {
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicSubjectLocatorChanged(lt,newLocator,oldLocator);
    }
  }
}
Program: 117740
Project: 117740
Buggy source:
/** 
 * Clears topicIndex.
 */
public void clearTopicIndex(){
  if (!useTopicIndex)   return;
synchronized (indexLock) {
    topicIndex=new HashMap<Locator,LayeredTopic>();
  }
}

Fixed version (ground truth):
/** 
 * Clears topicIndex.
 */
public void clearTopicIndex(){
  if (!useTopicIndex)   return;
synchronized (indexLock) {
    topicIndex=new LinkedHashMap<Locator,LayeredTopic>();
  }
}
Program: 117741
Project: 117741
Buggy source:
public Collection<Topic> search(String query,TopicMapSearchOptions options) throws TopicMapException {
  TopicMapSearchOptions options2=options.duplicate();
  options2.maxResults=-1;
  HashSet<Topic> searchResult=new HashSet<Topic>();
  HashSet<Topic> searchResultLayered=new HashSet<Topic>();
  Outer:   for (  Layer l : visibleLayers) {
    searchResult.clear();
    searchResult.addAll(l.getTopicMap().search(query,options2));
    for (    Topic t : searchResult) {
      searchResultLayered.add(this.getTopic(t.getOneSubjectIdentifier()));
      if (options.maxResults >= 0 && searchResultLayered.size() >= options.maxResults)       break Outer;
    }
  }
  return searchResultLayered;
}

Fixed version (ground truth):
public Collection<Topic> search(String query,TopicMapSearchOptions options) throws TopicMapException {
  TopicMapSearchOptions options2=options.duplicate();
  options2.maxResults=-1;
  HashSet<Topic> searchResult=new LinkedHashSet<Topic>();
  HashSet<Topic> searchResultLayered=new LinkedHashSet<Topic>();
  Outer:   for (  Layer l : visibleLayers) {
    searchResult.clear();
    searchResult.addAll(l.getTopicMap().search(query,options2));
    for (    Topic t : searchResult) {
      searchResultLayered.add(this.getTopic(t.getOneSubjectIdentifier()));
      if (options.maxResults >= 0 && searchResultLayered.size() >= options.maxResults)       break Outer;
    }
  }
  return searchResultLayered;
}
Program: 117742
Project: 117742
Buggy source:
/** 
 * Makes layered topics for all topics in the collection. Note that some topics in the collection may end up in the same layered topic and thus the returned collection may have less items than the collection used as the parameter.
 */
Collection<Topic> makeLayeredTopics(Collection<Topic> ts) throws TopicMapException {
  Vector<Topic> ret=new Vector<Topic>();
  Set<Topic> processed=new KeyedHashSet<Topic>(new TopicAndLayerKeyMaker());
  for (  Topic t : ts) {
    if (processed.contains(t))     continue;
    Set<Topic> collected=collectTopics(t);
    processed.addAll(collected);
    ret.add(new LayeredTopic(collected,this));
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Makes layered topics for all topics in the collection. Note that some topics in the collection may end up in the same layered topic and thus the returned collection may have less items than the collection used as the parameter.
 */
Collection<Topic> makeLayeredTopics(Collection<Topic> ts) throws TopicMapException {
  ArrayList<Topic> ret=new ArrayList<Topic>();
  Set<Topic> processed=new KeyedHashSet<Topic>(new TopicAndLayerKeyMaker());
  for (  Topic t : ts) {
    if (processed.contains(t))     continue;
    Set<Topic> collected=collectTopics(t);
    processed.addAll(collected);
    ret.add(new LayeredTopic(collected,this));
  }
  return ret;
}
Program: 117743
Project: 117743
Buggy source:
public void associationChanged(Association a) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    LayeredAssociation la=null;
    if (a instanceof LayeredAssociation && a.getTopicMap() == this)     la=(LayeredAssociation)a;
 else     la=makeLayeredAssociation(a);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationChanged(la);
    }
  }
}

Fixed version (ground truth):
public void associationChanged(Association a) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    LayeredAssociation la=null;
    if (a instanceof LayeredAssociation && a.getTopicMap() == this)     la=(LayeredAssociation)a;
 else     la=makeLayeredAssociation(a);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationChanged(la);
    }
  }
}
Program: 117744
Project: 117744
Buggy source:
public Topic getTopicWithBaseName(String name) throws TopicMapException {
  HashSet<Topic> collected=new HashSet<Topic>();
  for (  Layer l : visibleLayers) {
    Topic t=l.getTopicMap().getTopicWithBaseName(name);
    if (t != null)     return makeLayeredTopic(t);
  }
  return null;
}

Fixed version (ground truth):
public Topic getTopicWithBaseName(String name) throws TopicMapException {
  HashSet<Topic> collected=new LinkedHashSet<Topic>();
  for (  Layer l : visibleLayers) {
    Topic t=l.getTopicMap().getTopicWithBaseName(name);
    if (t != null)     return makeLayeredTopic(t);
  }
  return null;
}
Program: 117745
Project: 117745
Buggy source:
public void topicVariantChanged(Topic t,Collection<Topic> scope,String newName,String oldName) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=makeLayeredTopic(t);
    Collection<Topic> lscope=makeLayeredTopics(scope);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicVariantChanged(lt,lscope,newName,oldName);
    }
  }
}

Fixed version (ground truth):
public void topicVariantChanged(Topic t,Collection<Topic> scope,String newName,String oldName) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=makeLayeredTopic(t);
    Collection<Topic> lscope=makeLayeredTopics(scope);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicVariantChanged(lt,lscope,newName,oldName);
    }
  }
}
Program: 117746
Project: 117746
Buggy source:
public Topic getTopicBySubjectLocator(Locator sl) throws TopicMapException {
  HashSet<Topic> collected=new HashSet<Topic>();
  for (  Layer l : visibleLayers) {
    Topic t=l.getTopicMap().getTopicBySubjectLocator(sl);
    if (t != null)     return makeLayeredTopic(t);
  }
  return null;
}

Fixed version (ground truth):
public Topic getTopicBySubjectLocator(Locator sl) throws TopicMapException {
  HashSet<Topic> collected=new LinkedHashSet<Topic>();
  for (  Layer l : visibleLayers) {
    Topic t=l.getTopicMap().getTopicBySubjectLocator(sl);
    if (t != null)     return makeLayeredTopic(t);
  }
  return null;
}
Program: 117747
Project: 117747
Buggy source:
public void associationTypeChanged(Association a,Topic newType,Topic oldType) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    LayeredAssociation la=makeLayeredAssociation(a);
    LayeredTopic lNewType=makeLayeredTopic(newType);
    LayeredTopic lOldType=makeLayeredTopic(oldType);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationTypeChanged(la,lNewType,lOldType);
    }
  }
}

Fixed version (ground truth):
public void associationTypeChanged(Association a,Topic newType,Topic oldType) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    LayeredAssociation la=makeLayeredAssociation(a);
    LayeredTopic lNewType=makeLayeredTopic(newType);
    LayeredTopic lOldType=makeLayeredTopic(oldType);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationTypeChanged(la,lNewType,lOldType);
    }
  }
}
Program: 117748
Project: 117748
Buggy source:
public void topicBaseNameChanged(Topic t,String newName,String oldName) throws TopicMapException {
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  removeTopicFromIndex(t.getOneSubjectIdentifier());
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicBaseNameChanged(lt,newName,oldName);
    }
  }
}

Fixed version (ground truth):
public void topicBaseNameChanged(Topic t,String newName,String oldName) throws TopicMapException {
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  removeTopicFromIndex(t.getOneSubjectIdentifier());
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicBaseNameChanged(lt,newName,oldName);
    }
  }
}
Program: 117749
Project: 117749
Buggy source:
public Collection<Topic> getTopicsOfType(Topic type) throws TopicMapException {
  Set<Topic> processed=new KeyedHashSet<Topic>(new TopicAndLayerKeyMaker());
  Vector<Topic> ret=new Vector<Topic>();
  LayeredTopic lt=(LayeredTopic)type;
  for (  Layer l : visibleLayers) {
    for (    Topic typeIn : lt.getTopicsForLayer(l)) {
      Collection<Topic> c=l.getTopicMap().getTopicsOfType(typeIn);
      for (      Topic t : c) {
        if (processed.contains(t))         continue;
        Set<Topic> collected=collectTopics(t);
        processed.addAll(collected);
        LayeredTopic add=new LayeredTopic(collected,this);
        addTopicToIndex(add);
        ret.add(add);
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
public Collection<Topic> getTopicsOfType(Topic type) throws TopicMapException {
  Set<Topic> processed=new KeyedHashSet<Topic>(new TopicAndLayerKeyMaker());
  ArrayList<Topic> ret=new ArrayList<Topic>();
  LayeredTopic lt=(LayeredTopic)type;
  for (  Layer l : visibleLayers) {
    for (    Topic typeIn : lt.getTopicsForLayer(l)) {
      Collection<Topic> c=l.getTopicMap().getTopicsOfType(typeIn);
      for (      Topic t : c) {
        if (processed.contains(t))         continue;
        Set<Topic> collected=collectTopics(t);
        processed.addAll(collected);
        LayeredTopic add=new LayeredTopic(collected,this);
        addTopicToIndex(add);
        ret.add(add);
      }
    }
  }
  return ret;
}
Program: 117750
Project: 117750
Buggy source:
public LayerStack(){
  layers=new Vector<Layer>();
  visibleLayers=new Vector<Layer>();
  layerIndex=new HashMap<TopicMap,Layer>();
  topicMapListeners=new ArrayList<TopicMapListener>();
  containerListener=new ContainerTopicMapListener(){
    public void layerAdded(    Layer l){
      notifyLayersChanged();
      fireLayerAdded(l);
    }
    public void layerChanged(    Layer oldLayer,    Layer newLayer){
      notifyLayersChanged();
      fireLayerChanged(oldLayer,newLayer);
    }
    public void layerRemoved(    Layer l){
      notifyLayersChanged();
      fireLayerRemoved(l);
    }
    public void layerStructureChanged(){
      notifyLayersChanged();
      fireLayerStructureChanged();
    }
    public void layerVisibilityChanged(    Layer l){
      notifyLayersChanged();
      fireLayerVisibilityChanged(l);
    }
  }
;
}

Fixed version (ground truth):
public LayerStack(){
  layers=new Vector<Layer>();
  visibleLayers=new Vector<Layer>();
  layerIndex=new LinkedHashMap<TopicMap,Layer>();
  topicMapListeners=new ArrayList<TopicMapListener>();
  containerListener=new ContainerTopicMapListener(){
    public void layerAdded(    Layer l){
      notifyLayersChanged();
      fireLayerAdded(l);
    }
    public void layerChanged(    Layer oldLayer,    Layer newLayer){
      notifyLayersChanged();
      fireLayerChanged(oldLayer,newLayer);
    }
    public void layerRemoved(    Layer l){
      notifyLayersChanged();
      fireLayerRemoved(l);
    }
    public void layerStructureChanged(){
      notifyLayersChanged();
      fireLayerStructureChanged();
    }
    public void layerVisibilityChanged(    Layer l){
      notifyLayersChanged();
      fireLayerVisibilityChanged(l);
    }
  }
;
}
Program: 117751
Project: 117751
Buggy source:
public void associationPlayerChanged(Association a,Topic role,Topic newPlayer,Topic oldPlayer) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    LayeredAssociation la=makeLayeredAssociation(a);
    LayeredTopic lrole=makeLayeredTopic(role);
    LayeredTopic lNewPlayer=makeLayeredTopic(newPlayer);
    LayeredTopic lOldPlayer=makeLayeredTopic(oldPlayer);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationPlayerChanged(la,lrole,lNewPlayer,lOldPlayer);
    }
  }
}

Fixed version (ground truth):
public void associationPlayerChanged(Association a,Topic role,Topic newPlayer,Topic oldPlayer) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    LayeredAssociation la=makeLayeredAssociation(a);
    LayeredTopic lrole=makeLayeredTopic(role);
    LayeredTopic lNewPlayer=makeLayeredTopic(newPlayer);
    LayeredTopic lOldPlayer=makeLayeredTopic(oldPlayer);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.associationPlayerChanged(la,lrole,lNewPlayer,lOldPlayer);
    }
  }
}
Program: 117752
Project: 117752
Buggy source:
public void topicChanged(Topic t) throws TopicMapException {
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=null;
    if (t instanceof LayeredTopic && t.getTopicMap() == this)     lt=(LayeredTopic)t;
 else     lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicChanged(lt);
    }
  }
}

Fixed version (ground truth):
public void topicChanged(Topic t) throws TopicMapException {
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=null;
    if (t instanceof LayeredTopic && t.getTopicMap() == this)     lt=(LayeredTopic)t;
 else     lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicChanged(lt);
    }
  }
}
Program: 117753
Project: 117753
Buggy source:
public void topicSubjectIdentifierChanged(Topic t,Locator added,Locator removed) throws TopicMapException {
  if (removed != null)   removeTopicFromIndex(removed);
  if (added != null)   removeTopicFromIndex(added);
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicSubjectIdentifierChanged(lt,added,removed);
    }
  }
}

Fixed version (ground truth):
public void topicSubjectIdentifierChanged(Topic t,Locator added,Locator removed) throws TopicMapException {
  if (removed != null)   removeTopicFromIndex(removed);
  if (added != null)   removeTopicFromIndex(added);
  for (  Locator l : t.getSubjectIdentifiers()) {
    removeTopicFromIndex(l);
  }
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=makeLayeredTopic(t);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicSubjectIdentifierChanged(lt,added,removed);
    }
  }
}
Program: 117754
Project: 117754
Buggy source:
public Collection<Association> getAssociationsOfType(Topic type) throws TopicMapException {
  LayeredTopic lt=(LayeredTopic)type;
  KeyedHashMap<Topic,LayeredTopic> layeredTopics=new KeyedHashMap<Topic,LayeredTopic>(new TopicAndLayerKeyMaker());
  HashSet<Association> associations=new HashSet<Association>();
  for (  Layer l : visibleLayers) {
    for (    Topic typeIn : lt.getTopicsForLayer(l)) {
      Collection<Association> c=l.getTopicMap().getAssociationsOfType(typeIn);
      for (      Association a : c) {
        LayeredAssociation la=new LayeredAssociation(this,lt);
        for (        Topic role : a.getRoles()) {
          LayeredTopic lrole=getLayeredTopic(role,layeredTopics);
          Topic player=a.getPlayer(role);
          LayeredTopic lplayer=getLayeredTopic(player,layeredTopics);
          la.addLayeredPlayer(lplayer,lrole);
        }
        associations.add(la);
      }
    }
  }
  return associations;
}

Fixed version (ground truth):
public Collection<Association> getAssociationsOfType(Topic type) throws TopicMapException {
  LayeredTopic lt=(LayeredTopic)type;
  KeyedHashMap<Topic,LayeredTopic> layeredTopics=new KeyedHashMap<Topic,LayeredTopic>(new TopicAndLayerKeyMaker());
  HashSet<Association> associations=new LinkedHashSet<Association>();
  for (  Layer l : visibleLayers) {
    for (    Topic typeIn : lt.getTopicsForLayer(l)) {
      Collection<Association> c=l.getTopicMap().getAssociationsOfType(typeIn);
      for (      Association a : c) {
        LayeredAssociation la=new LayeredAssociation(this,lt);
        for (        Topic role : a.getRoles()) {
          LayeredTopic lrole=getLayeredTopic(role,layeredTopics);
          Topic player=a.getPlayer(role);
          LayeredTopic lplayer=getLayeredTopic(player,layeredTopics);
          la.addLayeredPlayer(lplayer,lrole);
        }
        associations.add(la);
      }
    }
  }
  return associations;
}
Program: 117755
Project: 117755
Buggy source:
public void topicTypeChanged(Topic t,Topic added,Topic removed) throws TopicMapException {
  if (topicMapListeners.size() > 0) {
    LayeredTopic lt=makeLayeredTopic(t);
    LayeredTopic ladded=makeLayeredTopic(added);
    LayeredTopic lremoved=makeLayeredTopic(removed);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicTypeChanged(lt,ladded,lremoved);
    }
  }
}

Fixed version (ground truth):
public void topicTypeChanged(Topic t,Topic added,Topic removed) throws TopicMapException {
  if (!topicMapListeners.isEmpty()) {
    LayeredTopic lt=makeLayeredTopic(t);
    LayeredTopic ladded=makeLayeredTopic(added);
    LayeredTopic lremoved=makeLayeredTopic(removed);
    for (    TopicMapListener listener : topicMapListeners) {
      listener.topicTypeChanged(lt,ladded,lremoved);
    }
  }
}
Program: 117756
Project: 117756
Buggy source:
@Override public boolean equals(Object o){
  if (!o.getClass().equals(this.getClass()))   return false;
  LinkedTopic lt=(LinkedTopic)o;
  if (lt.topicMap != topicMap)   return false;
  if (!lt.wrappedTopic.equals(wrappedTopic))   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (o == null)   return false;
  if (!o.getClass().equals(this.getClass()))   return false;
  LinkedTopic lt=(LinkedTopic)o;
  if (lt.topicMap != topicMap)   return false;
  if (!lt.wrappedTopic.equals(wrappedTopic))   return false;
  return true;
}
Program: 117757
Project: 117757
Buggy source:
public boolean handleException(PatchException e){
  pes.add(e);
  if (yesToAll[0])   return true;
  int c=WandoraOptionPane.showConfirmDialog(admin,"String_Node_Str" + e.level + "String_Node_Str"+ e.message,"String_Node_Str",WandoraOptionPane.YES_TO_ALL_NO_OPTION);
  if (c == WandoraOptionPane.YES_TO_ALL_OPTION) {
    yesToAll[0]=true;
    return true;
  }
 else   if (c == WandoraOptionPane.YES_OPTION)   return true;
 else {
    aborted[0]=true;
    return false;
  }
}

Fixed version (ground truth):
public boolean handleException(PatchException e){
  pes.add(e);
  if (yesToAll[0])   return false;
  int c=WandoraOptionPane.showConfirmDialog(admin,"String_Node_Str" + e.level + "String_Node_Str"+ e.message,"String_Node_Str",WandoraOptionPane.YES_TO_ALL_NO_OPTION);
  if (c == WandoraOptionPane.YES_TO_ALL_OPTION) {
    yesToAll[0]=true;
    return false;
  }
 else   if (c == WandoraOptionPane.YES_OPTION)   return true;
 else {
    aborted[0]=true;
    return true;
  }
}
Program: 117759
Project: 117759
Buggy source:
@Override public void afterTextChanged(Editable s){
  if (TextUtils.isEmpty(s)) {
    if (mLabel.getVisibility() == View.VISIBLE) {
      hideLabel();
    }
  }
 else {
    if (mLabel.getVisibility() != View.VISIBLE) {
      showLabel();
    }
  }
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable s){
  if (TextUtils.isEmpty(s)) {
    if (mLabel.getVisibility() == View.VISIBLE || isAnimating) {
      hideLabel();
    }
  }
 else {
    if (mLabel.getVisibility() != View.VISIBLE & !isAnimating) {
      showLabel();
    }
  }
}
Program: 117760
Project: 117760
Buggy source:
@Override public void onAnimationEnd(Animation animation){
  mLabel.setVisibility(View.GONE);
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  mLabel.setVisibility(View.GONE);
  isAnimating=false;
}
Program: 117761
Project: 117761
Buggy source:
private void setEditText(EditText editText){
  mEditText=editText;
  mEditText.addTextChangedListener(new TextWatcher(){
    @Override public void afterTextChanged(    Editable s){
      if (TextUtils.isEmpty(s)) {
        if (mLabel.getVisibility() == View.VISIBLE) {
          hideLabel();
        }
      }
 else {
        if (mLabel.getVisibility() != View.VISIBLE) {
          showLabel();
        }
      }
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  mEditText.setOnFocusChangeListener(new OnFocusChangeListener(){
    @Override public void onFocusChange(    View view,    boolean focused){
      mLabel.setActivated(focused);
    }
  }
);
  mLabel.setText(mEditText.getHint());
}

Fixed version (ground truth):
private void setEditText(EditText editText){
  mEditText=editText;
  mEditText.addTextChangedListener(new TextWatcher(){
    @Override public void afterTextChanged(    Editable s){
      if (TextUtils.isEmpty(s)) {
        if (mLabel.getVisibility() == View.VISIBLE || isAnimating) {
          hideLabel();
        }
      }
 else {
        if (mLabel.getVisibility() != View.VISIBLE & !isAnimating) {
          showLabel();
        }
      }
    }
    @Override public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    @Override public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  mEditText.setOnFocusChangeListener(new OnFocusChangeListener(){
    @Override public void onFocusChange(    View view,    boolean focused){
      mLabel.setActivated(focused);
    }
  }
);
  mLabel.setText(mEditText.getHint());
}
Program: 117762
Project: 117762
Buggy source:
@Override public void onAnimationStart(Animation animation){
}

Fixed version (ground truth):
@Override public void onAnimationStart(Animation animation){
  isAnimating=true;
}
Program: 117763
Project: 117763
Buggy source:
/** 
 * Sets the Spinners' time selection as integers considering only time.
 */
public void setSelectedTime(int hour,int minute){
  timeSpinner.setSelectedTime(hour,minute);
}

Fixed version (ground truth):
/** 
 * Sets the Spinners' time selection as integers considering only time.
 */
public void setSelectedTime(int hour,int minute){
  timeSpinner.setSelectedTime(hour,minute);
  shouldSelectDefault=false;
}
Program: 117764
Project: 117764
Buggy source:
@Override protected void onRestoreInstanceState(Parcelable state){
  super.onRestoreInstanceState(state);
  if (state != null)   restoringViewState=true;
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Parcelable state){
  super.onRestoreInstanceState(state);
  if (state != null)   shouldSelectDefault=false;
}
Program: 117765
Project: 117765
Buggy source:
/** 
 * Sets the Spinners' date selection as integers considering only day.
 */
public void setSelectedDate(int year,int month,int day){
  dateSpinner.setSelectedDate(new GregorianCalendar(year,month,day));
}

Fixed version (ground truth):
/** 
 * Sets the Spinners' date selection as integers considering only day.
 */
public void setSelectedDate(int year,int month,int day){
  dateSpinner.setSelectedDate(new GregorianCalendar(year,month,day));
  shouldSelectDefault=false;
}
Program: 117766
Project: 117766
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  if (!restoringViewState)   selectDefaultDate();
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  if (shouldSelectDefault)   selectDefaultDate();
}
Program: 117767
Project: 117767
Buggy source:
/** 
 * Sets the time format to use for formatting Calendar objects to displayable strings.
 * @param timeFormat The new time format (as java.text.DateFormat), or null to use the default format.
 */
public void setTimeFormat(java.text.DateFormat timeFormat){
  this.timeFormat=timeFormat;
  initTimePickerDialog(getContext());
  final boolean moreTimeItems=isShowingMoreTimeItems();
  final boolean numbersInView=((PickerSpinnerAdapter)getAdapter()).isShowingSecondaryTextInView();
  final Calendar selection=getSelectedTime();
  initAdapter(getContext());
  this.showMoreTimeItems=false;
  setShowMoreTimeItems(moreTimeItems);
  setShowNumbersInView(numbersInView);
  setSelectedTime(selection.get(Calendar.HOUR_OF_DAY),selection.get(Calendar.MINUTE));
}

Fixed version (ground truth):
/** 
 * Sets the time format to use for formatting Calendar objects to displayable strings.
 * @param timeFormat The new time format (as java.text.DateFormat), or null to use the default format.
 */
public void setTimeFormat(java.text.DateFormat timeFormat){
  this.timeFormat=timeFormat;
  initTimePickerDialog(getContext());
  final PickerSpinnerAdapter adapter=((PickerSpinnerAdapter)getAdapter());
  final boolean moreTimeItems=isShowingMoreTimeItems();
  final boolean numbersInView=adapter.isShowingSecondaryTextInView();
  final Calendar selection=getSelectedTime();
  final boolean temporarySelected=getSelectedItemPosition() == adapter.getCount();
  initAdapter(getContext());
  setShowNumbersInView(numbersInView);
  this.showMoreTimeItems=false;
  if (temporarySelected) {
    setSelectedTime(selection.get(Calendar.HOUR_OF_DAY),selection.get(Calendar.MINUTE));
    setShowMoreTimeItems(moreTimeItems);
  }
 else {
    setShowMoreTimeItems(moreTimeItems);
    setSelectedTime(selection.get(Calendar.HOUR_OF_DAY),selection.get(Calendar.MINUTE));
  }
}
Program: 117768
Project: 117768
Buggy source:
/** 
 * The returned String may be passed to   {@link #fromString(String)} to save and recreate this object easily.
 * @return The elements of this object separated by \n
 */
@Override public String toString(){
  String sep="String_Node_Str";
  return label + sep + digitalTime+ sep+ hour+ sep+ minute;
}

Fixed version (ground truth):
/** 
 * The returned String may be passed to   {@link #fromString(String)} to save and recreate this object easily.
 * @return The elements of this object separated by \n
 */
@Override public String toString(){
  String sep="String_Node_Str";
  return nullToEmpty(label) + sep + nullToEmpty(digitalTime)+ sep+ hour+ sep+ minute;
}
Program: 117769
Project: 117769
Buggy source:
/** 
 * Constructs a new TimeItem from a String previously gotten from the   {@link #toString()} method.
 * @param code The string to parse from.
 * @return A new TimeItem, or null if there was an error.
 */
public static TimeItem fromString(String code){
  String[] items=code.split("String_Node_Str");
  if (items.length != 4)   return null;
  int hour, minute;
  try {
    hour=Integer.parseInt(items[2]);
    minute=Integer.parseInt(items[3]);
  }
 catch (  NumberFormatException e) {
    e.printStackTrace();
    return null;
  }
  return new TimeItem(items[0],items[1],hour,minute);
}

Fixed version (ground truth):
/** 
 * Constructs a new TimeItem from a String previously gotten from the   {@link #toString()} method.
 * @param code The string to parse from.
 * @return A new TimeItem, or null if there was an error.
 */
public static TimeItem fromString(String code){
  String[] items=code.split("String_Node_Str");
  if (items.length != 4)   return null;
  int hour, minute;
  try {
    hour=Integer.parseInt(items[2]);
    minute=Integer.parseInt(items[3]);
  }
 catch (  NumberFormatException e) {
    e.printStackTrace();
    return null;
  }
  return new TimeItem(emptyToNull(items[0]),emptyToNull(items[1]),hour,minute);
}
Program: 117770
Project: 117770
Buggy source:
/** 
 * Construct a new PickerSpinner with the given context's theme, the supplied attribute set, and default style.
 * @param context The Context the view is running in, through which it can access the current theme, resources, etc.
 * @param attrs The attributes of the XML tag that is inflating the view.
 * @param defStyle The default style to apply to this view. If 0, no style will be applied (beyondwhat is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.
 */
public PickerSpinner(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  PickerSpinnerAdapter adapter=new PickerSpinnerAdapter(context,getSpinnerItems(),new TwinTextItem.Simple(getFooter(),null));
  setAdapter(adapter);
}

Fixed version (ground truth):
/** 
 * Construct a new PickerSpinner with the given context's theme, the supplied attribute set, and default style.
 * @param context The Context the view is running in, through which it can access the current theme, resources, etc.
 * @param attrs The attributes of the XML tag that is inflating the view.
 * @param defStyle The default style to apply to this view. If 0, no style will be applied (beyondwhat is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.
 */
public PickerSpinner(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs);
  initAdapter(context);
}
Program: 117771
Project: 117771
Buggy source:
/** 
 * Construct a new TimeSpinner with the given context's theme, the supplied attribute set, and default style.
 * @param context The Context the view is running in, through which it can access the current theme, resources, etc.
 * @param attrs The attributes of the XML tag that is inflating the view. May contain a flags attribute.
 * @param defStyle The default style to apply to this view. If 0, no style will be applied (beyondwhat is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.
 */
public TimeSpinner(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (context instanceof OnTimeSelectedListener)   setOnTimeSelectedListener((OnTimeSelectedListener)context);
  setOnItemSelectedListener(this);
  final Calendar calendar=Calendar.getInstance();
  timePickerDialog=TimePickerDialog.newInstance(new TimePickerDialog.OnTimeSetListener(){
    @Override public void onTimeSet(    RadialPickerLayout radialPickerLayout,    int hour,    int minute){
      setSelectedTime(hour,minute);
    }
  }
,calendar.get(Calendar.HOUR_OF_DAY),calendar.get(Calendar.MINUTE),DateFormat.is24HourFormat(context),hasVibratePermission(context));
  try {
    fragmentManager=((FragmentActivity)context).getSupportFragmentManager();
  }
 catch (  ClassCastException e) {
    Log.d(getClass().getSimpleName(),"String_Node_Str");
  }
  if (attrs != null) {
    TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ReminderDatePicker);
    int flags=a.getInt(R.styleable.ReminderDatePicker_flags,ReminderDatePicker.MODE_GOOGLE);
    setFlags(flags);
  }
}

Fixed version (ground truth):
/** 
 * Construct a new TimeSpinner with the given context's theme, the supplied attribute set, and default style.
 * @param context The Context the view is running in, through which it can access the current theme, resources, etc.
 * @param attrs The attributes of the XML tag that is inflating the view. May contain a flags attribute.
 * @param defStyle The default style to apply to this view. If 0, no style will be applied (beyondwhat is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.
 */
public TimeSpinner(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (context instanceof OnTimeSelectedListener)   setOnTimeSelectedListener((OnTimeSelectedListener)context);
  setOnItemSelectedListener(this);
  initTimePickerDialog(context);
  try {
    fragmentManager=((FragmentActivity)context).getSupportFragmentManager();
  }
 catch (  ClassCastException e) {
    Log.d(getClass().getSimpleName(),"String_Node_Str");
  }
  if (attrs != null) {
    TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ReminderDatePicker);
    int flags=a.getInt(R.styleable.ReminderDatePicker_flags,ReminderDatePicker.MODE_GOOGLE);
    setFlags(flags);
  }
}
Program: 117772
Project: 117772
Buggy source:
@Override public List<TwinTextItem> getSpinnerItems(){
  final Resources res=getResources();
  ArrayList<TwinTextItem> items=new ArrayList<TwinTextItem>(4);
  items.add(new TimeItem(res.getString(R.string.time_morning),9,0));
  items.add(new TimeItem(res.getString(R.string.time_afternoon),13,0));
  items.add(new TimeItem(res.getString(R.string.time_evening),17,0));
  items.add(new TimeItem(res.getString(R.string.time_night),20,0));
  return items;
}

Fixed version (ground truth):
@Override public List<TwinTextItem> getSpinnerItems(){
  final Resources res=getResources();
  ArrayList<TwinTextItem> items=new ArrayList<TwinTextItem>(4);
  items.add(new TimeItem(res.getString(R.string.time_morning),formatTime(9,0),9,0));
  items.add(new TimeItem(res.getString(R.string.time_afternoon),formatTime(13,0),13,0));
  items.add(new TimeItem(res.getString(R.string.time_evening),formatTime(17,0),17,0));
  items.add(new TimeItem(res.getString(R.string.time_night),formatTime(20,0),20,0));
  return items;
}
Program: 117773
Project: 117773
Buggy source:
/** 
 * Toggles showing more time items. If enabled, a noon and a late night time item are shown.
 * @param enable True to enable, false to disable more time items.
 */
public void setShowMoreTimeItems(boolean enable){
  if (enable && !showMoreTimeItems) {
    final Resources res=getResources();
    insertAdapterItem(new TimeItem(res.getString(R.string.time_afternoon_2),14,0),2);
    removeAdapterItemAt(1);
    insertAdapterItem(new TimeItem(res.getString(R.string.time_noon),12,0),1);
    addAdapterItem(new TimeItem(res.getString(R.string.time_late_night),23,0));
  }
 else   if (!enable && showMoreTimeItems) {
    insertAdapterItem(new TimeItem(getResources().getString(R.string.time_afternoon),13,0),3);
    removeAdapterItemAt(2);
    removeAdapterItemAt(1);
    removeAdapterItemAt(getLastItemPosition());
  }
  showMoreTimeItems=enable;
}

Fixed version (ground truth):
/** 
 * Toggles showing more time items. If enabled, a noon and a late night time item are shown.
 * @param enable True to enable, false to disable more time items.
 */
public void setShowMoreTimeItems(boolean enable){
  if (enable && !showMoreTimeItems) {
    final Resources res=getResources();
    insertAdapterItem(new TimeItem(res.getString(R.string.time_afternoon_2),formatTime(14,0),14,0),2);
    removeAdapterItemAt(1);
    insertAdapterItem(new TimeItem(res.getString(R.string.time_noon),formatTime(12,0),12,0),1);
    addAdapterItem(new TimeItem(res.getString(R.string.time_late_night),formatTime(23,0),23,0));
  }
 else   if (!enable && showMoreTimeItems) {
    insertAdapterItem(new TimeItem(getResources().getString(R.string.time_afternoon),formatTime(13,0),13,0),3);
    removeAdapterItemAt(2);
    removeAdapterItemAt(1);
    removeAdapterItemAt(getLastItemPosition());
  }
  showMoreTimeItems=enable;
}
Program: 117774
Project: 117774
Buggy source:
/** 
 * Sets the time format to use for formatting Calendar objects to displayable strings.
 * @param timeFormat The new time format (as java.text.DateFormat), or null to use the default format.
 */
public void setTimeFormat(java.text.DateFormat timeFormat){
  this.timeFormat=timeFormat;
}

Fixed version (ground truth):
/** 
 * Sets the time format to use for formatting Calendar objects to displayable strings.
 * @param timeFormat The new time format (as java.text.DateFormat), or null to use the default format.
 */
public void setTimeFormat(java.text.DateFormat timeFormat){
  this.timeFormat=timeFormat;
  initTimePickerDialog(getContext());
  initAdapter(getContext());
}
Program: 117775
Project: 117775
Buggy source:
/** 
 * Sets the Spinner's selection as date. If the date was not in the possible selections, a temporary item is created and passed to selectTemporary().
 * @param date The date to be selected.
 */
public void setSelectedDate(Calendar date){
  final int count=getAdapter().getCount() - 1;
  int itemPosition=-1;
  for (int i=0; i < count; i++) {
    if (getAdapter().getItem(i).equals(date)) {
      itemPosition=i;
      break;
    }
  }
  if (itemPosition >= 0)   setSelection(itemPosition);
 else {
    final long MILLIS_IN_DAY=1000 * 60 * 60* 24;
    final long dateDifference=(date.getTimeInMillis() / MILLIS_IN_DAY) - (Calendar.getInstance().getTimeInMillis() / MILLIS_IN_DAY);
    if (dateDifference > 0 && dateDifference <= 7) {
      final int day=date.get(Calendar.DAY_OF_WEEK);
      selectTemporary(new DateItem(getWeekDay(day,R.string.date_next_weekday),date));
    }
 else {
      selectTemporary(new DateItem(formatDate(date),date));
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets the Spinner's selection as date. If the date was not in the possible selections, a temporary item is created and passed to selectTemporary().
 * @param date The date to be selected.
 */
public void setSelectedDate(Calendar date){
  final int count=getAdapter().getCount() - 1;
  int itemPosition=-1;
  for (int i=0; i < count; i++) {
    if (getAdapter().getItem(i).equals(date)) {
      itemPosition=i;
      break;
    }
  }
  if (itemPosition >= 0)   setSelection(itemPosition);
 else   if (showWeekdayNames) {
    final long MILLIS_IN_DAY=1000 * 60 * 60* 24;
    final long dateDifference=(date.getTimeInMillis() / MILLIS_IN_DAY) - (Calendar.getInstance().getTimeInMillis() / MILLIS_IN_DAY);
    if (dateDifference > 0 && dateDifference < 7) {
      final int day=date.get(Calendar.DAY_OF_WEEK);
      selectTemporary(new DateItem(getWeekDay(day,R.string.date_only_weekday),date));
    }
 else {
      selectTemporary(new DateItem(formatDate(date),date));
    }
  }
 else {
    selectTemporary(new DateItem(formatDate(date),date));
  }
}
Program: 117776
Project: 117776
Buggy source:
/** 
 * Set the flags to use for this date spinner.
 * @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_...combined with the | operator.
 */
public void setFlags(int modeOrFlags){
  setShowPastItems((modeOrFlags & ReminderDatePicker.FLAG_PAST) != 0);
  setShowMonthItem((modeOrFlags & ReminderDatePicker.FLAG_MONTH) != 0);
}

Fixed version (ground truth):
/** 
 * Set the flags to use for this date spinner.
 * @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_...combined with the | operator.
 */
public void setFlags(int modeOrFlags){
  setShowPastItems((modeOrFlags & ReminderDatePicker.FLAG_PAST) != 0);
  setShowMonthItem((modeOrFlags & ReminderDatePicker.FLAG_MONTH) != 0);
  setShowWeekdayNames((modeOrFlags & ReminderDatePicker.FLAG_WEEKDAY_NAMES) != 0);
}