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:21:44 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master c3318467e -> ac80b8b61


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

Signed-off-by: Madhan Neethiraj <madhan@apache.org>


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

Branch: refs/heads/master
Commit: ac80b8b61b122abe57a644cbfe3868f07c301914
Parents: c331846
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:21:33 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/ac80b8b6/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/ac80b8b6/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 23203ec..f084053 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
@@ -416,7 +416,6 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         Assert.assertNotNull(response);
 
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
-        Assert.assertNotNull(response.get(AtlasClient.STACKTRACE));
     }
 
     @Test(dependsOnMethods = "testSubmitEntity")
@@ -434,7 +433,6 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY,
queryParams);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
-        Assert.assertNotNull(response.get(AtlasClient.STACKTRACE));
     }
 
 
@@ -603,7 +601,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