public synchronized void setName(String name) throws NotConnectedException, NoResponseException, XMPPErrorException, InterruptedException {
        // Do nothing if the name hasn't changed.
        if (name != null && name.equals(getName())) {
            return;
        }

        RosterPacket packet = new RosterPacket();
        packet.setType(IQ.Type.set);

        // Create a new roster item with the current RosterEntry and the *new* name. Note that we can't set the name of
        // RosterEntry right away, as otherwise the updated event wont get fired, because equalsDeep would return true.
        packet.addRosterItem(toRosterItem(this, name));
        connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();

        // We have received a result response to the IQ set, the name was successfully changed
        item.setName(name);
    }
public synchronized void setName ( String name ) throws NotConnectedException , NoResponseException , XMPPErrorException , InterruptedException { if ( name != null && name . equals ( getName ( ) ) ) { return ; } RosterPacket packet = new RosterPacket ( ) ; packet . setType ( IQ . Type . set ) ; packet . addRosterItem ( toRosterItem ( this , name ) ) ; connection ( ) . createStanzaCollectorAndSend ( packet ) . nextResultOrThrow ( ) ; item . setName ( name ) ; }
Sets the name associated with this entry.

@param name the name.
@throws NotConnectedException
@throws XMPPErrorException
@throws NoResponseException
@throws InterruptedException