only every 2nd table entry is readable

Hi folks,

I have a table with about 90 entries that are dynamicly filled in. I try to read the value of the entries with

table_1.getItem(i).getItemProperty("prop").getValue();

This is only possible on every 2nd entry. Therefore it is possible to read


table_1.getItem(1).getItemProperty(""prob").getValue();
table_1.getItem(3).getItemProperty(""prob").getValue();
table_1.getItem(5).getItemProperty(""prob").getValue();
table_1.getItem(7).getItemProperty(""prob").getValue();
...

but it is not possible to read


table_1.getItem(2).getItemProperty(""prob").getValue();
table_1.getItem(4).getItemProperty(""prob").getValue();
table_1.getItem(6).getItemProperty(""prob").getValue();
table_1.getItem(8).getItemProperty(""prob").getValue();
...

the error is: Invocation of method layoutClick in com.example.demo.DemoApplication$4 failed.

If you need more information please let me know.

Thx everybody for help and have a nice week

Well yes, a more complete stacktrace would be nice :slight_smile:

Nov 19, 2012 1:28:46 PM com.vaadin.Application terminalError
SEVERE: Terminal error:
com.vaadin.event.ListenerMethod$MethodException: Invocation of method layoutClick in com.example.demosoftware_0_1.Demosoftware_0_1Application$4 failed.
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:530)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
	at com.vaadin.ui.AbstractLayout.fireClick(AbstractLayout.java:137)
	at com.vaadin.ui.AbstractLayout.changeVariables(AbstractLayout.java:113)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1460)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1404)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:318)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	at org.vaadin.artur.icepush.ICEPushServlet.service(ICEPushServlet.java:72)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
	at com.example.demosoftware_0_1.Demosoftware_0_1Application$4.layoutClick(Demosoftware_0_1Application.java:369)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
	... 28 more

I really don’t know what happend, it worked with about 30 entries

OK now I feel stupid. I just used the wrong logic in my loop to fill the table, actually there wasn’t a 2nd, 4th… entry. I couldn’t see it in the table, but they weren’t added (I added table_1.addItem(“item”, i + sum) and sum increment every loop like i instead of after the loop). Sooooooooorry for your time, this case was really easy and didn’t need to be posted here :*)

No problem, happens to the best of us :wink: