Commit ac80b8b6 by nixonrodrigues Committed by Madhan Neethiraj

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

parent c3318467
......@@ -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) {
......
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment