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

Incorrect JavaDoc of "ConnectionRepository::findAllConnections" method

petrdvorak opened this issue · comments

Currently, the JavaDoc in ConnectionRepository::findAllConnections() method says following:

" Returns an empty map if the user has no connections.

This information seems to be misleading - it suggests that no keys are present in the returned map. According to my testing though, this method returns map with keys representing all registered providers and empty lists as values in case the user has no connection with the provider.

Here is my sample code:

ConnectionRepository repository = userConnectionRepository.createConnectionRepository(userId);
MultiValueMap<String, Connection<?>> connections = repository.findAllConnections();

for (String provider : connections.keySet()) {
    if (!connections.get(provider).isEmpty()) { // <= this works as expected and skips the provider with no connection
        Connection<?> c = connections.getFirst(provider);
        Service s = new Service();
        s.setName(provider);
        s.setConnectionDisplayName(c.getDisplayName());
        resultList.add(s);
    }
}

It would be nice to fix the docs to be more precise.