title: Vaadin, CustomLayout loops and IndexOutOfBound
body: <p>So, i've got 2 holders i use with CustomLayout. </p>
  
  <p>PersonHolder: </p>
  
  <pre><code>&lt;div class='persons_holder' location='persons_list'&gt;&lt;/div&gt;
  </code></pre>
  
  <p>PersonsHolder: </p>
  
  <pre><code>&lt;div class='single_person_holder'&gt;
  &lt;div class='person_action' location='person_action'&gt;&lt;/div&gt;
  &lt;div class='person_data'&gt;
     &lt;div class='person_name' location='person_name'&gt;&lt;/div&gt;
     &lt;div class='person_shares' location='person_shares'&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Now, i want to use it with some for(;;) instructions. In nutshell: </p>
  
  <pre><code>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"); 
  </code></pre>
  
  <p>After one loop, it's done. I've got indexOutOfBound at: </p>
  
  <pre><code>  CustomLayout singlePersonHolderLayout =  new CustomLayout(SINGLEPERSONHOLDER);  
  </code></pre>
  
  <p>Can someone tell me what i did wrong ? 
  I'm new at Vaadin :) So be gentle please. </p>
  
  <p>Thanks in return 
  Łukasz </p>
  
  <p>Here's the print stack trace: </p>
  
  <pre><code>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.&lt;init&gt;(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)
  </code></pre>