myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Udo Schnurpfeil (JIRA)" <>
Subject [jira] [Commented] (TOBAGO-1390) "Can't parse to any measure"
Date Thu, 24 Apr 2014 14:48:24 GMT


Udo Schnurpfeil commented on TOBAGO-1390:

I think the best way is b)

BTW: Using % values are allowed, but potentially problematic, so I don't use it ;-)

> "Can't parse to any measure"
> ----------------------------
>                 Key: TOBAGO-1390
>                 URL:
>             Project: MyFaces Tobago
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-beta-2
>         Environment: Firefox 28.0
>            Reporter: Bernhard Stadler
> In our application, there are frequent occurences of IllegalArgumentExceptions in  org.apache.myfaces.tobago.layout.Measure
line 79 (function valueOf(String)), which is being called by org.apache.myfaces.tobago.renderkit.PageRendererBase
line 86 (function decodePageState(FacesContext, AbstractUIPage)). 
> I wasn't able to create a reproducing example, but I have been able to isolate the conditions
and causes under which this happens in our application:
> Apparently it is caused by JavaScript code (tobago.js, storeClientDimension) sending
decimal values (e.g. "1298.4px") as positions or dimensions. Measure.valueOf only checks whether
the String received ends with "px" and removes it if necessary, but doesn't have any means
to handle decimals.
> In the JavaScript code, I found out that the non-integer value stems from the following
lines in function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) in  jquery-1.10.2.js:
> {code}
> // at this point, extra isn't border nor margin, so remove border
> if ( extra !== "margin" ) {
>   val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
> }
> {code}
> Removing the following lines from our CSS file seems to stop the errors from occurring:
> {code}
> .tobago-page {
>     width: 90%;
>     height: 99%;
>     // ...
> }
> {code}
> I'm not sure whether this is a correct use of CSS but I guess it shouldn't cause a RuntimeException,
especially as it is caused by unsanitized client data. 
> I don't know what the best course of action might be:
> a) Change the JavaScript code to remove decimal places
> b) Change Measure to remove decimal places
> c) Change Measure to actually store decimals instead of integers

This message was sent by Atlassian JIRA

View raw message