Подотчет Jaspersonf iReport, заполненный списком массивов в качестве параметра основного отчета длиннее 1 страницы, вызывает java .lang.StackOverflowError, - PullRequest
0 голосов
/ 28 апреля 2020

У меня есть основной отчет с подотчетом для верхнего и нижнего колонтитула, а также 1 подотчет, который заполняется параметром основных отчетов типа arraylist. В любое время размер вложенного отчета превышает одну страницу, и я получаю StackOverflowError. Это мой основной отчет.

    <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ReportMain" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="511" leftMargin="56" rightMargin="28" topMargin="28" bottomMargin="28" resourceBundle="ReportMain">
    <property name="ireport.zoom" value="1.4641000000000006"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="ireport.scriptlethandling" value="0"/>
    <property name="ireport.encoding" value="UTF-8"/>
    <import value="net.sf.jasperreports.engine.*"/>
    <import value="java.util.*"/>
    <import value="net.sf.jasperreports.engine.data.*"/>
    <parameter name="Param2" class="java.util.ArrayList" isForPrompting="false">
        <parameterDescription><![CDATA[first column]]></parameterDescription>
        <defaultValueExpression><![CDATA[new java.util.ArrayList(Arrays.asList("Helloo from master"))]]></defaultValueExpression>
    </parameter>
    <parameter name="Param1" class="java.lang.Integer" isForPrompting="false">
        <parameterDescription><![CDATA[number of rows]]></parameterDescription>
        <defaultValueExpression><![CDATA[new Integer(1)]]></defaultValueExpression>
    </parameter>
    <queryString language="SQL">
        <![CDATA[SELECT 1 FROM DUAL]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="81" splitType="Stretch">
            <subreport isUsingCache="true">
                <reportElement key="subreport-pageHeader" x="0" y="0" width="511" height="50"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression class="java.lang.String"><![CDATA["headerh.jasper"]]></subreportExpression>
            </subreport>
            <textField isBlankWhenNull="false">
                <reportElement key="tf-Title" x="0" y="63" width="511" height="18"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement>
                    <font fontName="Arial" size="14" isBold="true" isItalic="false" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$R{Title}]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <pageHeader>
        <band height="92" splitType="Stretch">
            <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.intValue() == 1? new Boolean(false) : new Boolean(true)]]></printWhenExpression>
            <textField isBlankWhenNull="false">
                <reportElement mode="Opaque" x="0" y="74" width="511" height="18"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement>
                    <font fontName="Arial" size="14" isBold="true" isItalic="false" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$R{Title}]]></textFieldExpression>
            </textField>
            <subreport isUsingCache="true">
                <reportElement key="subreport-pageHeader" x="0" y="10" width="511" height="50">
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}.intValue() == 1? new Boolean(false) : new Boolean(true)]]></printWhenExpression>
                </reportElement>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression class="java.lang.String"><![CDATA["headerh.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="15" splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="65" splitType="Stretch">
            <subreport>
                <reportElement x="-54" y="-15" width="555" height="65"/>
                <subreportParameter name="Param2">
                    <subreportParameterExpression><![CDATA[$P{Param2}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="Param1">
                    <subreportParameterExpression><![CDATA[$P{Param1}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression class="java.lang.String"><![CDATA["ArticleInfo.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>
    <columnFooter>
        <band splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="15" splitType="Stretch">
            <subreport isUsingCache="true">
                <reportElement key="subreport-pageFooter" x="0" y="0" width="511" height="14"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression class="java.lang.String"><![CDATA["footerh.jasper"]]></subreportExpression>
            </subreport>
            <textField pattern="" isBlankWhenNull="false">
                <reportElement key="ActualPage-1" mode="Opaque" x="463" y="4" width="20" height="10"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font fontName="Arial" size="8" pdfFontName="arial.ttf" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
                <reportElement key="TotalPages-1" mode="Opaque" x="491" y="4" width="20" height="10"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Arial" size="8" pdfFontName="arial.ttf" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>

И это мой подотчет

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ArticleInfo" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="511" leftMargin="42" rightMargin="42" topMargin="28" bottomMargin="28" resourceBundle="ArticleInfo" whenResourceMissingType="Empty">
    <property name="ireport.zoom" value="1.6500000000000001"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="ireport.scriptlethandling" value="0"/>
    <property name="ireport.encoding" value="UTF-8"/>
    <import value="net.sf.jasperreports.engine.*"/>
    <import value="java.util.*"/>
    <import value="net.sf.jasperreports.engine.data.*"/>
    <parameter name="Param2" class="java.util.ArrayList" isForPrompting="false">
        <parameterDescription><![CDATA[first column]]></parameterDescription>
        <defaultValueExpression><![CDATA[new java.util.ArrayList(Arrays.asList("Helloo"))]]></defaultValueExpression>
    </parameter>
    <parameter name="Param1" class="java.lang.Integer" isForPrompting="false">
        <parameterDescription><![CDATA[number of rows]]></parameterDescription>
        <defaultValueExpression><![CDATA[new Integer(0)]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[SELECT (LEVEL-1)  as rowNumber
FROM DUAL
CONNECT BY LEVEL <= $P{Param1}]]>
    </queryString>
    <field name="ROWNUMBER" class="java.math.BigDecimal"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="20" splitType="Stretch">
            <textField isBlankWhenNull="false">
                <reportElement key="ArtRef-3"  x="0" y="0" width="510" height="20"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Left">
                    <font size="12"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$R{ArticleInfo}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="14" splitType="Stretch">
            <rectangle radius="0">
                <reportElement key="rectangleColorColumn-1" x="0" y="0" width="510" height="14" backcolor="#D2D2FF"/>
                <graphicElement>
                    <pen lineWidth="0.0" lineStyle="Solid"/>
                </graphicElement>
            </rectangle>
            <textField isBlankWhenNull="false">
                <reportElement key="ArtRef-1" x="0" y="0" width="101" height="14"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Left">
                    <font size="12"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$R{ErrorNo}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="false">
                <reportElement key="ArtRef-3" x="101" y="0" width="409" height="14"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Left">
                    <font size="12"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$R{ErrorCause}]]></textFieldExpression>
            </textField>
        </band>
    </columnHeader>
    <detail>
        <band height="10" splitType="Stretch">
            <rectangle>
                <reportElement key="rectangle-1" x="0" y="0" width="510" height="10" backcolor="#DCDCFF">
                    <printWhenExpression><![CDATA[new Boolean(($V{PAGE_COUNT}.intValue() % 2) == 1)]]></printWhenExpression>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="0.0" lineStyle="Solid"/>
                </graphicElement>
            </rectangle>
            <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
                <reportElement key="ArtNr" x="101" y="0" width="409" height="10"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Left">
                    <font pdfFontName="arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$P{Param2}.get($F{ROWNUMBER}.intValue())]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
                <reportElement key="ArtNr-2"  x="0" y="0" width="101" height="10"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Left">
                    <font pdfFontName="arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>

Что я получаю, это:

java.util.concurrent.ExecutionException: net.sf.jasperreports.engine.JRRuntimeException: java.lang.StackOverflowError
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232)
        at java.util.concurrent.FutureTask.get(FutureTask.java:91)
        at reportservice.JobExecutionJasper.run(JobExecutionJasper.java:263)
        at java.lang.Thread.run(Thread.java:662)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: java.lang.StackOverflowError
        at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:762)
        at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:328)
        at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:377)
        at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:351)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2039)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:771)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:281)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:144)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822)
        at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61)
        at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
        at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276)
        at reportservice.JasperJobWrapper.execJasperDBData(JasperJobWrapper.java:51)
        at reportservice.JasperJobWrapper.call(JasperJobWrapper.java:38)
        at reportservice.JasperJobWrapper.call(JasperJobWrapper.java:18)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        ... 1 more
Caused by: java.lang.StackOverflowError
        at java.util.ArrayList.get(ArrayList.java:322)
        at java.util.AbstractList$Itr.next(AbstractList.java:345)
        at java.util.AbstractList.hashCode(AbstractList.java:526)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)
        at java.util.HashMap$Entry.hashCode(HashMap.java:720)
        at java.util.AbstractMap.hashCode(AbstractMap.java:461)

Спасибо за любую помощь с этим вопросом.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...