playframework/playframework — pull request #1356 by jroper (2013-07-26 04:45:29+00:00)
Title: NullPointerException when using parse.maxLength

When using parse.maxLength to limit the incoming body size, a NullPointerException is thrown if the body exceeds this size. In my isolated test the intended response still gets back to the user, but in my larger application the user receives a 500 rather than the intended message.

Example action:
```
def maxlen = Action(parse.maxLength(5, parser = parse.anyContent)) { implicit request =>
request.body match {
case Left(maxSize) => BadRequest("exceeded maxSize " + maxSize)
case Right(body) => Ok("accepted")
}
}
```

Triggering the bug:
```
curl -X POST http://localhost:9000/maxlen -d @conf/application.conf
```

Project that demonstrates this bug: https://github.com/varju/play-maxlength-bug

Reproduced using 2.1.2 and with 2.1.x c447be8