nus-yam/ex-repair huggingface dataset:
Program: 2629
Project: 2629
Buggy source:
public void setExternalState(String externalState){
  this.externalState=externalState;
  fireChanged();
}

Fixed version (ground truth):
public void setExternalState(final String externalState){
  this.externalState=externalState;
  fireChanged();
}
Program: 2631
Project: 2631
Buggy source:
public RosterPresenter(final HablarEventBus eventBus,final RosterDisplay display,final RosterConfig rosterConfig){
  super(TYPE,"String_Node_Str" + ++index,eventBus,display);
  roster=Suco.get(Roster.class);
  basicActions=new RosterBasicActions();
  this.rosterConfig=rosterConfig;
  groupPresenters=new HashMap<String,RosterGroupPresenter>();
  active=true;
  itemMenu=new Menu<RosterItemPresenter>(display.newRosterItemMenuDisplay("String_Node_Str"));
  groupMenu=new Menu<RosterGroupPresenter>(display.newRosterGroupMenuDisplay("String_Node_Str"));
  addRosterListeners();
  addSessionListeners();
  getState().init(HablarIcons.get(IconType.roster),i18n().contacts());
}

Fixed version (ground truth):
public RosterPresenter(final HablarEventBus eventBus,final RosterDisplay display,final RosterConfig rosterConfig){
  super(TYPE,"String_Node_Str" + ++index,eventBus,display);
  roster=Suco.get(Roster.class);
  basicActions=new RosterBasicActions();
  this.rosterConfig=rosterConfig;
  groupPresenters=new HashMap<String,RosterGroupPresenter>();
  active=true;
  itemMenu=new Menu<RosterItemPresenter>(display.newRosterItemMenuDisplay("String_Node_Str"));
  groupMenu=new Menu<RosterGroupPresenter>(display.newRosterGroupMenuDisplay("String_Node_Str"));
  addRosterListeners();
  addSessionListeners();
  String title=i18n().contacts();
  getState().init(HablarIcons.get(IconType.roster),title,title);
}
Program: 2632
Project: 2632
Buggy source:
public SearchPage(final Visibility visibility,final boolean closeable,final SearchQueryFactory queryFactory,final HablarEventBus eventBus,final SearchWidget display){
  super("String_Node_Str","String_Node_Str" + ++index,eventBus,display);
  this.queryFactory=queryFactory;
  manager=Suco.get(SearchManager.class);
  setVisibility(visibility);
  model.setCloseable(closeable);
  model.init(HablarIcons.get(HablarIcons.IconType.search),i18n().searchUsers());
  final MenuDisplay<SearchResultItem> menuDisplay=display.createMenu(SEARCH_MENU);
  itemMenu=new Menu<SearchResultItem>(menuDisplay);
  bind();
}

Fixed version (ground truth):
public SearchPage(final Visibility visibility,final boolean closeable,final SearchQueryFactory queryFactory,final HablarEventBus eventBus,final SearchWidget display){
  super("String_Node_Str","String_Node_Str" + ++index,eventBus,display);
  this.queryFactory=queryFactory;
  manager=Suco.get(SearchManager.class);
  setVisibility(visibility);
  model.setCloseable(closeable);
  String title=i18n().searchUsers();
  model.init(HablarIcons.get(HablarIcons.IconType.search),title,title);
  final MenuDisplay<SearchResultItem> menuDisplay=display.createMenu(SEARCH_MENU);
  itemMenu=new Menu<SearchResultItem>(menuDisplay);
  bind();
}
Program: 2634
Project: 2634
Buggy source:
public OwnVCardPresenter(final HablarEventBus eventBus,final VCardDisplay display){
  super(eventBus,display);
  model.init(HablarIcons.get(IconType.buddyWait),I18nVCard.t.ownVCardTitle());
  display.setAcceptVisible(false);
  display.setCancelVisible(false);
  display.setPageTitle(I18nVCard.t.ownVCardTitle());
  setLoading(true,I18nVCard.t.waitingToLogin());
  final Session session=Suco.get(Session.class);
  session.onStateChanged(new Listener<Session>(){
    @Override public void onEvent(    final Session session){
      if (session.getState() == State.loggedIn) {
        requestVCard();
      }
    }
  }
);
  if (session.getState() == State.loggedIn) {
    requestVCard();
  }
}

Fixed version (ground truth):
public OwnVCardPresenter(final HablarEventBus eventBus,final VCardDisplay display){
  super(eventBus,display);
  String title=I18nVCard.t.ownVCardTitle();
  model.init(HablarIcons.get(IconType.buddyWait),title,title);
  display.setAcceptVisible(false);
  display.setCancelVisible(false);
  display.setPageTitle(I18nVCard.t.ownVCardTitle());
  setLoading(true,I18nVCard.t.waitingToLogin());
  final Session session=Suco.get(Session.class);
  session.onStateChanged(new Listener<Session>(){
    @Override public void onEvent(    final Session session){
      if (session.getState() == State.loggedIn) {
        requestVCard();
      }
    }
  }
);
  if (session.getState() == State.loggedIn) {
    requestVCard();
  }
}
Program: 2635
Project: 2635
Buggy source:
protected void togglePageBlink(final Page<?> page,final boolean on){
  if (page.getState().getExternalState().startsWith("String_Node_Str")) {
    if (on) {
      page.getState().setExternalState("String_Node_Str");
    }
 else {
      page.getState().setExternalState("String_Node_Str");
    }
    new Timer(){
      public void run(){
        togglePageBlink(page,!on);
      }
    }
.schedule(BLINK_TIME);
  }
}

Fixed version (ground truth):
protected void togglePageBlink(final Page<?> page,final boolean on){
  if ((page.getState() == null) || (page.getState().getExternalState() == null))   return;
  if (page.getState().getExternalState().startsWith("String_Node_Str")) {
    if (on) {
      page.getState().setExternalState("String_Node_Str");
    }
 else {
      page.getState().setExternalState("String_Node_Str");
    }
    new Timer(){
      public void run(){
        togglePageBlink(page,!on);
      }
    }
.schedule(BLINK_TIME);
  }
}
Program: 2636
Project: 2636
Buggy source:
public void show(final int left,final int top){
  for (  final Action<T> action : actions) {
    display.setActionVisible(action,action.isApplicable(target));
  }
  int menuLeft=left;
  if ((left + WIDTH) > Window.getClientWidth()) {
    menuLeft=left - WIDTH;
  }
  display.show(menuLeft,top + Y_OFFSET);
}

Fixed version (ground truth):
public void show(final int left,final int top){
  for (  final Action<T> action : actions) {
    display.setActionVisible(action,action.isApplicable(target));
  }
  int menuLeft=left;
  if ((left + WIDTH) > Window.getClientWidth()) {
    menuLeft=left - WIDTH;
  }
  display.show(menuLeft,top + Y_OFFSET);
  int width=display.asWidget().getOffsetWidth();
  if (width != WIDTH) {
    menuLeft=left;
    if ((left + width) > Window.getClientWidth()) {
      menuLeft=left - width;
    }
    display.show(menuLeft,top + Y_OFFSET);
  }
}
Program: 2637
Project: 2637
Buggy source:
public void show(final int left,final int top){
  for (  final Action<T> action : actions) {
    display.setActionVisible(action,action.isApplicable(target));
  }
  display.show(left,top);
}

Fixed version (ground truth):
public void show(final int left,final int top){
  for (  final Action<T> action : actions) {
    display.setActionVisible(action,action.isApplicable(target));
  }
  display.show(left - WIDTH,top + Y_OFFSET);
}
Program: 2638
Project: 2638
Buggy source:
@Override public void onClick(final ClickEvent event){
  event.preventDefault();
  final Element element=event.getRelativeElement();
  final int width=element.getClientWidth();
  groupMenu.setTarget(groupPresenter);
  groupMenu.show(element.getAbsoluteLeft() - width,element.getAbsoluteTop());
}

Fixed version (ground truth):
@Override public void onClick(final ClickEvent event){
  event.preventDefault();
  final Element element=event.getRelativeElement();
  groupMenu.setTarget(groupPresenter);
  groupMenu.show(element.getAbsoluteLeft(),element.getAbsoluteTop());
}
Program: 2639
Project: 2639
Buggy source:
public GroupHeaderPresenter(final RosterGroupPresenter groupPresenter,final Menu<RosterGroupPresenter> groupMenu,final GroupHeaderDisplay display){
  this.display=display;
  final RosterGroup group=groupPresenter.getRosterGroup();
  final boolean isAllContacts=group.getName() == null;
  display.setMenuVisible(!isAllContacts);
  display.getToggleVisibility().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      groupPresenter.toggleVisibility();
    }
  }
);
  display.getOpenMenu().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      event.preventDefault();
      final Element element=event.getRelativeElement();
      final int width=element.getClientWidth();
      groupMenu.setTarget(groupPresenter);
      groupMenu.show(element.getAbsoluteLeft() - width,element.getAbsoluteTop());
    }
  }
);
  final Listener<RosterItem> updateGroup=new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem parameter){
      final String groupLabel=isAllContacts ? "String_Node_Str" : i18n().groupName(group.getName(),"String_Node_Str" + group.getSize());
      display.getName().setText(groupLabel);
    }
  }
;
  group.onItemAdded(updateGroup);
  group.onItemRemoved(updateGroup);
}

Fixed version (ground truth):
public GroupHeaderPresenter(final RosterGroupPresenter groupPresenter,final Menu<RosterGroupPresenter> groupMenu,final GroupHeaderDisplay display){
  this.display=display;
  final RosterGroup group=groupPresenter.getRosterGroup();
  final boolean isAllContacts=group.getName() == null;
  display.setMenuVisible(!isAllContacts);
  display.getToggleVisibility().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      groupPresenter.toggleVisibility();
    }
  }
);
  display.getOpenMenu().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      event.preventDefault();
      final Element element=event.getRelativeElement();
      groupMenu.setTarget(groupPresenter);
      groupMenu.show(element.getAbsoluteLeft(),element.getAbsoluteTop());
    }
  }
);
  final Listener<RosterItem> updateGroup=new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem parameter){
      final String groupLabel=isAllContacts ? "String_Node_Str" : i18n().groupName(group.getName(),"String_Node_Str" + group.getSize());
      display.getName().setText(groupLabel);
    }
  }
;
  group.onItemAdded(updateGroup);
  group.onItemRemoved(updateGroup);
}
Program: 2640
Project: 2640
Buggy source:
public RosterItemPresenter(final String groupName,final Menu<RosterItemPresenter> itemMenu,final RosterItemDisplay display){
  this.groupName=groupName;
  this.display=display;
  final ChatManager manager=Suco.get(ChatManager.class);
  display.getAction().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      manager.open(item.getJID());
    }
  }
);
  display.getMenuAction().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      event.preventDefault();
      final Element element=event.getRelativeElement();
      final int width=element.getClientWidth();
      itemMenu.setTarget(RosterItemPresenter.this);
      itemMenu.show(element.getAbsoluteLeft() - width,element.getAbsoluteTop());
    }
  }
);
}

Fixed version (ground truth):
public RosterItemPresenter(final String groupName,final Menu<RosterItemPresenter> itemMenu,final RosterItemDisplay display){
  this.groupName=groupName;
  this.display=display;
  final ChatManager manager=Suco.get(ChatManager.class);
  display.getAction().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      manager.open(item.getJID());
    }
  }
);
  display.getMenuAction().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      event.preventDefault();
      final Element element=event.getRelativeElement();
      itemMenu.setTarget(RosterItemPresenter.this);
      itemMenu.show(element.getAbsoluteLeft(),element.getAbsoluteTop());
    }
  }
);
}
Program: 2641
Project: 2641
Buggy source:
@Override public void onClick(final ClickEvent event){
  event.preventDefault();
  final Element element=event.getRelativeElement();
  final int width=element.getClientWidth();
  itemMenu.setTarget(RosterItemPresenter.this);
  itemMenu.show(element.getAbsoluteLeft() - width,element.getAbsoluteTop());
}

Fixed version (ground truth):
@Override public void onClick(final ClickEvent event){
  event.preventDefault();
  final Element element=event.getRelativeElement();
  itemMenu.setTarget(RosterItemPresenter.this);
  itemMenu.show(element.getAbsoluteLeft(),element.getAbsoluteTop());
}
Program: 2642
Project: 2642
Buggy source:
@Override public void onClick(final ClickEvent event){
  event.preventDefault();
  final Element element=event.getRelativeElement();
  final int width=element.getClientWidth();
  itemMenu.setTarget(item);
  itemMenu.show(element.getAbsoluteLeft() - width,element.getAbsoluteTop());
}

Fixed version (ground truth):
@Override public void onClick(final ClickEvent event){
  event.preventDefault();
  final Element element=event.getRelativeElement();
  itemMenu.setTarget(item);
  itemMenu.show(element.getAbsoluteLeft(),element.getAbsoluteTop());
}
Program: 2643
Project: 2643
Buggy source:
public SearchResultItemPresenter(final SearchResultItem item,final Menu<SearchResultItem> itemMenu,final SearchResultItemDisplay display){
  this.item=item;
  this.display=display;
  display.getName().setText(item.getNick());
  display.getJid().setText(item.getJid().toString());
  display.getMenu().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      event.preventDefault();
      final Element element=event.getRelativeElement();
      final int width=element.getClientWidth();
      itemMenu.setTarget(item);
      itemMenu.show(element.getAbsoluteLeft() - width,element.getAbsoluteTop());
    }
  }
);
}

Fixed version (ground truth):
public SearchResultItemPresenter(final SearchResultItem item,final Menu<SearchResultItem> itemMenu,final SearchResultItemDisplay display){
  this.item=item;
  this.display=display;
  display.getName().setText(item.getNick());
  display.getJid().setText(item.getJid().toString());
  display.getMenu().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      event.preventDefault();
      final Element element=event.getRelativeElement();
      itemMenu.setTarget(item);
      itemMenu.show(element.getAbsoluteLeft(),element.getAbsoluteTop());
    }
  }
);
}
Program: 2644
Project: 2644
Buggy source:
private void onChatVisibilityChanged(final Page<?> page){
  final Visibility visibility=page.getVisibility();
  if (visibility == Visibility.focused && unattendedChatPages.remove(page)) {
    eventBus.fireEvent(new UnattendedPagesChangedEvent(ChangeType.removed,page));
  }
}

Fixed version (ground truth):
private void onChatVisibilityChanged(final Page<?> page){
  final Visibility visibility=page.getVisibility();
  if (visibility == Visibility.focused && unattendedChatPages.remove(page)) {
    eventBus.fireEvent(new UnattendedChatsChangedEvent(ChangeType.removed,page));
  }
}
Program: 2645
Project: 2645
Buggy source:
private void bind(){
  eventBus.addHandler(UserMessageEvent.TYPE,new UserMessageHandler(){
    @Override public void onUserMessage(    final UserMessageEvent event){
      final String messageType=event.getMessageType();
      if (isChatMessage(messageType)) {
        final Page<?> page=event.getPage();
        final Visibility visibility=page.getVisibility();
        if (visibility != Visibility.focused && unattendedChatPages.add(page)) {
          eventBus.fireEvent(new UnattendedPagesChangedEvent(ChangeType.added,page));
        }
      }
    }
  }
);
  eventBus.addHandler(VisibilityChangedEvent.TYPE,new VisibilityChangedHandler(){
    @Override public void onVisibilityChanged(    final VisibilityChangedEvent event){
      final Page<?> page=event.getPage();
      if (isChatPage(page.getType())) {
        onChatVisibilityChanged(page);
      }
    }
  }
);
}

Fixed version (ground truth):
private void bind(){
  eventBus.addHandler(UserMessageEvent.TYPE,new UserMessageHandler(){
    @Override public void onUserMessage(    final UserMessageEvent event){
      final String messageType=event.getMessageType();
      if (isChatMessage(messageType)) {
        final Page<?> page=event.getPage();
        final Visibility visibility=page.getVisibility();
        if (visibility != Visibility.focused && unattendedChatPages.add(page)) {
          eventBus.fireEvent(new UnattendedChatsChangedEvent(ChangeType.added,page));
        }
      }
    }
  }
);
  eventBus.addHandler(VisibilityChangedEvent.TYPE,new VisibilityChangedHandler(){
    @Override public void onVisibilityChanged(    final VisibilityChangedEvent event){
      final Page<?> page=event.getPage();
      if (isChatPage(page.getType())) {
        onChatVisibilityChanged(page);
      }
    }
  }
);
}
Program: 2646
Project: 2646
Buggy source:
@Override public void onUserMessage(final UserMessageEvent event){
  final String messageType=event.getMessageType();
  if (isChatMessage(messageType)) {
    final Page<?> page=event.getPage();
    final Visibility visibility=page.getVisibility();
    if (visibility != Visibility.focused && unattendedChatPages.add(page)) {
      eventBus.fireEvent(new UnattendedPagesChangedEvent(ChangeType.added,page));
    }
  }
}

Fixed version (ground truth):
@Override public void onUserMessage(final UserMessageEvent event){
  final String messageType=event.getMessageType();
  if (isChatMessage(messageType)) {
    final Page<?> page=event.getPage();
    final Visibility visibility=page.getVisibility();
    if (visibility != Visibility.focused && unattendedChatPages.add(page)) {
      eventBus.fireEvent(new UnattendedChatsChangedEvent(ChangeType.added,page));
    }
  }
}
Program: 2647
Project: 2647
Buggy source:
@Override public void onEvent(final Presence presence){
  setState(presence);
}

Fixed version (ground truth):
@Override public void onEvent(final Presence presence){
  updatePageState();
}
Program: 2648
Project: 2648
Buggy source:
private void saveData(){
  for (  final EditorPage<?> editor : pages) {
    editor.saveData();
  }
  updatePresence();
  model.setCloseable(false);
}

Fixed version (ground truth):
private void saveData(){
  for (  final EditorPage<?> editor : pages) {
    editor.saveData();
  }
  updatePageState();
  model.setCloseable(false);
}
Program: 2649
Project: 2649
Buggy source:
public UserPage(final HablarEventBus eventBus,final UserDisplay display){
  super(TYPE,"String_Node_Str" + ++index,eventBus,display);
  session=Suco.get(Session.class);
  manager=Suco.get(PresenceManager.class);
  pages=new ArrayList<EditorPage<?>>();
  setVisibility(Visibility.notFocused);
  session.onStateChanged(new Listener<Session>(){
    @Override public void onEvent(    final Session session){
      updatePresence();
    }
  }
);
  manager.onOwnPresenceChanged(new Listener<Presence>(){
    @Override public void onEvent(    final Presence presence){
      setState(presence);
    }
  }
);
  updatePresence();
  model.setPageIcon(HablarIcons.get(IconType.buddyOff));
  display.getClose().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      saveData();
      requestVisibility(Visibility.notFocused);
    }
  }
);
}

Fixed version (ground truth):
public UserPage(final HablarEventBus eventBus,final UserDisplay display){
  super(TYPE,"String_Node_Str" + ++index,eventBus,display);
  session=Suco.get(Session.class);
  manager=Suco.get(PresenceManager.class);
  pages=new ArrayList<EditorPage<?>>();
  setVisibility(Visibility.notFocused);
  session.onStateChanged(new Listener<Session>(){
    @Override public void onEvent(    final Session session){
      updatePageState();
    }
  }
);
  manager.onOwnPresenceChanged(new Listener<Presence>(){
    @Override public void onEvent(    final Presence presence){
      updatePageState();
    }
  }
);
  updatePageState();
  model.setPageIcon(HablarIcons.get(IconType.buddyOff));
  display.getClose().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      saveData();
      requestVisibility(Visibility.notFocused);
    }
  }
);
}
Program: 2650
Project: 2650
Buggy source:
public CopyToClipboardWidget(){
  initWidget(uiBinder.createAndBindUi(this));
}

Fixed version (ground truth):
public CopyToClipboardWidget(){
  initWidget(uiBinder.createAndBindUi(this));
  accept.ensureDebugId("String_Node_Str");
  cancel.ensureDebugId("String_Node_Str");
  content.ensureDebugId("String_Node_Str");
}
Program: 2651
Project: 2651
Buggy source:
@BeforeMethod public void setupSeleniumModule(final ITestContext context){
  if (!Suco.getComponents().hasProvider(WebDriver.class)) {
    Suco.install(new SeleniumModule());
  }
  if (webtester == null) {
    webtester=Suco.get(GenericWebTester.class);
    login=Suco.get(LoginPageObject.class);
    roster=Suco.get(RosterPageObject.class);
    openChat=Suco.get(OpenChatPageObject.class);
    search=Suco.get(SearchPageObject.class);
    chat=Suco.get(ChatPageObject.class);
    editBuddy=Suco.get(EditBuddyPageObject.class);
    groupChat=Suco.get(GroupChatPageObject.class);
    userPage=Suco.get(UserPageObject.class);
    otherVCardPage=Suco.get(OtherVCardPageObject.class);
  }
  webtester.home();
}

Fixed version (ground truth):
@BeforeMethod public void setupSeleniumModule(final ITestContext context){
  if (!Suco.getComponents().hasProvider(WebDriver.class)) {
    Suco.install(new SeleniumModule());
  }
  if (webtester == null) {
    webtester=Suco.get(GenericWebTester.class);
    login=Suco.get(LoginPageObject.class);
    roster=Suco.get(RosterPageObject.class);
    openChat=Suco.get(OpenChatPageObject.class);
    search=Suco.get(SearchPageObject.class);
    chat=Suco.get(ChatPageObject.class);
    editBuddy=Suco.get(EditBuddyPageObject.class);
    groupChat=Suco.get(GroupChatPageObject.class);
    userPage=Suco.get(UserPageObject.class);
    otherVCardPage=Suco.get(OtherVCardPageObject.class);
    copyToClipboard=Suco.get(CopyToClipboardPageObject.class);
  }
  webtester.home();
}
Program: 2652
Project: 2652
Buggy source:
protected void waitFor(final WebElement element,final String text){
  System.out.println("String_Node_Str" + text);
  waitFor(text,new Runnable(){
    @Override public void run(){
      final String elText=element.getText();
      Assert.assertTrue(elText.contains(text));
    }
  }
);
}

Fixed version (ground truth):
protected void waitFor(final WebElement element,final String text){
  System.out.println("String_Node_Str" + text);
  waitFor(text,new Runnable(){
    @Override public void run(){
      final String elText=element.getText();
      System.out.println("String_Node_Str" + elText);
      Assert.assertTrue(elText.contains(text));
    }
  }
);
}
Program: 2653
Project: 2653
Buggy source:
public RosterPresenter(final HablarEventBus eventBus,final RosterDisplay display){
  super(TYPE,"String_Node_Str" + ++index,eventBus,display);
  roster=Suco.get(Roster.class);
  groupPresenters=new HashMap<String,RosterGroupPresenter>();
  active=true;
  itemMenu=new Menu<RosterItemPresenter>(display.newRosterItemMenuDisplay("String_Node_Str"));
  groupMenu=new Menu<RosterGroupPresenter>(display.newRosterGroupMenuDisplay("String_Node_Str"));
  addRosterListeners();
  addSessionListeners();
  getState().init(HablarIcons.get(IconType.roster),i18n().contacts());
  roster.onGroupAdded(new Listener<RosterGroup>(){
    @Override public void onEvent(    final RosterGroup group){
      createGroup(group);
    }
  }
);
  roster.onGroupRemoved(new Listener<RosterGroup>(){
    @Override public void onEvent(    final RosterGroup group){
      display.remove(groupPresenters.get(group.getName()));
    }
  }
);
}

Fixed version (ground truth):
public RosterPresenter(final HablarEventBus eventBus,final RosterDisplay display){
  super(TYPE,"String_Node_Str" + ++index,eventBus,display);
  roster=Suco.get(Roster.class);
  groupPresenters=new HashMap<String,RosterGroupPresenter>();
  active=true;
  itemMenu=new Menu<RosterItemPresenter>(display.newRosterItemMenuDisplay("String_Node_Str"));
  groupMenu=new Menu<RosterGroupPresenter>(display.newRosterGroupMenuDisplay("String_Node_Str"));
  addRosterListeners();
  addSessionListeners();
  getState().init(HablarIcons.get(IconType.roster),i18n().contacts());
}
Program: 2654
Project: 2654
Buggy source:
private void addRosterListeners(){
  roster.onItemAdded(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      final String message=i18n().userAdded(item.getName());
      fireMessage(message);
    }
  }
);
  roster.onItemChanged(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
    }
  }
);
  roster.onItemRemoved(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      final String message=i18n().userRemoved(item.getName());
      fireMessage(message);
    }
  }
);
  if (roster.isRosterReady()) {
    loadRoster();
  }
}

Fixed version (ground truth):
private void addRosterListeners(){
  roster.onItemAdded(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      final String message=i18n().userAdded(item.getJID().toString());
      fireMessage(message);
    }
  }
);
  roster.onItemRemoved(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      final String message=i18n().userRemoved(item.getJID().toString());
      fireMessage(message);
    }
  }
);
  roster.onGroupAdded(new Listener<RosterGroup>(){
    @Override public void onEvent(    final RosterGroup group){
      createGroup(group);
    }
  }
);
  roster.onGroupRemoved(new Listener<RosterGroup>(){
    @Override public void onEvent(    final RosterGroup group){
      display.remove(groupPresenters.get(group.getName()));
    }
  }
);
  if (roster.isRosterReady()) {
    loadRoster();
  }
}
Program: 2655
Project: 2655
Buggy source:
private void addCustomPresenceActions(){
  storedPresenceManager.get(new Listener<IQResponse>(){
    @Override public void onEvent(    final IQResponse response){
      if (response.isSuccess()) {
        final List<StoredPresence> presences=StoredPresences.parse(response).get();
        if (presences.size() > 0) {
          for (          final StoredPresence presence : presences) {
            statusMenu.addAction(createCustomAction(presence.getStatus(),null,HablarIcons.get(IconType.buddyOn),presence.getStatus(),presence.getShow()));
          }
          statusMenu.addAction(clearCustomsAction);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void addCustomPresenceActions(){
  storedPresenceManager.get(new Listener<IQResponse>(){
    @Override public void onEvent(    final IQResponse response){
      if (response.isSuccess()) {
        final List<StoredPresence> presences=StoredPresences.parse(response).get();
        if (presences.size() > 0) {
          for (          final StoredPresence presence : presences) {
            final Show show=presence.getShow();
            statusMenu.addAction(createCustomAction(presence.getStatus(),null,PresenceIcon.getIcon(true,show),presence.getStatus(),show));
          }
          statusMenu.addAction(clearCustomsAction);
        }
      }
    }
  }
);
}
Program: 2656
Project: 2656
Buggy source:
public ChatPresenter(final HablarEventBus eventBus,final Chat chat,final ChatDisplay display){
  super(TYPE,createId(chat.getURI().toString()),eventBus,display);
  this.chat=chat;
  display.setId(getId());
  final XmppURI fromURI=chat.getURI();
  userName=getName(fromURI);
  model.init(HablarIcons.get(IconType.buddyOff),userName);
  setVisibility(Visibility.notFocused);
  model.setCloseable(true);
  chat.onMessageReceived(new Listener<Message>(){
    @Override public void onEvent(    final Message message){
      final String body=ChatMessageFormatter.format(message.getBody());
      if (body != null) {
        display.showMessage(userName,body,ChatDisplay.MessageType.incoming);
        getState().setUserMessage(i18n().newChatFrom(userName,ChatMessageFormatter.ellipsis(body,25)));
      }
    }
  }
);
  chat.onStateChanged(new Listener<State>(){
    @Override public void onEvent(    final State state){
      setState(state);
    }
  }
);
  setState(chat.getState());
  display.getAction().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      sendMessage(chat,display);
    }
  }
);
  display.getTextBox().addKeyDownHandler(new KeyDownHandler(){
    @Override public void onKeyDown(    final KeyDownEvent event){
      if (event.getNativeKeyCode() == 13) {
        event.stopPropagation();
        event.preventDefault();
        sendMessage(chat,display);
      }
    }
  }
);
}

Fixed version (ground truth):
public ChatPresenter(final HablarEventBus eventBus,final Chat chat,final ChatDisplay display){
  super(TYPE,createId(chat.getURI().toString()),eventBus,display);
  this.chat=chat;
  display.setId(getId());
  final XmppURI fromURI=chat.getURI();
  userName=getName(fromURI);
  model.init(HablarIcons.get(IconType.buddyOff),userName);
  setVisibility(Visibility.notFocused);
  model.setCloseable(true);
  chat.onMessageReceived(new Listener<Message>(){
    @Override public void onEvent(    final Message message){
      final String body=ChatMessageFormatter.format(message.getBody());
      if (body != null) {
        display.showMessage(userName,body,ChatDisplay.MessageType.incoming);
        fireUserMessage(body);
      }
    }
  }
);
  chat.onStateChanged(new Listener<State>(){
    @Override public void onEvent(    final State state){
      setState(state);
    }
  }
);
  setState(chat.getState());
  display.getAction().addClickHandler(new ClickHandler(){
    @Override public void onClick(    final ClickEvent event){
      sendMessage(chat,display);
    }
  }
);
  display.getTextBox().addKeyDownHandler(new KeyDownHandler(){
    @Override public void onKeyDown(    final KeyDownEvent event){
      if (event.getNativeKeyCode() == 13) {
        event.stopPropagation();
        event.preventDefault();
        sendMessage(chat,display);
      }
    }
  }
);
}
Program: 2657
Project: 2657
Buggy source:
private void setState(final State state){
  String actionText, pageTitle, pageIcon;
  boolean actionEnabled;
  if (state == State.ready) {
    actionText=i18n().logout();
    actionEnabled=true;
    final String userName=session.getCurrentUser().getNode();
    pageTitle=i18n().connectedAs(userName);
    pageIcon=HablarIcons.get(IconType.on);
  }
 else   if (state == State.disconnected) {
    actionText=i18n().login();
    actionEnabled=true;
    pageTitle=i18n().disconnected();
    pageIcon=HablarIcons.get(IconType.off);
  }
 else {
    pageTitle=actionText=i18n().waitDots();
    actionEnabled=false;
    pageIcon=HablarIcons.get(IconType.off);
  }
  display.getActionText().setText(actionText);
  display.setActionEnabled(actionEnabled);
  display.addMessage("String_Node_Str" + state.toString());
  getState().setPageTitle(pageTitle);
  getState().setPageIcon(pageIcon);
  getState().setUserMessage("String_Node_Str" + state);
}

Fixed version (ground truth):
private void setState(final State state){
  String actionText, pageTitle, pageIcon;
  boolean actionEnabled;
  if (state == State.ready) {
    actionText=i18n().logout();
    actionEnabled=true;
    final String userName=session.getCurrentUser().getNode();
    pageTitle=i18n().connectedAs(userName);
    pageIcon=HablarIcons.get(IconType.on);
  }
 else   if (state == State.disconnected) {
    actionText=i18n().login();
    actionEnabled=true;
    pageTitle=i18n().disconnected();
    pageIcon=HablarIcons.get(IconType.off);
  }
 else {
    pageTitle=actionText=i18n().waitDots();
    actionEnabled=false;
    pageIcon=HablarIcons.get(IconType.off);
  }
  display.getActionText().setText(actionText);
  display.setActionEnabled(actionEnabled);
  display.addMessage("String_Node_Str" + state.toString());
  getState().setPageTitle(pageTitle);
  getState().setPageIcon(pageIcon);
  fireUserMessage(state);
}
Program: 2659
Project: 2659
Buggy source:
private void addRosterListeners(){
  roster.onRosterRetrieved(new Listener<Collection<RosterItem>>(){
    @Override public void onEvent(    final Collection<RosterItem> items){
      loadRoster();
    }
  }
);
  roster.onItemAdded(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      for (      final String name : item.getGroups()) {
        if (groups.get(name) == null) {
          createGroup(name);
        }
      }
      final String msg=i18n().userAdded(item.getName());
      getState().setUserMessage(msg);
    }
  }
);
  roster.onItemChanged(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      for (      final String name : item.getGroups()) {
        if (groups.get(name) == null) {
          createGroup(name);
        }
      }
    }
  }
);
  roster.onItemRemoved(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      final String msg=i18n().userRemoved(item.getName());
      getState().setUserMessage(msg);
    }
  }
);
  if (roster.isRosterReady()) {
    loadRoster();
  }
}

Fixed version (ground truth):
private void addRosterListeners(){
  roster.onRosterRetrieved(new Listener<Collection<RosterItem>>(){
    @Override public void onEvent(    final Collection<RosterItem> items){
      loadRoster();
    }
  }
);
  roster.onItemAdded(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      for (      final String name : item.getGroups()) {
        if (groups.get(name) == null) {
          createGroup(name);
        }
      }
      final String message=i18n().userAdded(item.getName());
      fireMessage(message);
    }
  }
);
  roster.onItemChanged(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      for (      final String name : item.getGroups()) {
        if (groups.get(name) == null) {
          createGroup(name);
        }
      }
    }
  }
);
  roster.onItemRemoved(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      final String message=i18n().userRemoved(item.getName());
      fireMessage(message);
    }
  }
);
  if (roster.isRosterReady()) {
    loadRoster();
  }
}
Program: 2660
Project: 2660
Buggy source:
public static HablarIcons.IconType getIconType(boolean isAvailable,Show show){
  if (show == Show.dnd) {
    return HablarIcons.IconType.buddyDnd;
  }
 else   if (show == Show.xa) {
    return HablarIcons.IconType.buddyWait;
  }
 else   if (show == Show.away) {
    return HablarIcons.IconType.buddyWait;
  }
 else   if (isAvailable) {
    return HablarIcons.IconType.buddyOn;
  }
 else {
    return HablarIcons.IconType.buddyOff;
  }
}

Fixed version (ground truth):
public static HablarIcons.IconType getIconType(final boolean isAvailable,final Show show){
  if (show == Show.dnd) {
    return HablarIcons.IconType.buddyDnd;
  }
 else   if (show == Show.xa) {
    return HablarIcons.IconType.buddyWait;
  }
 else   if (show == Show.away) {
    return HablarIcons.IconType.buddyWait;
  }
 else   if (isAvailable) {
    return HablarIcons.IconType.buddyOn;
  }
 else {
    return HablarIcons.IconType.buddyOff;
  }
}
Program: 2661
Project: 2661
Buggy source:
public static String getIcon(boolean available,Show show){
  return HablarIcons.get(getIconType(available,show));
}

Fixed version (ground truth):
public static String getIcon(final boolean available,final Show show){
  return HablarIcons.get(getIconType(available,show));
}
Program: 2662
Project: 2662
Buggy source:
public RosterGroupPresenter(final String groupName,final Menu<RosterItemPresenter> itemMenu,final RosterGroupDisplay display){
  this.groupName=groupName;
  this.itemMenu=itemMenu;
  this.display=display;
  groupLabel=isAllContacts() ? "String_Node_Str" : "String_Node_Str" + groupName;
  items=new HashMap<XmppURI,RosterItemPresenter>();
  final Roster roster=Suco.get(Roster.class);
  final Collection<RosterItem> items=isAllContacts() ? roster.getItems() : roster.getItemsByGroup(groupName);
  for (  final RosterItem item : items) {
    getPresenter(item);
  }
}

Fixed version (ground truth):
public RosterGroupPresenter(final String groupName,final Menu<RosterItemPresenter> itemMenu,final RosterGroupDisplay display){
  this.groupName=groupName;
  this.itemMenu=itemMenu;
  this.display=display;
  groupLabel=isAllContacts() ? "String_Node_Str" : "String_Node_Str" + groupName;
  items=new HashMap<XmppURI,RosterItemPresenter>();
  final Roster roster=Suco.get(Roster.class);
  final Collection<RosterItem> items=isAllContacts() ? roster.getItems() : roster.getItemsByGroup(groupName);
  for (  final RosterItem item : items) {
    getPresenter(item);
  }
  roster.onItemChanged(new Listener<RosterItem>(){
    @Override public void onEvent(    final RosterItem item){
      getPresenter(item).setItem(item);
    }
  }
);
}
Program: 2663
Project: 2663
Buggy source:
@Override public void setIcon(String iconStyle){
  if (currentStyle != null) {
    icon.removeStyleName(iconStyle);
  }
  currentStyle=iconStyle;
  icon.addStyleName(iconStyle);
}

Fixed version (ground truth):
@Override public void setIcon(final String iconStyle){
  if (currentStyle != null) {
    icon.removeStyleName(currentStyle);
  }
  currentStyle=iconStyle;
  icon.addStyleName(iconStyle);
}
Program: 2664
Project: 2664
Buggy source:
@Override public void setStatusVisible(boolean visible){
  status.setVisible(visible);
}

Fixed version (ground truth):
@Override public void setStatusVisible(final boolean visible){
  status.setVisible(visible);
}
Program: 2665
Project: 2665
Buggy source:
public void setStatusMessage(String status){
  this.status=status;
  eventBus.fireEvent(new UserMessageEvent(status,this));
  if (visibility != Visibility.focused) {
    view.getHeader().requestFocus();
  }
}

Fixed version (ground truth):
public void setStatusMessage(String status){
  this.status=status;
  hablarEventBus.fireEvent(new UserMessageEvent(status,this));
  if (visibility != Visibility.focused) {
    view.getHeader().requestFocus();
  }
}
Program: 2666
Project: 2666
Buggy source:
@Override public void onClick(ClickEvent event){
  eventBus.fireEvent(new ClosePageEvent(PageLogic.this));
}

Fixed version (ground truth):
@Override public void onClick(ClickEvent event){
  hablarEventBus.fireEvent(new ClosePageEvent(PageLogic.this));
}
Program: 2667
Project: 2667
Buggy source:
private void bind(PageHeader header){
  header.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      eventBus.fireEvent(new OpenPageEvent(PageLogic.this));
    }
  }
);
  header.getCloseIcon().addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      eventBus.fireEvent(new ClosePageEvent(PageLogic.this));
    }
  }
);
}

Fixed version (ground truth):
private void bind(PageHeader header){
  header.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      hablarEventBus.fireEvent(new OpenPageEvent(PageLogic.this));
    }
  }
);
  header.getCloseIcon().addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      hablarEventBus.fireEvent(new ClosePageEvent(PageLogic.this));
    }
  }
);
}
Program: 2668
Project: 2668
Buggy source:
public PageLogic(EventBus eventBus,PageView view,Visibility visibility){
  this.eventBus=eventBus;
  this.view=view;
  this.visibility=visibility;
  bind(view.getHeader());
}

Fixed version (ground truth):
public PageLogic(HablarEventBus hablarEventBus,PageView view,Visibility visibility){
  this.hablarEventBus=hablarEventBus;
  this.view=view;
  this.visibility=visibility;
  bind(view.getHeader());
}
Program: 2669
Project: 2669
Buggy source:
public PageWidget(EventBus eventBus,String pageType,Visibility visibility,final boolean closeable){
  this.pageType=pageType;
  this.header=new HeaderWidget(closeable);
  logic=new PageLogic(eventBus,this,visibility);
}

Fixed version (ground truth):
public PageWidget(HablarEventBus hablarEventBus,String pageType,Visibility visibility,final boolean closeable){
  this.pageType=pageType;
  this.header=new HeaderWidget(closeable);
  logic=new PageLogic(hablarEventBus,this,visibility);
}
Program: 2670
Project: 2670
Buggy source:
public PagesLogic(EventBus eventBus,PagesPanel view){
  this.eventBus=eventBus;
  this.view=view;
  this.hiddenPages=new ArrayList<PageView>();
  this.visiblePages=new ArrayList<PageView>();
  eventBus.addHandler(UserMessageEvent.TYPE,new UserMessageHandler(){
    @Override public void onUserMessage(    UserMessageEvent event){
    }
  }
);
  eventBus.addHandler(VisibilityChangedEvent.TYPE,new VisibilityChangedHandler(){
    @Override public void onVisibilityChanged(    VisibilityChangedEvent event){
      whenVisibilityChanged(event.getPage());
    }
  }
);
  eventBus.addHandler(ClosePageEvent.TYPE,new ClosePageHandler(){
    @Override public void onPageClosed(    PageLogic page){
      whenPageClosed(page);
    }
  }
);
  eventBus.addHandler(OpenPageEvent.TYPE,new OpenPageHandler(){
    @Override public void onOpenPage(    OpenPageEvent event){
      open(event.getPage().getView());
    }
  }
);
}

Fixed version (ground truth):
public PagesLogic(HablarEventBus hablarEventBus,PagesPanel view){
  this.hablarEventBus=hablarEventBus;
  this.view=view;
  this.hiddenPages=new ArrayList<PageView>();
  this.visiblePages=new ArrayList<PageView>();
  hablarEventBus.addHandler(UserMessageEvent.TYPE,new UserMessageHandler(){
    @Override public void onUserMessage(    UserMessageEvent event){
    }
  }
);
  hablarEventBus.addHandler(VisibilityChangedEvent.TYPE,new VisibilityChangedHandler(){
    @Override public void onVisibilityChanged(    VisibilityChangedEvent event){
      whenVisibilityChanged(event.getPage());
    }
  }
);
  hablarEventBus.addHandler(ClosePageEvent.TYPE,new ClosePageHandler(){
    @Override public void onPageClosed(    PageLogic page){
      whenPageClosed(page);
    }
  }
);
  hablarEventBus.addHandler(OpenPageEvent.TYPE,new OpenPageHandler(){
    @Override public void onOpenPage(    OpenPageEvent event){
      open(event.getPage().getView());
    }
  }
);
}
Program: 2671
Project: 2671
Buggy source:
/** 
 * @see Pages
 */
public void hide(PageView pageView){
  if (pageView.getVisibility() == Visibility.focused) {
    showPreviousPage();
  }
  if (currentPageView == pageView) {
    currentPageView=null;
  }
  if (previouslyVisiblePageView == pageView) {
    previouslyVisiblePageView=null;
  }
  visiblePages.remove(pageView);
  hiddenPages.add(pageView);
  pageView.setVisibility(Visibility.closed);
  view.removePageView(pageView);
  eventBus.fireEvent(new PageClosedEvent(pageView));
}

Fixed version (ground truth):
/** 
 * @see Pages
 */
public void hide(PageView pageView){
  if (pageView.getVisibility() == Visibility.focused) {
    showPreviousPage();
  }
  if (currentPageView == pageView) {
    currentPageView=null;
  }
  if (previouslyVisiblePageView == pageView) {
    previouslyVisiblePageView=null;
  }
  visiblePages.remove(pageView);
  hiddenPages.add(pageView);
  pageView.setVisibility(Visibility.closed);
  view.removePageView(pageView);
  hablarEventBus.fireEvent(new PageClosedEvent(pageView));
}
Program: 2672
Project: 2672
Buggy source:
/** 
 * @see Pages
 */
public void open(PageView pageView){
  boolean isHidden=hiddenPages.contains(pageView);
  if (view.hasPageView(pageView) || isHidden) {
    if (currentPageView != pageView) {
      this.previouslyVisiblePageView=currentPageView;
      if (currentPageView != null) {
        currentPageView.setVisibility(Visibility.notFocused);
      }
      if (isHidden) {
        unhide(pageView);
      }
      view.showPageView(pageView);
      currentPageView=pageView;
      pageView.setVisibility(Visibility.focused);
    }
    GWT.log("String_Node_Str",null);
    eventBus.fireEvent(new PageOpenedEvent(pageView));
  }
}

Fixed version (ground truth):
/** 
 * @see Pages
 */
public void open(PageView pageView){
  boolean isHidden=hiddenPages.contains(pageView);
  if (view.hasPageView(pageView) || isHidden) {
    if (currentPageView != pageView) {
      this.previouslyVisiblePageView=currentPageView;
      if (currentPageView != null) {
        currentPageView.setVisibility(Visibility.notFocused);
      }
      if (isHidden) {
        unhide(pageView);
      }
      view.showPageView(pageView);
      currentPageView=pageView;
      pageView.setVisibility(Visibility.focused);
    }
    GWT.log("String_Node_Str",null);
    hablarEventBus.fireEvent(new PageOpenedEvent(pageView));
  }
}
Program: 2673
Project: 2673
Buggy source:
public PagesWidget(EventBus eventBus,PagesPanel panel){
  logic=new PagesLogic(eventBus,panel);
  initWidget((Widget)panel);
}

Fixed version (ground truth):
public PagesWidget(HablarEventBus hablarEventBus,PagesPanel panel){
  logic=new PagesLogic(hablarEventBus,panel);
  initWidget((Widget)panel);
}
Program: 2674
Project: 2674
Buggy source:
private static void install(HablarWidget hablar,ChatConfig config){
  new ChatManagerLogic(hablar.getEventBus(),config,hablar.getPages());
}

Fixed version (ground truth):
private static void install(HablarWidget hablar,ChatConfig config){
  new ChatManagerLogic(hablar.getHablarEventBus(),config,hablar.getPages());
}
Program: 2675
Project: 2675
Buggy source:
private void createChat(Chat chat,Visibility visibility){
  ChatPageView chatPage=factory.create(chat,Visibility.notFocused,sendButtonVisible);
  chatPage.setControlsVisible(true);
  chatPages.put(chat,chatPage);
  pages.add(chatPage);
  RosterItem item=roster.getItemByJID(chat.getURI().getJID());
  Show show=item != null ? item.getShow() : Show.unknown;
  chatPage.setPresence(show);
}

Fixed version (ground truth):
private void createChat(Chat chat,Visibility visibility){
  ChatPageView chatPage=factory.create(chat,Visibility.notFocused,sendButtonVisible);
  chatPage.setControlsVisible(true);
  chatPages.put(chat.getURI(),chatPage);
  pages.add(chatPage);
  RosterItem item=roster.getItemByJID(chat.getURI().getJID());
  Show show=item != null ? item.getShow() : Show.unknown;
  GWT.log("String_Node_Str" + show,null);
  chatPage.setPresence(item.isAvailable(),show);
}
Program: 2676
Project: 2676
Buggy source:
@Override public ChatPageView create(Chat chat,Visibility visibility,boolean sendButtonVisible){
  return new ChatPageWidget(eventBus,chat,visibility,sendButtonVisible);
}

Fixed version (ground truth):
@Override public ChatPageView create(Chat chat,Visibility visibility,boolean sendButtonVisible){
  return new ChatPageWidget(hablarEventBus,chat,visibility,sendButtonVisible);
}
Program: 2677
Project: 2677
Buggy source:
public ChatManagerLogic(final EventBus eventBus,ChatConfig config,final Pages pages){
  this(config,pages,new ChatPageFactory(){
    @Override public ChatPageView create(    Chat chat,    Visibility visibility,    boolean sendButtonVisible){
      return new ChatPageWidget(eventBus,chat,visibility,sendButtonVisible);
    }
  }
);
}

Fixed version (ground truth):
public ChatManagerLogic(final HablarEventBus hablarEventBus,ChatConfig config,final Pages pages){
  this(config,pages,new ChatPageFactory(){
    @Override public ChatPageView create(    Chat chat,    Visibility visibility,    boolean sendButtonVisible){
      return new ChatPageWidget(hablarEventBus,chat,visibility,sendButtonVisible);
    }
  }
);
}
Program: 2678
Project: 2678
Buggy source:
public static String format(final String messageOrig){
  String message=messageOrig;
  message=TextUtils.escape(message);
  message=message.replaceAll("String_Node_Str","String_Node_Str");
  message=formatUrls(message);
  return message;
}

Fixed version (ground truth):
public static String format(final String message){
  if (message != null) {
    String formatted=TextUtils.escape(message);
    formatted=formatted.replaceAll("String_Node_Str","String_Node_Str");
    formatted=formatUrls(formatted);
    return formatted;
  }
 else {
    return null;
  }
}