Program: 1607
Project: 1607
Buggy source:
public RosterOldImpl(final Session session){
  GWT.log("String_Node_Str");
  this.session=session;
  session.onStateChanged(new Listener<Session>(){
    @Override public void onEvent(    final Session session){
      if (session.getState() == Session.State.loggedIn) {
        requestRoster(session.getCurrentUser());
      }
    }
  }
);
  session.onPresence(new Listener<Presence>(){
    @Override public void onEvent(    final Presence presence){
      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());
      fireItemChanged(item);
    }
  }
);
  session.onIQ(new Listener<IQ>(){
    @Override public void onEvent(    final IQ iq){
      if (iq.isType(IQ.Type.set)) {
        final IPacket query=iq.getFirstChild(ROSTER_QUERY_FILTER);
        if (query != null) {
          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 RosterOldImpl(final Session session){
  GWT.log("String_Node_Str");
  this.session=session;
  session.onStateChanged(new Listener<Session>(){
    @Override public void onEvent(    final Session session){
      if (session.getState() == Session.State.loggedIn) {
        requestRoster(session.getCurrentUser());
      }
    }
  }
);
  session.onPresence(new Listener<Presence>(){
    @Override public void onEvent(    final Presence presence){
      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());
      fireItemChanged(item);
    }
  }
);
  session.onIQ(new Listener<IQ>(){
    @Override public void onEvent(    final IQ iq){
      if (iq.isType(IQ.Type.set)) {
        final IPacket query=iq.getFirstChild(ROSTER_QUERY_FILTER);
        if (query != null) {
          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()));
      }
    }
  }
);
}