spring-attic / spring-social

Allows you to connect your applications with SaaS providers such as Facebook and Twitter.

Home Page:http://projects.spring.io/spring-social

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArrayIndexOutOfBoundsException in UserProfileBuilder when name is empty String

arminrosu opened this issue · comments

Summary

UserProfileBuilder throws an error when trying to create a profile with an empty string "" as a name.

Actual Behavior

java.lang.ArrayIndexOutOfBoundsException: 0

This error is caused by this line.

Expected Behavior

It should return a profile with an empty firstName and empty lastName, as it does when setting the name to null.

Configuration

Default

Version

Latest

Sample

UserProfile user = new UserProfileBuilder().setName("");
UserProfile user = UserProfileBuilder().setName(facebook.userOperations().getUserProfile().getName());

@arminrosu your bug doesn't reproduce. The code works as expected without any exceptions:

@Test
public void shouldReturnEmptyUserName() {
	UserProfileBuilder userProfileBuilder = new UserProfileBuilder().setName("");
	UserProfile user = userProfileBuilder.build();
	assertEquals("", user.getFirstName());
	assertNull(user.getLastName());
}

That seems right. Wondering how the error appeared. Closing for now as it seems to not apply. Thanks @AndriyBrez