/**
  * This is a convenience method to add a roster item to the roster. This method does not return
  * any values because if there is an error, exception will be thrown instead. Otherwise, you can
  * assume that the request was successful. This only applies when wait is true.
  *
  * @param conn the connection that the packet will be sent through
  * @param item the roster item to add
  * @param wait true to wait for confirmation, false to return immediately
  * @throws SendPacketFailedException if packet cannot be sent or if timeout occurred while waiting
  *     for reply
  * @throws XMPPStanzaErrorException if wait is true and reply packet is an error packet, then this
  *     exception will be thrown to indicate an error.
  */
 public static final void addItem(IXMPPConnection conn, RosterItem item, boolean wait)
     throws SendPacketFailedException, XMPPStanzaErrorException {
   RosterIQPacket packet = new RosterIQPacket();
   packet.setType(IQPacket.TYPE_SET);
   packet.addItem(item);
   IQPacket reply = (IQPacket) conn.sendPacket(packet, wait);
   if (reply != null && reply.isError()) throw new XMPPStanzaErrorException(reply.getError());
 }
 /**
  * This will request the roster list from the server.
  *
  * @param conn the connection that the packet will be sent through
  * @param wait true to wait for a reply
  * @return a non-null list of roster items (may possibly be empty)
  * @throws SendPacketFailedException if packet cannot be sent or if timeout occurred while waiting
  *     for reply
  * @throws XMPPStanzaErrorException if wait is true and reply packet is an error packet, then this
  *     exception will be thrown to indicate an error.
  */
 public static final List getRosterList(IXMPPConnection conn, boolean wait)
     throws SendPacketFailedException, XMPPStanzaErrorException {
   RosterIQPacket packet = new RosterIQPacket();
   packet.setType(IQPacket.TYPE_GET);
   RosterIQPacket reply = (RosterIQPacket) conn.sendPacket(packet, wait);
   if (reply != null && reply.isError()) throw new XMPPStanzaErrorException(reply.getError());
   if (reply != null) return reply.getRosterItems();
   else return Collections.EMPTY_LIST;
 }