HnContainer and Vaadin 6.6

Hi,

I just tried to upgrade Vaadin to 6.6. I’m using HbnContainer and now I got this strange error :

java.lang.NullPointerException
	at com.vaadin.data.hbnutil.HbnContainer.indexOfId(HbnContainer.java:1334)
	at com.vaadin.ui.Select.getOptionsWithFilter(Select.java:350)
	at com.vaadin.ui.Select.paintContent(Select.java:212)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.ui.Table.paintRow(Table.java:2679)
	at com.vaadin.ui.Table.paintContent(Table.java:2504)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:171)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.ui.Panel.paintContent(Panel.java:255)
	at com.vaadin.ui.Window.paintContent(Window.java:632)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.writeUidlResponce(AbstractCommunicationManager.java:952)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.paintAfterVariableChanges(AbstractCommunicationManager.java:839)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:765)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	at java.lang.Thread.run(Thread.java:662)

The code in question is the following:

public int indexOfId(Object itemId) {
     Integer index = idToIndex.get(itemId);
     return index;
}

The NPE occurs because the idToIndex map is empty, then index is null and the autounboxing fails.

Anyone got any lead?

Thanks for your answer.

Hi,

Maybe the new Filtering API change has broken it somehow. In case you find out a fix, please post it to me and I’ll publish a compatible version to the directory. I can try to find a fix for this later this week.

cheers,
matti

Hi,

I uploaded a new version of HbnContainer, but now when looking at your stack trace I guess it still wont work for your use case. Select components already appear to use the new API so it will break on the same place but with a bit more meaningful message.

Back to the drawing board…

cheers,
matti

Hi,

Version 1.0.3 should now support SimpleStringFilter used by ComboBox. I didn’t test it at all, so if it doesn’t work, please let me know.

cheers,
matti

Hi Matti,

Thanks for your answer, sorry I didn’t catch it earlier. I tried the new version HbnContainer 1.0.3 with Vaadin 6.6.0 and it still seems broken somehow.

The symptom is the same:

java.lang.NullPointerException
	at com.vaadin.data.hbnutil.HbnContainer.indexOfId(HbnContainer.java:1338)
	at com.vaadin.ui.Select.getOptionsWithFilter(Select.java:350)
	at com.vaadin.ui.Select.paintContent(Select.java:212)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.ui.Table.paintRow(Table.java:2679)
	at com.vaadin.ui.Table.paintContent(Table.java:2504)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:171)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.ui.Panel.paintContent(Panel.java:255)
	at com.vaadin.ui.Window.paintContent(Window.java:632)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:755)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.writeUidlResponce(AbstractCommunicationManager.java:952)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.paintAfterVariableChanges(AbstractCommunicationManager.java:839)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:765)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	at java.lang.Thread.run(Thread.java:662)

In earlier Vaadin versions, I don’t think the method itself is called. I don’t know why :*)

I can send you my code privately if you need it.

Hi,

I tried with ComboBox and finally got the issue reproduced. I had to fix one TODO and now it works.

http://dev.vaadin.com/changeset/18785

1.0.4 with the above fix is now available in the Directory.

cheers,
matti

Hi Matti,

Congrats, your fix works like a charm! Consider this nasty bug fixed.

Thanks for your help!

Nicolas

Matti,

Hi! I’m also trying to get HbnContainer 1.0.4 working with Vaadin 6.6 in a Liferay 6.0.6 portlet and having a little trouble. It is probably unrelated to the issues described in this thread that are fixed, but wondering if you could take a look. This is the example portlet that I was trying to get working:

https://github.com/garysweaver/vaadin-hibernate-portlet

The thread I posted this in might be inappropriate (it was in the general help section):

http://vaadin.com/forum/-/message_boards/view_message/442390

Thanks in advance!
Gary

Can’t promise when I find out time to look after this. It would help though if you can isolate the Liferay thing out of the palette. That way it takes less time for me to setup a proper debugging environment.

cheers,
matti

Matti,

As far as the Vaadin app part of it goes, it is basically just the original project here:

http://dev.vaadin.com/svn/incubator/hbncontainer/

Except I removed:

http://dev.vaadin.com/svn/incubator/hbncontainer/src/com/vaadin/data/hbnutil/HbnContainer.java

and I replaced that with the HbnContainer 1.0.4 jar.

If that would work in your opinion, then the next thing would be to ask you whether the dependencies listed in the pom look ok:

https://github.com/garysweaver/vaadin-hibernate-portlet/blob/master/pom.xml

Part of the problem could be that something is missing from the original project:

http://dev.vaadin.com/svn/incubator/hbncontainer/

or something is missing from the maven project.

I’m assuming that the ability to generate Vaadin 6.6.0 apps as portlets works properly also, but all I checked was that the equivalent of Hello World worked before I started on this.

I added a quickstart to the readme here to make it easier to setup in case you have time to test it:

https://github.com/garysweaver/vaadin-hibernate-portlet

Thanks for your help,
Gary