Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-976

rich:column width property throws pointless exceptions

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.1.0
    • Fix Version/s: 3.1.1, 3.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Using width in rich:column for scrollabledatatable can lead to exception if "width" is badly formulated:
      <rich:scrollableDataTable value="...">
      <rich:column sortExpression="#

      {item.level}

      " width="100" >

      Leads to
      1832387 [http-8080-Processor4] FATAL jsp.error - Jsp error occured
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1444)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer$3.renderContent(ScrollableDataTableBaseRenderer.java:111)
      at org.richfaces.renderkit.html.ExtendedColumnVisitor.visit(ExtendedColumnVisitor.java:31)
      at org.richfaces.renderkit.html.ColumnWalker.iterateOverColumns(ColumnWalker.java:42)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.renderHeaders(ScrollableDataTableBaseRenderer.java:475)
      at org.richfaces.renderkit.html.ScrollableDataTableRenderer.doEncodeEnd(ScrollableDataTableRenderer.java:303)
      at org.richfaces.renderkit.html.ScrollableDataTableRenderer.doEncodeEnd(ScrollableDataTableRenderer.java:552)
      at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
      at org.richfaces.renderkit.html.ScrollableDataTableBaseRenderer.encodeEnd(ScrollableDataTableBaseRenderer.java:731)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:688)

      The faulty lines are:
      110 String widthPx = (String)column.getAttributes().get("width");
      111 int width = Integer.parseInt(widthPx.substring(0, widthPx.indexOf("px")));

      The doc, while stating the width is expressed in pixels, does not state you have to add a "px" extension to your number. Either the doc must clarify this, either code should not assume px is present and in case can not convert to integer, throw an appriopriate Faces exception.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                viktor_volkov Viktor Volkov
                Reporter:
                tchize david delbecq
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: