4 Replies Latest reply on Mar 11, 2008 12:25 PM by Sergey Halipov

    PanelBarRendererBase threw java.lang.StringIndexOutOfBoundsE

    Tony Mai Apprentice

      Hello,

      I have a page built with rich:panelBar. While clicking around the rich:panelBarItem I ran into the following exception:

      Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      at java.lang.String.charAt(String.java:687)
      at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:556)
      at org.richfaces.renderkit.html.PanelBarRendererBase.expanded(PanelBarRendererBase.java:66)
      at org.richfaces.renderkit.html.PanelBarRenderer.doEncodeEnd(PanelBarRenderer.java:167)
      at org.richfaces.renderkit.html.PanelBarRenderer.doEncodeEnd(PanelBarRenderer.java:182)
      at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
      at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
      at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
      at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:79)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:143)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86)
      at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134)
      at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:122)
      at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:553)
      at org.ajax4jsf.context.AjaxContextImpl.renderAjaxRegion(AjaxContextImpl.java:289)
      at org.ajax4jsf.context.AjaxContextImpl$2.invoke(AjaxContextImpl.java:204)
      at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:78)
      at org.ajax4jsf.context.AjaxContextImpl.invokeOnComponent(AjaxContextImpl.java:160)
      at org.ajax4jsf.context.AjaxContextImpl.renderSubmittedAjaxRegion(AjaxContextImpl.java:218)
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:239)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)


      After the exception was thrown, I could not get back to that page until I restart the application.

      I am using RichFaces 3.1.2GA with Seam 2.0.0GA and JBoss 4.2.1GA.

      Thanks

        • 1. Re: PanelBarRendererBase threw java.lang.StringIndexOutOfBou
          Sergey Smirnov Master

          could you provide a code snippet of how you use this rich:panelBar

          • 2. Re: PanelBarRendererBase threw java.lang.StringIndexOutOfBou
            Tony Mai Apprentice

            it's been modified a little since I posted the exception. But basically it's like the following:

            <rich:panelBar height="300">
             <c:forEach var='reportItem' items="#{clsSettleSRRptMgr.clrSettledRecords}">
             <rich:panelBarItem label="#{reportItem.tradable.tradableHoldingEntity.abbrevIntlName} (#{reportItem.tradable.exchange.exchangeAbbrevName} : #{reportItem.tradable.symbol})">
             <h:panelGrid columns="2" columnClasses="col-value,col-value">
             ...
             </h:panelGrid>
             <rich:separator height="1" lineType="dashed" width="50%" />
             <rich:spacer height="4" />
             <rich:dataTable rows="10000"
             onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
             onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
             cellpadding="0" cellspacing="0"
             value="#{clsSettleSRRptMgr.getStockRecords(reportItem)}" var="record" >
            
             <f:facet name="header">
             <rich:columnGroup>
            ...
            


            What happened I think was that when I cleared the result set, I accidentally left the flag to render the panel true and when panelBarItem tried to render with a null reportItem in
            <rich:panelBarItem label="#{reportItem.tradable.tradableHoldingEntity.abbrevIntlName}
            it was not happy.

            After I reset the flag to not render the panel, the problem went away. What scares me is the inability to return to a page after an exception had been thrown without restart the application. Not sure if it's Seam's related issue or RichFaces.

            Thanks
            -tony

            • 3. Re: PanelBarRendererBase threw java.lang.StringIndexOutOfBou
              Tony Mai Apprentice

              Well, I thought this problem was solved but I was wrong. It popped up again. This time, I am not sure what the cause is.

              Is it possible to at least check and prevent this IndexOutOfBound error within RichFaces?

              Thanks
              -tony

              • 4. Re: PanelBarRendererBase threw java.lang.StringIndexOutOfBou
                Sergey Halipov Newbie

                Can't reproduce the bug. Could you attach some example with reproducible code to Jira issue? My example:

                <rich:panelBar height="300" id="cForEach" >
                 <c:forEach var="time" items="#{toggleBean.items}" >
                 <rich:panelBarItem label="#{time} Label" id="barItem#{time}" >
                 <h:panelGrid columns="2" columnClasses="col-value,col-value" id="panelGrid#{time}">
                 <h:outputText value="#{time}AAAAAAA" ></h:outputText>
                 </h:panelGrid>
                 </rich:panelBarItem>
                 </c:forEach>
                 </rich:panelBar>
                


                Java bean:
                private List<String> items = null;
                
                 public Bean() {
                 items = new ArrayList<String>();
                 Random rand = new Random();
                 for (int i = 0; i < 10; i++) {
                 items.add(new Long(rand.nextLong()).toString());
                 }
                 }
                
                public List<String> getItems() {
                 return items;
                 }
                
                 public void setItems(List<String> items) {
                 this.items = items;
                 }