Repository: incubator-s2graph Updated Branches: refs/heads/master 44c319fa7 -> 36d5485bd
[S2GRAPH-19]: When query with duration error. throw BadQueryException when from > to on duration. JIRA: [S2GRAPH-19] https://issues.apache.org/jira/browse/S2GRAPH-19 Pull Request: Closes #32 Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/36d5485b Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/36d5485b Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/36d5485b Branch: refs/heads/master Commit: 36d5485bd91b57660e48a29b83110067ab24abfd Parents: 44c319f Author: DO YUNG YOON <[email protected]> Authored: Mon Feb 29 12:20:56 2016 +0900 Committer: DO YUNG YOON <[email protected]> Committed: Mon Feb 29 12:20:56 2016 +0900 ---------------------------------------------------------------------- CHANGES | 2 ++ .../main/scala/com/kakao/s2graph/core/rest/RequestParser.scala | 4 ++++ 2 files changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/36d5485b/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 888157c..1512043 100644 --- a/CHANGES +++ b/CHANGES @@ -54,6 +54,8 @@ Release 0.12.1 - unreleased S2GRAPH-43: Bug on offset when Interval is given on query (Committed by DOYUNG YOON). + S2GRAPH-19: When query with duration error (Committed by DOYUNG YOON). + TASKS S2GRAPH-2: Update document and quick start environment to have recent set-up command changes. http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/36d5485b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala index a87e9d1..2449082 100644 --- a/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala +++ b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala @@ -126,6 +126,10 @@ class RequestParser(config: Config) extends JSONParser { val minTs = parse[Option[Long]](js, "from").getOrElse(Long.MaxValue) val maxTs = parse[Option[Long]](js, "to").getOrElse(Long.MinValue) + if (minTs > maxTs) { + throw new BadQueryException("Duration error. Timestamp of From cannot be larger than To.") + } + (minTs, maxTs) } }
