Program: 1610
Project: 1610
Buggy source:
public XmppRosterLogic(final XmppSession session){
  super(session);
  session.addSessionStateChangedHandler(true,new StateChangedHandler(){
    @Override public void onStateChanged(    StateChangedEvent event){
      if (event.is(SessionStates.loggedIn)) {
        reRequestRoster();
      }
    }
  }
);
  session.addPresenceReceivedHandler(new PresenceHandler(){
    @Override public void onPresence(    PresenceEvent event){
      Presence presence=event.getPresence();
      final RosterItem item=getItemByJID(presence.getFrom());
      if (item != null) {
        setPresence(presence,item);
      }
    }
    private void setPresence(    final Presence presence,    final RosterItem item){
      final Presence.Type type=presence.getType();
      if (type == Presence.Type.unavailable) {
        item.setAvailable(false);
      }
 else {
        item.setAvailable(true);
      }
      final Show showReceived=presence.getShow();
      item.setShow(showReceived == null ? Show.notSpecified : showReceived);
      item.setStatus(presence.getStatus());
      eventBus.fireEvent(new RosterItemChangedEvent(ChangeTypes.modified,item));
    }
  }
);
  session.addIQReceivedHandler(new IQHandler(){
    @Override public void onPacket(    IQEvent event){
      IQ iq=event.getIQ();
      if (iq.isType(IQ.Type.set)) {
        final IPacket query=iq.getFirstChild(ROSTER_QUERY_FILTER);
        if (query != NoPacket.INSTANCE) {
          for (          final IPacket child : query.getChildren()) {
            handleItemChanged(RosterItem.parse(child));
          }
        }
        session.send(new IQ(Type.result).With("String_Node_Str",iq.getFromAsString()).With("String_Node_Str",iq.getId()));
      }
    }
  }
);
}

Fixed version (ground truth):
public XmppRosterLogic(final XmppSession session){
  super(session);
  session.addSessionStateChangedHandler(true,new StateChangedHandler(){
    @Override public void onStateChanged(    StateChangedEvent event){
      if (event.is(SessionStates.loggedIn)) {
        reRequestRoster();
      }
    }
  }
);
  session.addPresenceReceivedHandler(new PresenceHandler(){
    @Override public void onPresence(    PresenceEvent event){
      Presence presence=event.getPresence();
      final RosterItem item=getItemByJID(presence.getFrom());
      if (item != null) {
        setPresence(presence,item);
      }
    }
    private void setPresence(    final Presence presence,    final RosterItem item){
      final Presence.Type type=presence.getType();
      final String resource=presence.getFrom().getResource();
      if (type == Presence.Type.unavailable) {
        item.setAvailable(false,resource);
      }
 else {
        item.setAvailable(true,resource);
      }
      final Show showReceived=presence.getShow();
      item.setShow(showReceived == null ? Show.notSpecified : showReceived);
      item.setStatus(presence.getStatus());
      eventBus.fireEvent(new RosterItemChangedEvent(ChangeTypes.modified,item));
    }
  }
);
  session.addIQReceivedHandler(new IQHandler(){
    @Override public void onPacket(    IQEvent event){
      IQ iq=event.getIQ();
      if (iq.isType(IQ.Type.set)) {
        final IPacket query=iq.getFirstChild(ROSTER_QUERY_FILTER);
        if (query != NoPacket.INSTANCE) {
          for (          final IPacket child : query.getChildren()) {
            handleItemChanged(RosterItem.parse(child));
          }
        }
        session.send(new IQ(Type.result).With("String_Node_Str",iq.getFromAsString()).With("String_Node_Str",iq.getId()));
      }
    }
  }
);
}