Table throws NunllPointerException when using custom Data-Container

I just started to use Vaadin and it’s really impressing but now I’ve got a big problem!
I created a simple custom data-container just implementing the Container-Interface. When initialising my application i create a new table and set my custom container as the table’s datasource.

Opening my application in the browser causes a NullPointerException with following stack-trace:

Removing the line where my table is added to the VerticalLayout-container at least solves the problem of not being able to start the application. I don’t know if this is a bug or if i’m just too stupid to implement my container properly.
I hope someone can help me with that!

Probably problem with container not returning types for properties.
Have you implemented
public Class<?> getType(Object propertyId) so that it returns valid type for every visible propertyID.

Welcome to Vaadin, Thomas! :slight_smile:

Unfortunately containers aren’t the easiest to start with… It does look like the Table expects your container to return something other than what actually is returned. It’s hard to say what went wrong without seeing the source code for your container, though.

If I had to guess from the stacktrace I would say that your Container.getType(propertyId) returns null for some propertyId. It should always return the type (class) of the property identified by propertyId.

HTH,
/Jonatan

Alright, that was it!

getType()
sometimes returned
null
and i didn’t even notice :*)

Thank you for your answers!!