From 50c7066f88039df0ecb556361734c12bdd548146 Mon Sep 17 00:00:00 2001 From: jendib Date: Tue, 8 Sep 2015 22:25:30 +0200 Subject: [PATCH] user agent and ip are nullable --- .../java/com/sismics/docs/rest/resource/UserResource.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/UserResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/UserResource.java index 501a4e9b..b1fe41eb 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/UserResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/UserResource.java @@ -40,6 +40,7 @@ import com.sismics.docs.rest.constant.BaseFunction; import com.sismics.rest.exception.ClientException; import com.sismics.rest.exception.ForbiddenClientException; import com.sismics.rest.exception.ServerException; +import com.sismics.rest.util.JsonUtil; import com.sismics.rest.util.ValidationUtil; import com.sismics.security.UserPrincipal; import com.sismics.util.filter.TokenBasedSecurityFilter; @@ -513,8 +514,8 @@ public class UserResource extends BaseResource { for (AuthenticationToken authenticationToken : authenticationTokenDao.getByUserId(principal.getId())) { JsonObjectBuilder session = Json.createObjectBuilder() .add("create_date", authenticationToken.getCreationDate().getTime()) - .add("ip", authenticationToken.getIp()) - .add("user_agent", authenticationToken.getUserAgent()); + .add("ip", JsonUtil.nullable(authenticationToken.getIp())) + .add("user_agent", JsonUtil.nullable(authenticationToken.getUserAgent())); if (authenticationToken.getLastConnectionDate() != null) { session.add("last_connection_date", authenticationToken.getLastConnectionDate().getTime()); }