tlaukkan / vaadin-lazyquerycontainer

Lazy Query Container is a lazy loading container implementation for accessing data from business services.
http://vaadin.com/directory#addon/117
39 stars 73 forks source link

IndexOutOfBoundsException in LazyQueryContainer.getItem when item with given itemId is absent #69

Closed ashalin closed 9 years ago

ashalin commented 9 years ago

I think it's much better to check existence of itemId and write code this way:

    public final Item getItem(final Object itemId) {
        if (itemId == null) {
            return null;
        } else {
            int index = queryView.getItemIdList().indexOf(itemId);
            if (index < 0) return null;
            return queryView.getItem(index);
        }
    }