Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EA0BA200BF1 for ; Tue, 3 Jan 2017 18:21:48 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E892D160B43; Tue, 3 Jan 2017 17:21:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 39EEF160B20 for ; Tue, 3 Jan 2017 18:21:48 +0100 (CET) Received: (qmail 1404 invoked by uid 500); 3 Jan 2017 17:21:47 -0000 Mailing-List: contact commits-help@atlas.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.incubator.apache.org Delivered-To: mailing list commits@atlas.incubator.apache.org Received: (qmail 1389 invoked by uid 99); 3 Jan 2017 17:21:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jan 2017 17:21:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D840C1A01A1 for ; Tue, 3 Jan 2017 17:21:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.218 X-Spam-Level: X-Spam-Status: No, score=-6.218 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id S9uYIYKzP0hB for ; Tue, 3 Jan 2017 17:21:45 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 472AD5F3BD for ; Tue, 3 Jan 2017 17:21:45 +0000 (UTC) Received: (qmail 1374 invoked by uid 99); 3 Jan 2017 17:21:44 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jan 2017 17:21:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4367ADFBE6; Tue, 3 Jan 2017 17:21:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: madhan@apache.org To: commits@atlas.incubator.apache.org Message-Id: <781d908e91794ef1b32e366a6d546263@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-atlas git commit: ATLAS-1424 : Avoid stack-trace in REST API error response Date: Tue, 3 Jan 2017 17:21:44 +0000 (UTC) archived-at: Tue, 03 Jan 2017 17:21:49 -0000 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 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 Authored: Tue Jan 3 19:12:22 2017 +0530 Committer: Madhan Neethiraj 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")