Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3698

jasperreports plugin's ValueStackDataSource converts field values in ValueStackDataSource even when it's not wanted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.3.1
    • 2.3.20
    • Plugin - JasperReports
    • Tomcat 7 application server, Jasperreports 4.1.1

    • Patch

    Description

      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

      if (MakeIterator.isIterable(value)) {
         return new ValueStackDataSource(this.valueStack, expression);
      } else {
         return value;
      }
      

      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

      Attachments

        Issue Links

          Activity

            People

              lukaszlenart Lukasz Lenart
              dtortola Dario Tortola
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 20m
                  20m
                  Remaining:
                  Remaining Estimate - 20m
                  20m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified