diff options
author | Vitaly Takmazov | 2017-10-06 17:01:19 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-10-06 17:03:11 +0300 |
commit | 2996fb8279645b1329b38c5c7b6d81ba3c10612e (patch) | |
tree | 56e73f9b7e116451193412ec3b60d481b444ef9a | |
parent | 9cd6679f3f2804bc0b22cfb816f40b47846080cf (diff) |
server-core: start using jsr305
server-web: getCurrentUser() is not nullable
-rw-r--r-- | juick-server-core/build.gradle | 1 | ||||
-rw-r--r-- | juick-server-web/src/main/java/com/juick/server/util/UserUtils.java | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/juick-server-core/build.gradle b/juick-server-core/build.gradle index 83a02452..fa7883ba 100644 --- a/juick-server-core/build.gradle +++ b/juick-server-core/build.gradle @@ -17,6 +17,7 @@ dependencies { compile "rocks.xmpp:xmpp-extensions-client:0.7.4" compile "javax.inject:javax.inject:1" + compile 'com.google.code.findbugs:jsr305:3.0.2' testCompile "junit:junit:${rootProject.junitVersion}" testCompile "org.hamcrest:hamcrest-all:${rootProject.hamcrestVersion}" diff --git a/juick-server-web/src/main/java/com/juick/server/util/UserUtils.java b/juick-server-web/src/main/java/com/juick/server/util/UserUtils.java index e6dc5fa2..ab5c320b 100644 --- a/juick-server-web/src/main/java/com/juick/server/util/UserUtils.java +++ b/juick-server-web/src/main/java/com/juick/server/util/UserUtils.java @@ -20,6 +20,7 @@ package com.juick.server.util; import com.juick.User; import com.juick.server.helpers.AnonymousUser; import com.juick.service.security.entities.JuickUser; +import javax.annotation.Nonnull; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; @@ -39,6 +40,7 @@ public class UserUtils { return authentication == null ? null : authentication.getPrincipal(); } + @Nonnull public static User getCurrentUser() { Object principal = getPrincipal(getAuthentication()); |