fix json parse error
Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/b31f3d31 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/b31f3d31 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/b31f3d31 Branch: refs/heads/master Commit: b31f3d3123ba3b164e02d4eeb4f0f06adf1cf9d4 Parents: 0abb56a Author: sandyskies <[email protected]> Authored: Thu Mar 22 00:47:59 2018 +0800 Committer: sandyskies <[email protected]> Committed: Thu Mar 22 00:47:59 2018 +0800 ---------------------------------------------------------------------- .../scala/org/apache/s2graph/core/rest/RequestParser.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/b31f3d31/s2core/src/main/scala/org/apache/s2graph/core/rest/RequestParser.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/rest/RequestParser.scala b/s2core/src/main/scala/org/apache/s2graph/core/rest/RequestParser.scala index 304cb82..2f6f67a 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/rest/RequestParser.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/rest/RequestParser.scala @@ -582,7 +582,13 @@ class RequestParser(graph: S2GraphLike) { } def toVertex(jsValue: JsValue, operation: String, serviceName: Option[String] = None, columnName: Option[String] = None): S2VertexLike = { - val id = parse[String](jsValue, "id") + var id:String = "" + try { + id = parse[String](jsValue, "id") + } catch { + case e:Exception=> + id = parse[JsValue](jsValue, "id").toString + } val ts = parseOption[Long](jsValue, "timestamp").getOrElse(System.currentTimeMillis()) val sName = if (serviceName.isEmpty) parse[String](jsValue, "serviceName") else serviceName.get val cName = if (columnName.isEmpty) parse[String](jsValue, "columnName") else columnName.get
