atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1424 : Avoid stack-trace in REST API error response
Date Tue, 03 Jan 2017 17:22:35 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/0.7-incubating 340e1a5ff -> 0dcfd21bb


ATLAS-1424 : Avoid stack-trace in REST API error response

Signed-off-by: Madhan Neethiraj <madhan@apache.org>
(cherry picked from commit ac80b8b61b122abe57a644cbfe3868f07c301914)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/0dcfd21b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/0dcfd21b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/0dcfd21b

Branch: refs/heads/0.7-incubating
Commit: 0dcfd21bbfaac6f037f46b7aaaab0e5546fd2a78
Parents: 340e1a5
Author: nixonrodrigues <nixon.rodrigues@freestoneinfotech.com>
Authored: Tue Jan 3 19:12:22 2017 +0530
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Tue Jan 3 09:22:18 2017 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/atlas/web/util/Servlets.java  | 13 +------------
 .../atlas/web/resources/EntityJerseyResourceIT.java    |  3 ---
 2 files changed, 1 insertion(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/0dcfd21b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
index b4f0839..52dd9b5 100755
--- a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
+++ b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
@@ -133,19 +133,8 @@ public final class Servlets {
     public static Response getErrorResponse(Throwable e, Response.Status status) {
         String message = e.getMessage() == null ? "Failed with " + e.getClass().getName()
: e.getMessage();
         Response response = getErrorResponse(message, status);
-        JSONObject responseJson = (JSONObject) response.getEntity();
-        try {
-            responseJson.put(AtlasClient.STACKTRACE, printStackTrace(e));
-        } catch (JSONException e1) {
-            LOG.warn("Could not construct error Json rensponse", e1);
-        }
-        return response;
-    }
 
-    private static String printStackTrace(Throwable t) {
-        StringWriter sw = new StringWriter();
-        t.printStackTrace(new PrintWriter(sw));
-        return sw.toString();
+        return response;
     }
 
     public static Response getErrorResponse(String message, Response.Status status) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/0dcfd21b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
index ea86cc6..55569d4 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
@@ -423,7 +423,6 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         JSONObject response = new JSONObject(responseAsString);
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
-        Assert.assertNotNull(response.get(AtlasClient.STACKTRACE));
     }
 
     @Test(dependsOnMethods = "testSubmitEntity")
@@ -445,7 +444,6 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         JSONObject response = new JSONObject(responseAsString);
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
-        Assert.assertNotNull(response.get(AtlasClient.STACKTRACE));
     }
 
 
@@ -671,7 +669,6 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
         Assert.assertEquals(response.getString(AtlasClient.ERROR),
                 "trait=" + traitName + " should be defined in type system before it can be
deleted");
-        Assert.assertNotNull(response.get(AtlasClient.STACKTRACE));
     }
 
     @Test(dependsOnMethods = "testSubmitEntity()")


Mime
View raw message