aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/DeviceServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/web/DeviceServlet.java')
-rw-r--r--src/org/traccar/web/DeviceServlet.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/org/traccar/web/DeviceServlet.java b/src/org/traccar/web/DeviceServlet.java
index 8f983ad78..a501bd8f6 100644
--- a/src/org/traccar/web/DeviceServlet.java
+++ b/src/org/traccar/web/DeviceServlet.java
@@ -70,7 +70,7 @@ public class DeviceServlet extends BaseServlet {
}
private void add(HttpServletRequest req, HttpServletResponse resp) throws Exception {
- Device device = JsonConverter.objectFromJson(req.getReader(), new Device());
+ Device device = JsonConverter.objectFromJson(req.getReader(), Device.class);
long userId = getUserId(req);
Context.getDataManager().addDevice(device);
Context.getDataManager().linkDevice(userId, device.getId());
@@ -79,14 +79,14 @@ public class DeviceServlet extends BaseServlet {
}
private void update(HttpServletRequest req, HttpServletResponse resp) throws Exception {
- Device device = JsonConverter.objectFromJson(req.getReader(), new Device());
+ Device device = JsonConverter.objectFromJson(req.getReader(), Device.class);
Context.getPermissionsManager().checkDevice(getUserId(req), device.getId());
Context.getDataManager().updateDevice(device);
sendResponse(resp.getWriter(), true);
}
private void remove(HttpServletRequest req, HttpServletResponse resp) throws Exception {
- Device device = JsonConverter.objectFromJson(req.getReader(), new Device());
+ Device device = JsonConverter.objectFromJson(req.getReader(), Device.class);
Context.getPermissionsManager().checkDevice(getUserId(req), device.getId());
Context.getDataManager().removeDevice(device);
Context.getPermissionsManager().refresh();