Skip to content

Commit

Permalink
fix Gson serilization issue (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
chengw-netflix committed Aug 18, 2023
1 parent f606451 commit d6fe808
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Response cassInfo() throws JSONException {
return Response.status(503).entity("JMXConnectionException").build();
}
logger.debug("node tool info being called");
return Response.ok(nodeTool.info(), MediaType.APPLICATION_JSON).build();
return Response.ok(nodeTool.info().toString(), MediaType.APPLICATION_JSON).build();
}

@GET
Expand All @@ -139,7 +139,7 @@ public Response cassRing(@PathParam("id") String keyspace) throws JSONException
return Response.status(503).entity("JMXConnectionException").build();
}
logger.debug("node tool ring being called");
return Response.ok(nodeTool.ring(keyspace), MediaType.APPLICATION_JSON).build();
return Response.ok(nodeTool.ring(keyspace).toString(), MediaType.APPLICATION_JSON).build();
}

@GET
Expand All @@ -152,7 +152,8 @@ public Response statusInfo() throws JSONException {
return Response.status(503).entity("JMXConnectionException").build();
}
logger.debug("node tool status being called");
return Response.ok(nodeTool.statusInformation(), MediaType.APPLICATION_JSON).build();
return Response.ok(nodeTool.statusInformation().toString(), MediaType.APPLICATION_JSON)
.build();
}

@GET
Expand All @@ -163,15 +164,15 @@ public Response cassFlush() {
try {
flush.execute();
rootObj.put("Flushed", true);
return Response.ok().entity(rootObj).build();
return Response.ok().entity(rootObj.toString()).build();
} catch (Exception e) {
try {
rootObj.put("status", "ERROR");
rootObj.put("desc", e.getLocalizedMessage());
} catch (Exception e1) {
return Response.status(503).entity("FlushError").build();
}
return Response.status(503).entity(rootObj).build();
return Response.status(503).entity(rootObj.toString()).build();
}
}

Expand All @@ -183,15 +184,15 @@ public Response cassCompact() {
try {
compaction.execute();
rootObj.put("Compacted", true);
return Response.ok().entity(rootObj).build();
return Response.ok().entity(rootObj.toString()).build();
} catch (Exception e) {
try {
rootObj.put("status", "ERROR");
rootObj.put("desc", e.getLocalizedMessage());
} catch (Exception e1) {
return Response.status(503).entity("CompactionError").build();
}
return Response.status(503).entity(rootObj).build();
return Response.status(503).entity(rootObj.toString()).build();
}
}

Expand Down Expand Up @@ -237,7 +238,7 @@ public Response version() {
return Response.status(503).entity("JMXConnectionException").build();
}
return Response.ok(
new JSONArray().put(nodeTool.getReleaseVersion()),
new JSONArray().put(nodeTool.getReleaseVersion()).toString(),
MediaType.APPLICATION_JSON)
.build();
}
Expand Down Expand Up @@ -309,7 +310,8 @@ public Response statusthrift() throws JSONException {
"status",
(nodeTool.isThriftServerRunning()
? "running"
: "not running")),
: "not running"))
.toString(),
MediaType.APPLICATION_JSON)
.build();
}
Expand Down

0 comments on commit d6fe808

Please sign in to comment.