fixed exception in UserActivityInterceptor
@@ -41,12 +41,14 @@ public class UserActivityInterceptor extends HandlerInterceptorAdapter {
@SuppressWarnings("NullableProblems") Object handler)
throws Exception {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ if (authentication != null) {
String email = authentication.getPrincipal().toString();
if (!email.equals("anonymousUser")) {
Long userId = userService.findIdByEmail(email);
Date userLastActivityTime = new Date();
userService.updateUserLastActivityTime(userId, userLastActivityTime);
}
+ }
return super.preHandle(request, response, handler);
}
}
