Upgrade to Java 8 source and target baseline

This commit is contained in:
John Blum
2017-04-21 23:19:01 -07:00
parent 887f024551
commit 83e5d6f2a7
3 changed files with 14 additions and 10 deletions

View File

@@ -68,6 +68,10 @@ public class UserRepositoryUserDetailsService implements UserDetailsService {
return AuthorityUtils.createAuthorityList("ROLE_USER");
}
public String getName() {
return getUsername();
}
public String getUsername() {
return getEmail();
}

View File

@@ -17,6 +17,8 @@
package sample.websocket;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
import sample.data.ActiveWebSocketUser;
import sample.data.ActiveWebSocketUserRepository;
@@ -42,14 +44,11 @@ public class WebSocketDisconnectHandler<S>
if (id == null) {
return;
}
ActiveWebSocketUser user = this.repository.findOne(id);
if (user == null) {
return;
Optional<ActiveWebSocketUser> user = this.repository.findOne(id);
if (user.isPresent()) {
this.repository.delete(id);
this.messagingTemplate.convertAndSend("/topic/friends/signout",
Collections.singleton(user.map(ActiveWebSocketUser::getUsername)));
}
this.repository.delete(id);
this.messagingTemplate.convertAndSend("/topic/friends/signout",
Arrays.asList(user.getUsername()));
}
}