Not null, but empty BeanItemContainer should raise exception?

Hi,

During development with Vaadin Framework i experienced the next Exception:

javax.servlet.ServletException: java.lang.IllegalArgumentException: The collection passed to BeanItemContainer must not be null or empty

The code is something like:

Table table = new Table();
table.setContainerDataSource([b]
getNotNullEmptyContainer
[/b]());

My apologies for ask… but Vaadin is so good (i’m serious) that i think i should ask/contribute.

This is a good design pattern?

In my modest opinion, i think that, the exception only should be raised when the container is null.

BeanItemContainer needs somehow know the class of the objects in the collection. If the collection is empty there is no instance to inspect. If you want to create an empty container, construct BeanItemContainer with BeanItemContainer(Class<? extends BT> type) constructor and add the beans to the container with addBeanAt(…)