Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-4326

java.lang.StringIndexOutOfBoundsException jsf renderkit

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 7.1.1.Final
    • Fix Version/s: None
    • Component/s: JSF
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      look at description.

      Show
      look at description.
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      use onchange="jsf.ajax.request(this, event,

      { render: 'area_2'}

      ); return false" instead of <f:ajax render="area_2"/>

      Show
      use onchange="jsf.ajax.request(this, event, { render: 'area_2'} ); return false" instead of <f:ajax render="area_2"/>

      Description

      I use this code (nothing special) which renders right:

      <h:form>
      <h:panelGroup id="area">
      <h:selectOneRadio value="#

      {mybean.selectedValue}" valueChangeListener="#{myBean.onMySelect}">
      <f:selectItems value="#{myBean.selectables}" var="_e" itemLabel="#{_e.name}" itemValue="#{_e.name}" />
      <f:ajax render="area_2"/>
      </h:selectOneRadio>
      </h:panelGroup>
      <h:panelGroup id="area_2">
      <label>Name</label>
      <h:inputText required="true" value="#{myBean.name}" />
      </h:panelGroup>

      <h:commandLink value="Save" action="#{bean.save}">
      <f:ajax execute="@form" render="@form" />
      </h:commandLink>
      </h:panelGroup>
      </h:form>

      When selecting a item of selectOneRadio-component then the valueChangeEvent is fired without an error. However, when submitting the form by pressing the "Save"-Button, then this (full) stacktrace happens (the stacktrace is not cut):

      10:02:42,920 Information [javax.enterprise.resource.webcontainer.jsf.context] (http-localhost-127.0.0.1-8080-1) java.lang.StringIndexOutOfBoundsException: String index out of range: -1: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1958) [rt.jar:1.7.0_01]
      at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.isBehaviorSource(SelectManyCheckboxListRenderer.java:214) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.decodeBehaviors(HtmlBasicRenderer.java:213) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.renderkit.html_basic.MenuRenderer.decode(MenuRenderer.java:221) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIInput.decode(UIInput.java:757) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1181) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIInput.processDecodes(UIInput.java:662) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIForm.processDecodes(UIForm.java:225) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1612) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIForm.visitTree(UIForm.java:362) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:199) [richfaces-core-impl-4.2.0.Final.jar:4.2.0.Final]
      at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.1.0.Final.jar:3.1.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.1.0.Final.jar:3.1.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]


      I don't know where the failure lies, I guess, it is a bug in the JSF-Implementation.

      The strange thing is, when deleting the <f:ajax render="area_2"/> and submitting again, then no stacktrace occurs (however, I need to use ajax within the component 'selectOneRadio'. The other strange thing is this: When I use this code for my 'selectOneRadio', then ALL works fine without any stacktrace:

      <h:selectOneRadio value="#{mybean.selectedValue}

      " valueChangeListener="#

      {myBean.onMySelect}"
      onchange="jsf.ajax.request(this, event, { render: 'area_2'}); return false">
      <f:selectItems value="#{myBean.selectables}" var="_e" itemLabel="#{_e.name}" itemValue="#{_e.name}" />
      </h:selectOneRadio>

      So you see, I substitute this (VERSION 1):

      <f:ajax render="area_2"/>

      with this (VERSION 2):

      onchange="jsf.ajax.request(this, event, { render: 'area_2'}); return false"

      and now it works fine.

      But why can I not use (VERSION 1)?

      I have thought, (VERSION 1) and (VERSION 2) should be treated equal.

      The other strange thing is, that the stacktrace with (VERSION 1) only occurs with the component 'selectOneRadio'. Using the same bean-properties of 'VERSION 1' with a other component (for example, 'selectOneMenu') all works right:

      <h:selectOneMenu value="#{mybean.selectedValue}" valueChangeListener="#{myBean.onMySelect}

      ">
      <f:selectItems value="#

      {myBean.selectables}

      " var="_e" itemLabel="#{_e.name}" itemValue="#{_e.name}" />
      <f:ajax render="area_2"/>
      </h:selectOneMenu>

      So I guess, it is a bug within the ajaxified selectOneRadio.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ssilvert Stan Silvert
                Reporter:
                nimo22 nimo stephan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: