IBM Support

PI79562: Leading '/' in JSF context param-value throws StringIndexOutOfBoundsException

Fixes are available

17.0.0.2: WebSphere Application Server Liberty 17.0.0.2
17.0.0.3: WebSphere Application Server Liberty 17.0.0.3
17.0.0.4: WebSphere Application Server Liberty 17.0.0.4
18.0.0.1: WebSphere Application Server Liberty 18.0.0.1
18.0.0.2: WebSphere Application Server Liberty 18.0.0.2
18.0.0.3: WebSphere Application Server Liberty 18.0.0.3
18.0.0.4: WebSphere Application Server Liberty 18.0.0.4
19.0.0.1: WebSphere Application Server Liberty 19.0.0.1
19.0.0.2: WebSphere Application Server Liberty 19.0.0.2
19.0.0.3: WebSphere Application Server Liberty 19.0.0.3
19.0.0.4: WebSphere Application Server Liberty 19.0.0.4
19.0.0.5: WebSphere Application Server Liberty 19.0.0.5
19.0.0.6: WebSphere Application Server Liberty 19.0.0.6
19.0.0.7: WebSphere Application Server Liberty 19.0.0.7
19.0.0.8: WebSphere Application Server Liberty 19.0.0.8
19.0.0.9: WebSphere Application Server Liberty 19.0.0.9
19.0.0.10: WebSphere Application Server Liberty 19.0.0.10
19.0.0.11: WebSphere Application Server Liberty 19.0.0.11
19.0.0.12: WebSphere Application Server Liberty 19.0.0.12
20.0.0.1: WebSphere Application Server Liberty 20.0.0.1
20.0.0.2: WebSphere Application Server Liberty 20.0.0.2
20.0.0.3: WebSphere Application Server Liberty 20.0.0.3
20.0.0.4: WebSphere Application Server Liberty 20.0.0.4
20.0.0.5: WebSphere Application Server Liberty 20.0.0.5
20.0.0.6: WebSphere Application Server Liberty 20.0.0.6
20.0.0.7: WebSphere Application Server Liberty 20.0.0.7
20.0.0.8: WebSphere Application Server Liberty 20.0.0.8
20.0.0.9: WebSphere Application Server Liberty 20.0.0.9
20.0.0.10: WebSphere Application Server Liberty 20.0.0.10
20.0.0.11: WebSphere Application Server Liberty 20.0.0.11
20.0.0.12: WebSphere Application Server Liberty 20.0.0.12

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Configuring JSF <context-param> value as shown below
    ==== web.xml ====
    <context-param>
    <param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-na
    me>
    <param-value>/META-INF/resources</param-value>
    </context-param>
    =================
    can cause below Exception
    
    Caused by: java.lang.StringIndexOutOfBoundsException: String
    index out of range: 35
    at java.lang.String.substring(String.java:1377)
    at
    org.apache.myfaces.shared.resource.ExternalContextResourceLo
    ader
    .getResourceVersion(ExternalContextResourceLoader.java:81)
    at
    org.apache.myfaces.application.ResourceHandlerImpl.deriveRes
    ourc
    eMeta(ResourceHandlerImpl.java:444)
    at
    org.apache.myfaces.application.ResourceHandlerImpl.createRes
    ourc
    e(ResourceHandlerImpl.java:243)
    at
    org.apache.myfaces.application.ResourceHandlerImpl.createRes
    ourc
    e(ResourceHandlerImpl.java:109)
    at
    org.apache.myfaces.renderkit.html.HtmlStylesheetRenderer.enc
    odeE
    nd(HtmlStylesheetRenderer.java:218)
    at
    javax.faces.component.UIComponentBase.encodeEnd(UIComponentB
    ase.
    java:674)
    at
    javax.faces.component.UIComponentBase.encodeAll(UIComponentB
    ase.
    java:554)
    at
    org.apache.myfaces.renderkit.html.HtmlHeadRenderer.encodeEnd
    (Htm
    lHeadRenderer.java:83)
    at
    javax.faces.component.UIComponentBase.encodeEnd(UIComponentB
    ase.
    java:674)
    at
    javax.faces.component.UIComponentBase.encodeAll(UIComponentB
    ase.
    java:554)
    at
    javax.faces.component.UIComponentBase.encodeAll(UIComponentB
    ase.
    java:550)
    at
    org.apache.myfaces.view.facelets.FaceletViewDeclarationLangu
    age.
    renderView(FaceletViewDeclarationLanguage.java:1891)
    at
    org.apache.myfaces.application.ViewHandlerImpl.renderView(Vi
    ewHa
    ndlerImpl.java:313)
    at
    org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(
    Rend
    erResponseExecutor.java:116)
    at
    org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleI
    mpl.
    java:267)
    at
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:20
    0)
    

Local fix

  • Modify web.xml leading '/' before META-INF in <param-value>
    ==== web.xml ====
    <context-param>
     <param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
       <param-value>META-INF/resources</param-value>
    </context-param>
    =================
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  IBM WebSphere Application Server Liberty    *
    *                  users of JavaServer Faces (JSF) MyFaces 2.0 *
    *                  and 2.2                                     *
    ****************************************************************
    * PROBLEM DESCRIPTION: The JSF feature can throw a             *
    *                      java.lang.StringIndexOutOfBoundsExcepti *
    *                      on while determining resource versions  *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    A StringOutOfBoundsException can be thrown from the JSF code in
    certain resource loading conditions.  The exception is caused by
    an error in JSF code that determines resource versions.
    
    For example, the following param-value can cause a
    StringOutOfBoundsException to be thrown during resource
    loading:
    
    <context-param>
    <param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
    <param-value>/META-INF/resources</param-value>
    </context-param>
    
    throws:
    java.lang.StringIndexOutOfBoundsException: String index out of
    range: 35
    at java.lang.String.substring(String.java:1377)
    at
    org.apache.myfaces.shared.resource.ExternalContextResourceLoader
    .getResourceVersion(ExternalContextResourceLoader.java:81)
    ...
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    PI79562

  • Reported component name

    LIBERTY PROFILE

  • Reported component ID

    5724J0814

  • Reported release

    CD0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-04-06

  • Closed date

    2017-05-09

  • Last modified date

    2017-05-09

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    LIBERTY PROFILE

  • Fixed component ID

    5724J0814

Applicable component levels

  • RCD0 PSY

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"CD0","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
18 October 2021