public void addFriendById(String userId, String name,
			FriendGroup friendGroup) {
		if (name == null && getRiotApi() != null) {
			try {
				name = getRiotApi().getName(userId);
			} catch (final IOException e) {
				e.printStackTrace();
			}
		}
		try {
			connection
					.getRoster()
					.createEntry(
							StringUtils.parseBareAddress(userId),
							name,
							new String[] { friendGroup == null ? getDefaultFriendGroup()
									.getName() : friendGroup.getName() });
		} catch (NotLoggedInException | NoResponseException
				| XMPPErrorException | NotConnectedException e) {
			e.printStackTrace();
		}
	}
public void addFriendById ( String userId , String name , FriendGroup friendGroup ) { if ( name == null && getRiotApi ( ) != null ) { try { name = getRiotApi ( ) . getName ( userId ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; } } try { connection . getRoster ( ) . createEntry ( StringUtils . parseBareAddress ( userId ) , name , new String [ ] { friendGroup == null ? getDefaultFriendGroup ( ) . getName ( ) : friendGroup . getName ( ) } ) ; } catch ( NotLoggedInException | NoResponseException | XMPPErrorException | NotConnectedException e ) { e . printStackTrace ( ) ; } }
Sends an friend request to an other user.

@param userId
The userId of the user you want to add (e.g.
sum12345678@pvp.net).
@param name
The name you want to assign to this user.
@param friendGroup
The FriendGroup you want to put this user in.