From 9bcc4c7f4871b2b028d2bc2a8680ba14b2607eb6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 20 Dec 2015 22:01:32 +1300 Subject: Fix some REST API minor issues --- src/org/traccar/api/BaseResource.java | 10 +++++----- src/org/traccar/model/Command.java | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/api/BaseResource.java b/src/org/traccar/api/BaseResource.java index 368df7166..aa1101f02 100644 --- a/src/org/traccar/api/BaseResource.java +++ b/src/org/traccar/api/BaseResource.java @@ -22,12 +22,12 @@ public class BaseResource { @javax.ws.rs.core.Context private SecurityContext securityContext; - protected SecurityContext getSecurityContext() { - return securityContext; - } - protected long getUserId() { - return ((UserPrincipal) securityContext.getUserPrincipal()).getUserId(); + UserPrincipal principal = (UserPrincipal) securityContext.getUserPrincipal(); + if (principal != null) { + return principal.getUserId(); + } + return 0; } } diff --git a/src/org/traccar/model/Command.java b/src/org/traccar/model/Command.java index df62164c2..bc99967b6 100644 --- a/src/org/traccar/model/Command.java +++ b/src/org/traccar/model/Command.java @@ -15,6 +15,9 @@ */ package org.traccar.model; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown=true) public class Command extends Extensible { public static final String TYPE_POSITION_SINGLE = "positionSingle"; -- cgit v1.2.3