You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2013/03/25 21:17:16 UTC

[jira] [Updated] (WW-3348) IndexOutOfBoundsException in ValueStackDataSource

     [ https://issues.apache.org/jira/browse/WW-3348?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart updated WW-3348:
------------------------------

    Fix Version/s:     (was: 3.0)
                   2.3.x
    
> IndexOutOfBoundsException in ValueStackDataSource
> -------------------------------------------------
>
>                 Key: WW-3348
>                 URL: https://issues.apache.org/jira/browse/WW-3348
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.1.8
>         Environment: WinXP, Tomcat
>            Reporter: Mark Gorokhov
>             Fix For: 2.3.x
>
>
> Scenario: 
>   - Jasper report with 4 subreports. 
>   - Subreports content is provided from org.apache.struts2.views.jasperreports.ValueStackDataSource
> Exception 
>    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> is thrown from org.apache.struts2.views.jasperreports.ValueStackDataSource:
>     public boolean next() throws JRException {
>         if (firstTimeThrough) {
>             firstTimeThrough = false;
>         } else {
>             valueStack.pop(); <== throws exception
>         }
>         . . .
>     }
> Exception is thrown if the last row from subreport fits the current page and a new page is started. Thus the exception is data dependent.
> The following workaround works nicely:
>     public boolean next() throws JRException {
>         if (firstTimeThrough) {
>             firstTimeThrough = false;
>         } else {
>             if (valueStack.size() > 0) {
>                 valueStack.pop();
>             }
>         }
>         . . .
>     }
> Please test and implement in the next release.
> The following does not work (main report is generated partially, stops on empty valueStack condition):
>     public boolean next() throws JRException {
>         if (firstTimeThrough) {
>             firstTimeThrough = false;
>         } else {
>             if (valueStack.size() == 0) {
>                 return false;
>             }
>             valueStack.pop();
>         }
>         . . .
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira