diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-22 11:34:40 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-22 11:34:40 +1200 |
commit | 7387155d9d9fdaefb260e94b1094fa5ed285fdb3 (patch) | |
tree | d7239e77ea867a78e9b11c6b37687b5e451bc5c3 /src/org/traccar | |
parent | 24c7705d7fa5aa7393dc7def4d9cd6c16ad8fc8d (diff) | |
download | trackermap-server-7387155d9d9fdaefb260e94b1094fa5ed285fdb3.tar.gz trackermap-server-7387155d9d9fdaefb260e94b1094fa5ed285fdb3.tar.bz2 trackermap-server-7387155d9d9fdaefb260e94b1094fa5ed285fdb3.zip |
Show more detailed error messages
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/helper/Log.java | 2 | ||||
-rw-r--r-- | src/org/traccar/web/BaseServlet.java | 14 |
2 files changed, 4 insertions, 12 deletions
diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java index d5d5a6cda..d328fbea7 100644 --- a/src/org/traccar/helper/Log.java +++ b/src/org/traccar/helper/Log.java @@ -172,7 +172,7 @@ public class Log { s.append("*:"); } else { file = element.getFileName(); - s.append(file).append(":"); + s.append(file.substring(0, file.length() - 5)).append(":"); count -= 1; } s.append(element.getLineNumber()); diff --git a/src/org/traccar/web/BaseServlet.java b/src/org/traccar/web/BaseServlet.java index b7df841ca..972a1b8e7 100644 --- a/src/org/traccar/web/BaseServlet.java +++ b/src/org/traccar/web/BaseServlet.java @@ -15,6 +15,8 @@ */ package org.traccar.web; +import org.traccar.helper.Log; + import java.io.IOException; import java.io.Writer; import java.security.AccessControlException; @@ -57,12 +59,6 @@ public abstract class BaseServlet extends HttpServlet { return userId; } - public void securityCheck(boolean check) throws SecurityException { - if (!check) { - throw new SecurityException("Access denied"); - } - } - public void sendResponse(Writer writer, boolean success) throws IOException { JsonObjectBuilder result = Json.createObjectBuilder(); result.add("success", success); @@ -79,11 +75,7 @@ public abstract class BaseServlet extends HttpServlet { public void sendResponse(Writer writer, Exception error) throws IOException { JsonObjectBuilder result = Json.createObjectBuilder(); result.add("success", false); - if (error.getMessage() != null) { - result.add("error", error.getMessage()); - } else { - result.add("error", error.getClass().getSimpleName()); - } + result.add("error", Log.exceptionStack(error)); writer.write(result.build().toString()); } |