Strange Form behaviour with NestedMethodProperty


I have a form which has NestedMethodProperty for one of the form field’s bean property when i set that field as not mandory i see a strange NullPointerexception on the client side in the browser but nothing at the server side. But if i set the field as required i don’t see any error. Why is this strange behaviour caused. I have been strugling with this error for the past three days without any clue. See the attachment of the screen shot


Problem solved.

To avoid Null pointer exception on Nested method property’s getValue method we have to create empty objects. As @NestedMethodProperty mandates that all intermediate getters must return non-null values.

This is related to enhancement request
to add an option to treat intermediate nulls as nulls for the nested property.

Hi Ajay,

Could you explain better with an example how you have done to solve that problem?

Thanks in advance.

You can take a look at a “hack” I used in

If a null occurs anywhere in the nested property path, then null is returned. And if a value is set on a nested property path that contains nulls, empty values are automatically created using reflection and inserted into the tree.

You can see in my
live demo
that nested properties are used quite a lot in various results and forms.


Hi I’m using the vaadin 7.1.7 and this exception still happens, I didn’t understand how to fix it!

The javadoc for NestedMethodProperty and some of the methods using it implicitly specifies that there should not be any intermediate nulls along the path, so it works as specified.

However, in the Vaadin 7.2 branch the behavior has been changed so that intermediate nulls simply produce null as the result, and we are considering introducing the change even in Vaadin 7.1.x (
) despite it resulting in a minor API change.

Hi, thanks for reply, but is there any way to avoid this error?

Maybe the problem here is not the same issue that occurs with me, I have created a new post here about this issue!/thread/4553858