[richfaces-issues] [JBoss JIRA] Created: (RF-976) rich:column width property throws pointless exceptions

David Delbecq (JIRA) jira-events at lists.jboss.org
Thu Sep 20 09:27:11 EDT 2007


rich:column width property throws pointless exceptions
------------------------------------------------------

                 Key: RF-976
                 URL: http://jira.jboss.com/jira/browse/RF-976
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.1.0
            Reporter: David Delbecq


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list