ocpsoft/rewrite — pull request #102 by fabmars (2013-06-05 00:48:51+00:00)
Title: Fix for Failed to bind value [] to binding [Evaluation [property=...]] when converted value is null

OK this one is tricky.

Take a page that can be accessed in 2 ways:
`

`

The config provider follows this:
`.addRule(Join.path("/page1/name/{name}/").to("/page1.jsf")).where("name").bindsTo(El.property("page1Handler.name"))
.addRule(Join.path("/page1/id/{id}/").to("/page1.jsf")).where("id").bindsTo(El.property("page1Handler.id")).convertedBy(LongConverter.INSTANCE)`

page1Handler.id is Long and page1Handler.name is String, and I coded the converter to return null if the input value is "" (and not 0L or another ugly default value).

When I invoke the page with http://localhost:8080/myApp/page1/name/foobar/ , Rewrite binds foobar, and then it attempts to bind id (from the second outputLink). However he query there is ?id=
Therefore the (Long)converter will get "" (as per what's written in QueryStringBuilder#addParameter: for "n=", the value is "", for "n", the value is null).

However Evaluation#submitConverted and RequestBinding#submit don't null-check value.
Result: a NPE and the page displays "Failed to bind value [] to binding [Evaluation [property=id]]" (really not explicit btw).

This is a fix for this issue.