[ 
https://issues.apache.org/jira/browse/WW-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14032276#comment-14032276
 ] 

olivier rousseil commented on WW-3698:
--------------------------------------

Since the revert made in 2.3.16 we have again the original bug ! 
It's impossible to export a report A if it has a subreport B. 
For example, the error is :

Caused by: java.lang.ClassCastException: 
org.apache.struts2.views.jasperreports.ValueStackDataSource cannot be cast to 
java.util.List

when jasper try to evaluate expression :

net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating 
expression : 
        Source text : new 
net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listForBSubReport})




> jasperreports plugin's ValueStackDataSource converts field values in 
> ValueStackDataSource even when it's not wanted
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3698
>                 URL: https://issues.apache.org/jira/browse/WW-3698
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JasperReports
>    Affects Versions: 2.2.3.1
>         Environment: Tomcat 7 application server, Jasperreports 4.1.1
>            Reporter: Dario Tortola
>            Assignee: Lukasz Lenart
>            Priority: Minor
>              Labels: patch
>             Fix For: 2.3.12
>
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> Report A with Subreport B
> Subreport B's datasource is a java.util.List field of Report A's datasource's 
> elements
> org.apache.struts2.views.jasperreports.ValueStackDataSource.getFieldValue, 
> after locating the value, if 
> org.apache.struts2.util.MakeIterator.isIterable(value) instead of value a new 
> ValueStackDataSource over value is returned.
> Since ValueStackDataSource is not a java.util.List, a 
> javax.servlet.ServletException is thrown when the returned 
> ValueStackDataSource fails to be cast to List
> To avoid such unwanted conversion it's enough to change this code on 
> ValueStackDataSource.getFieldValue
> {code:java}
> if (MakeIterator.isIterable(value)) {
>    return new ValueStackDataSource(this.valueStack, expression);
> } else {
>    return value;
> }
> {code}
> replace (MakeIterator.isIterable(value)) with 
> (!field.getValueClass().isInstance(value) && MakeIterator.isIterable(value)) 
> for the new ValueStackDataSource to be returned only if the value is not 
> already what the field asks for



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to