Vaadin,CustomLayout循环和IndexOutOfBound

时间:2011-04-26 14:30:54

标签: vaadin

所以,我有两个使用CustomLayout的持有者。

PersonH​​older:

<div class='persons_holder' location='persons_list'></div>

PersonsHolder:

<div class='single_person_holder'>
<div class='person_action' location='person_action'></div>
<div class='person_data'>
   <div class='person_name' location='person_name'></div>
   <div class='person_shares' location='person_shares'></div>
</div>
</div>

现在,我想将它与一些for(;;)指令一起使用。简而言之:

CustomLayout personsHolderLayout = new CustomLayout(PERSONSHOLDER);
Panel tmpPanelPersons = new Panel();
for (PersonView personView : personViews) {
  Component compToAdd2 = magicWithData(2); 
  Component compToAdd3 = magicWithData(3); 
  CustomLayout singlePersonHolderLayout =  new CustomLayout(SINGLEPERSONHOLDER);  
  singlePersonHolderLayout.addComponent(compToAdd2, "person_action"); 
  singlePersonHolderLayout.addComponent(compToAdd3, "person_name"); 

  Panel tmpPanelPerson = new Panel(); 
  for (SingleEntryView chng : ((PersonWithSharesView) personView.getEntries()) {
     Component comp2add = magicWithAnotherData(1); 
     tmpPanelShares.addComponent(comp2add);
     singlePersonHolderLayout.addComponent(tmpPanelShares, "person_shares");
  }

  tmpPanelPersons.addComponent(singlePersonHolderLayout);
}
personsHolderLayout.addComponent(tmpPanelPersons, "persons_list"); 

经过一个循环后,就完成了。我有indexOutOfBound:

  CustomLayout singlePersonHolderLayout =  new CustomLayout(SINGLEPERSONHOLDER);  

有人能告诉我我做错了什么吗? 我是Vaadin的新人:)请温柔。

谢谢你 Łukasz

这是打印堆栈跟踪:

16:10:06,705 ERROR http-8880-exec-4 ui.SpgApp$1:15 - class com.vaadin.terminal.gwt.server.ChangeVariablesErrorEvent com.vaadin.terminal.gwt.server.ChangeVariablesErrorEvent@13b63e6
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:516)
    at java.lang.StringBuilder.append(StringBuilder.java:189)
    at com.vaadin.ui.CustomLayout.initTemplateContentsFromInputStream(CustomLayout.java:119)
    at com.vaadin.ui.CustomLayout.<init>(CustomLayout.java:96)
    at ln.spg.ui.metrics.MetricsDataPanel.appendPeopleViews(MetricsDataPanel.java:700)
    at ln.spg.ui.metrics.MetricsDataPanel.addPeopleComponentToForm(MetricsDataPanel.java:850)
    at ln.spg.ui.metrics.MetricsDataPanel.render(MetricsDataPanel.java:391)
    at ln.spg.ui.metrics.MetricsNewPanel$1.action(MetricsNewPanel.java:150)
    at ln.spg.ui.components.TimeAxis.changeVariables(TimeAxis.java:95)
    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1297)
    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1217)
    at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:733)
    at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
    at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:483)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:366)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:167)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:242)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:203)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

1 个答案:

答案 0 :(得分:0)

问题是从ByteArrayInputStream读取。记住不要做读取此输入的内容,并将其保存在变量中......

它不起作用......