JsonObjectParser escape sequence processing fix #23292

This commit is contained in:
Den Kovalevsky 2017-07-05 12:11:17 +03:00 committed by Johan Andrén
parent c3e9e2839a
commit bf8bbd2807
2 changed files with 16 additions and 1 deletions

View file

@ -297,6 +297,21 @@ class JsonFramingSpec extends AkkaSpec {
| "key": "\""
| }""".stripMargin
}
"successfully parse a string that contains escape sequence" in {
val buffer = new JsonObjectParser()
buffer.offer(ByteString(
"""
|{
| "key": "\\\""
| }
| """.stripMargin
))
buffer.poll().get.utf8String shouldBe """{
| "key": "\\\""
| }""".stripMargin
}
}
"has nested array" should {

View file

@ -120,7 +120,7 @@ import scala.annotation.switch
pos += 1
trimFront += 1
} else if (input == Backslash) {
if (lastInput == Backslash) isStartOfEscapeSequence = false
if (lastInput == Backslash & isStartOfEscapeSequence) isStartOfEscapeSequence = false
else isStartOfEscapeSequence = true
pos += 1
} else if (input == DoubleQuote) {