Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
ac80b8b6
Commit
ac80b8b6
authored
8 years ago
by
nixonrodrigues
Committed by
Madhan Neethiraj
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1424 : Avoid stack-trace in REST API error response
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
c3318467
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
15 deletions
+1
-15
Servlets.java
webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
+1
-12
EntityJerseyResourceIT.java
...rg/apache/atlas/web/resources/EntityJerseyResourceIT.java
+0
-3
No files found.
webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
View file @
ac80b8b6
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
View file @
ac80b8b6
...
...
@@ -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"
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment