Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: Fashionbase/framework
...
head fork: kowalj/framework
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
6 core/json/src/main/scala/net/liftweb/json/JsonParser.scala
View
@@ -376,7 +376,11 @@ object JsonParser {
}
}
- def near = new String(segment, (cur-20) max 0, (cur + 1) min Segments.segmentSize)
+ def near = {
+ val start = (cur - 20) max 0
+ val len = ((cur + 1) min Segments.segmentSize) - start
+ new String(segment, start, len)
+ }
def release = segments.foreach(Segments.release)
22 core/json/src/test/scala/net/liftweb/json/JsonParserSpec.scala
View
@@ -25,7 +25,18 @@ import org.scalacheck.Prop._
/**
* System under specification for JSON Parser.
*/
-object JsonParserSpec extends Specification("JSON Parser Specification") with JValueGen with ScalaCheck {
+object JsonParserSpec extends Specification with JValueGen with ScalaCheck {
+
+ private def parseBadThing(): String = try {
+ parse("""{"user":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"<}""")
+ "x" * 1000
+ } catch {
+ case e: Throwable => e.getMessage
+ }
+
+
+ "JSON Parser Specification".title
+
"Any valid json can be parsed" in {
val parsing = (json: JValue) => { parse(Printer.pretty(render(json))); true }
forAll(parsing) must pass
@@ -51,6 +62,15 @@ object JsonParserSpec extends Specification("JSON Parser Specification") with JV
parse("[\"abc\\\"\\\\\\/\\b\\f\\n\\r\\t\\u00a0\"]") must_== JArray(JString("abc\"\\/\b\f\n\r\t\u00a0")::Nil)
}
+
+ "Parser does not bleed prior results" in {
+ parse("""{"a": "now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things. now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things. now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things. now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things. now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things. now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things. now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things.now is the time for all good men to come to the aid of their dog and eat dog food with other dogs and bark and woof and do dog things"}""")
+
+ val msg = parseBadThing()
+
+ msg.length must be_<=(50)
+ }
+
"Unclosed string literal fails parsing" in {
parseOpt("{\"foo\":\"sd") mustEqual None
parseOpt("{\"foo\":\"sd}") mustEqual None
2  project/build.properties
View
@@ -2,6 +2,6 @@
project.organization=net.liftweb
project.name=lift-framework
sbt.version=0.7.7
-project.version=2.4-SNAPSHOT
+project.version=2.4.1
build.scala.versions=2.8.2 2.8.1 2.8.0 2.9.1 2.9.0-1 2.9.0
project.initialize=false
2  project/plugins/Plugins.scala
View
@@ -5,6 +5,6 @@ class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
lazy val snapshots = ScalaToolsSnapshots
// Add plugin
- lazy val liftsbt = "net.liftweb" % "lift-sbt" % "2.4-SNAPSHOT"
+ lazy val liftsbt = "net.liftweb" % "lift-sbt" % "2.4"
lazy val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.2"
}

No commit comments for this range

Something went wrong with that request. Please try again.