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
0b880eb4
Commit
0b880eb4
authored
May 27, 2015
by
Shwetha G S
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #111 from sumashivaprasad/BUG_37105
Removing double quoting of error Response
parents
5e78203d
2a436f23
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
10 deletions
+26
-10
pom.xml
pom.xml
+3
-3
pom.xml
typesystem/pom.xml
+2
-2
TypeSystemTest.java
...ache/hadoop/metadata/typesystem/types/TypeSystemTest.java
+1
-1
pom.xml
webapp/pom.xml
+5
-0
RexsterGraphResource.java
...e/hadoop/metadata/web/resources/RexsterGraphResource.java
+2
-2
Servlets.java
...in/java/org/apache/hadoop/metadata/web/util/Servlets.java
+12
-2
EntityJerseyResourceIT.java
...hadoop/metadata/web/resources/EntityJerseyResourceIT.java
+1
-0
No files found.
pom.xml
View file @
0b880eb4
...
@@ -616,9 +616,9 @@
...
@@ -616,9 +616,9 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
commons-lang
</groupId>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang
</artifactId>
<artifactId>
commons-lang
3
</artifactId>
<version>
2
.4
</version>
<version>
3
.4
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
typesystem/pom.xml
View file @
0b880eb4
...
@@ -126,8 +126,8 @@
...
@@ -126,8 +126,8 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
commons-lang
</groupId>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang
</artifactId>
<artifactId>
commons-lang
3
</artifactId>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
typesystem/src/test/java/org/apache/hadoop/metadata/typesystem/types/TypeSystemTest.java
View file @
0b880eb4
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
org
.
apache
.
hadoop
.
metadata
.
typesystem
.
types
;
package
org
.
apache
.
hadoop
.
metadata
.
typesystem
.
types
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.commons.lang.RandomStringUtils
;
import
org.apache.commons.lang
3
.RandomStringUtils
;
import
org.apache.hadoop.metadata.typesystem.types.utils.TypesUtil
;
import
org.apache.hadoop.metadata.typesystem.types.utils.TypesUtil
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.AfterMethod
;
...
...
webapp/pom.xml
View file @
0b880eb4
...
@@ -104,6 +104,11 @@
...
@@ -104,6 +104,11 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
</dependency>
<dependency>
<groupId>
com.tinkerpop.blueprints
</groupId>
<groupId>
com.tinkerpop.blueprints
</groupId>
<artifactId>
blueprints-core
</artifactId>
<artifactId>
blueprints-core
</artifactId>
</dependency>
</dependency>
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/RexsterGraphResource.java
View file @
0b880eb4
...
@@ -298,7 +298,7 @@ public class RexsterGraphResource {
...
@@ -298,7 +298,7 @@ public class RexsterGraphResource {
String
message
=
"Edge with ["
+
edgeId
+
"] cannot be found."
;
String
message
=
"Edge with ["
+
edgeId
+
"] cannot be found."
;
LOG
.
info
(
message
);
LOG
.
info
(
message
);
throw
new
WebApplicationException
(
Response
.
status
(
Response
.
Status
.
NOT_FOUND
)
throw
new
WebApplicationException
(
Response
.
status
(
Response
.
Status
.
NOT_FOUND
)
.
entity
(
JSONObject
.
quote
(
message
)).
build
());
.
entity
(
Servlets
.
escapeJsonString
(
message
)).
build
());
}
}
JSONObject
response
=
new
JSONObject
();
JSONObject
response
=
new
JSONObject
();
...
@@ -389,7 +389,7 @@ public class RexsterGraphResource {
...
@@ -389,7 +389,7 @@ public class RexsterGraphResource {
countOnly
=
false
;
countOnly
=
false
;
}
else
{
}
else
{
throw
new
WebApplicationException
(
Response
.
status
(
Response
.
Status
.
BAD_REQUEST
)
throw
new
WebApplicationException
(
Response
.
status
(
Response
.
Status
.
BAD_REQUEST
)
.
entity
(
JSONObject
.
quote
(
directionSegment
+
" segment was invalid."
))
.
entity
(
Servlets
.
escapeJsonString
(
directionSegment
+
" segment was invalid."
))
.
build
());
.
build
());
}
}
}
}
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/util/Servlets.java
View file @
0b880eb4
...
@@ -18,9 +18,12 @@
...
@@ -18,9 +18,12 @@
package
org
.
apache
.
hadoop
.
metadata
.
web
.
util
;
package
org
.
apache
.
hadoop
.
metadata
.
web
.
util
;
import
com.google.common.base.Preconditions
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang3.StringEscapeUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.hadoop.metadata.MetadataServiceClient
;
import
org.apache.hadoop.metadata.MetadataServiceClient
;
import
org.apache.hadoop.metadata.ParamChecker
;
import
org.codehaus.jettison.json.JSONException
;
import
org.codehaus.jettison.json.JSONException
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.codehaus.jettison.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -38,6 +41,8 @@ import java.io.StringWriter;
...
@@ -38,6 +41,8 @@ import java.io.StringWriter;
*/
*/
public
final
class
Servlets
{
public
final
class
Servlets
{
public
static
final
String
QUOTE
=
"\""
;
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
Servlets
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
Servlets
.
class
);
private
Servlets
()
{
private
Servlets
()
{
/* singleton */
/* singleton */
...
@@ -117,7 +122,7 @@ public final class Servlets {
...
@@ -117,7 +122,7 @@ public final class Servlets {
public
static
Response
getErrorResponse
(
String
message
,
Response
.
Status
status
)
{
public
static
Response
getErrorResponse
(
String
message
,
Response
.
Status
status
)
{
JSONObject
errorJson
=
new
JSONObject
();
JSONObject
errorJson
=
new
JSONObject
();
Object
errorEntity
=
JSONObject
.
quote
(
message
);
Object
errorEntity
=
Servlets
.
escapeJsonString
(
message
);
try
{
try
{
errorJson
.
put
(
MetadataServiceClient
.
ERROR
,
errorEntity
);
errorJson
.
put
(
MetadataServiceClient
.
ERROR
,
errorEntity
);
errorEntity
=
errorJson
;
errorEntity
=
errorJson
;
...
@@ -140,4 +145,9 @@ public final class Servlets {
...
@@ -140,4 +145,9 @@ public final class Servlets {
public
static
String
getRequestId
()
{
public
static
String
getRequestId
()
{
return
Thread
.
currentThread
().
getName
();
return
Thread
.
currentThread
().
getName
();
}
}
public
static
String
escapeJsonString
(
String
inputStr
)
{
ParamChecker
.
notNull
(
inputStr
,
"Input String cannot be null"
);
return
StringEscapeUtils
.
escapeJson
(
inputStr
);
}
}
}
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/EntityJerseyResourceIT.java
View file @
0b880eb4
...
@@ -395,6 +395,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -395,6 +395,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
JSONObject
response
=
new
JSONObject
(
responseAsString
);
JSONObject
response
=
new
JSONObject
(
responseAsString
);
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
ERROR
));
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
ERROR
));
Assert
.
assertEquals
(
response
.
getString
(
MetadataServiceClient
.
ERROR
),
"trait="
+
traitName
+
" should be defined in type system before it can be deleted"
);
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
STACKTRACE
));
Assert
.
assertNotNull
(
response
.
get
(
MetadataServiceClient
.
STACKTRACE
));
}
}
...
...
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