spring-attic / spring-social

Allows you to connect your applications with SaaS providers such as Facebook and Twitter.
http://projects.spring.io/spring-social
Apache License 2.0
619 stars 351 forks source link

Questionable implementation of JdbcConnectionRepository::findAllConnections() #200

Open vsavicks opened 8 years ago

vsavicks commented 8 years ago

The purpose of the code from line 77 is not clear:

if (connections.get(providerId).size() == 0) {
    connections.put(providerId, new LinkedList<Connection<?>>());
}
connections.add(providerId, connection);

Does it simply replace an immutable list from line 73? I.e.

connections.put(registeredProviderId, Collections.<Connection<?>>emptyList());

If the providerId is not registered and hence absent in collections, won't it throw an NPE? If the connection is added whose providerId not registered, isn't it a problem that a registered connection factory for it will be absent?