diff options
author | Mathias <mathias@spray.io> | 2015-05-06 12:34:01 +0200 |
---|---|---|
committer | Mathias <mathias@spray.io> | 2015-05-06 12:41:50 +0200 |
commit | 629c6ef4b4e795b900d5d870fd5cb282d538f70a (patch) | |
tree | c94b86cc419dab525b6156fe4d6bf45a26a1d001 /src/main | |
parent | 5843587ac6472c067aa08347d43f68b78857b053 (diff) | |
download | spray-json-629c6ef4b4e795b900d5d870fd5cb282d538f70a.tar.gz spray-json-629c6ef4b4e795b900d5d870fd5cb282d538f70a.tar.bz2 spray-json-629c6ef4b4e795b900d5d870fd5cb282d538f70a.zip |
Make JsonParser require complete consumption of parsing input, closes #137
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/scala/spray/json/JsonParser.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/scala/spray/json/JsonParser.scala b/src/main/scala/spray/json/JsonParser.scala index bed8dbd..855ab21 100644 --- a/src/main/scala/spray/json/JsonParser.scala +++ b/src/main/scala/spray/json/JsonParser.scala @@ -41,6 +41,7 @@ class JsonParser(input: ParserInput) { def parseJsValue(): JsValue = { ws() `value`() + require(EOI) jsValue } @@ -202,7 +203,8 @@ class JsonParser(input: ParserInput) { val c = if (Character.isISOControl(errorChar)) "\\u%04x" format errorChar.toInt else errorChar.toString s"character '$c'" } else "end-of-input" - s"Unexpected $unexpected at input index $cursor (line $lineNr, position $col), expected $target" + val expected = if (target != "'\uFFFF'") target else "end-of-input" + s"Unexpected $unexpected at input index $cursor (line $lineNr, position $col), expected $expected" } val detail = { val sanitizedText = text.map(c ⇒ if (Character.isISOControl(c)) '?' else c) |