Jump to content
Changes to the Jaspersoft community edition download ×

Possible BUG: Deadlock if I use Subreports


Recommended Posts

By: wilhelm tell - azgard

Possible BUG: Deadlock if I use Subreports

2003-05-01 07:13

Hi,

 

I use jasperReports 0.4.6 with J2SDK 1.4.1 on WinXP.

 

My problem is, I have a group-section in my report and this group-section includes in the <groupFooter> a subreport. I can compile and use this subreport as the main-report and the export to PDF is OK.

 

But if the subreport is included in my main-report then it runs in a deadlock in Class JRVerticalFiller on row 583.

 

if (detail.isToPrint()) {

while (

detail.getHeight() > columnFooterOffsetY - offsetY

) {

fillColumnBreak(JRExpression.EVALUATION_DEFAULT);

}

 

 

Here my report files:

 

Main-Report:

 

<?xml version="1.0"?>

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport

name="DataSourceReport"

pageWidth="595"

pageHeight="842"

columnWidth="515"

columnSpacing="0"

leftMargin="40"

rightMargin="40"

topMargin="50"

bottomMargin="50">

 

<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="12" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="12" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

 

<parameter name="ImageSubreport" class="dori.jasper.engine.JasperReport"/>

 

<field name="id" class="java.lang.String"/>

<field name="arzt" class="java.lang.String"/>

<field name="text" class="java.lang.String"/>

 

<group name="CityGroup" minHeightToStartNewPage="700" isStartNewPage="true">

<groupExpression>

$F{arzt}

</groupExpression>

<groupHeader>

<band height="20">

<rectangle>

<reportElement x="0" y="4" width="515" height="15" forecolor="#C0C0C0" backcolor="#C0C0C0"/>

<graphicElement stretchType="NoStretch"/>

</rectangle>

<textField>

<reportElement x="0" y="4" width="515" height="15" backcolor="#C0C0C0" mode="Opaque"/>

<textElement textAlignment="Left">

<font reportFont="Arial_Bold"/>

</textElement>

<textFieldExpression class="java.lang.String">

$F{arzt}

</textFieldExpression>

</textField>

<line>

<reportElement x="0" y="19" width="515" height="0"/>

<graphicElement stretchType="NoStretch"/>

</line>

</band>

</groupHeader>

<groupFooter>

<band height="340">

<subreport isUsingCache="true">

<reportElement x="0" y="0" width="520" height="340" backcolor="#FFCC99" isPrintRepeatedValues="false" isPrintWhenDetailOverflows="false" isRemoveLineWhenBlank="false"/>

<dataSourceExpression>

new reporttests.MyDataSource($F{arzt})

</dataSourceExpression>

<subreportExpression class="dori.jasper.engine.JasperReport">

$P{ImageSubreport}

</subreportExpression>

</subreport>

</band>

</groupFooter>

</group>

 

 

<detail>

<band height="20">

<textField>

<reportElement x="0" y="4" width="50" height="15"/>

<textElement textAlignment="Right"/>

<textFieldExpression class="java.lang.String">

$F{id}

</textFieldExpression>

</textField>

<textField isStretchWithOverflow="true">

<reportElement x="55" y="4" width="200" height="15" positionType="Float"/>

<textFieldExpression class="java.lang.String">

$F{arzt}

</textFieldExpression>

</textField>

<textField isStretchWithOverflow="true">

<reportElement x="260" y="4" width="255" height="15" positionType="Float"/>

<textFieldExpression class="java.lang.String">

$F{text}

</textFieldExpression>

</textField>

<line>

<reportElement x="0" y="19" width="515" height="0" forecolor="#808080" positionType="Float"/>

<graphicElement stretchType="NoStretch"/>

</line>

</band>

</detail>

</jasperReport>

 

 

And the subreport:

 

<?xml version="1.0"?>

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport

name="DataSourceReport"

pageWidth="595"

pageHeight="842"

columnWidth="595"

columnSpacing="0"

leftMargin="0"

rightMargin="0"

topMargin="0"

bottomMargin="0">

 

<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="12" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="12" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

 

<field name="id" class="java.lang.String"/>

<field name="arzt" class="java.lang.String"/>

<field name="text" class="java.lang.String"/>

<field name="imageurl" class="java.lang.Object"/>

 

<detail>

<band height="842">

<image scaleImage="RetainShape" hAlign="Center" isUsingCache="false">

<reportElement x="0" y="0" width="595" height="842"/>

<graphicElement pen="Thin"/>

<imageExpression class="java.net.URL">$F{imageurl}</imageExpression>

</image>

</band>

</detail>

</jasperReport>

 

 

Thank you for any hints.

 

Azgard

 

 

 

 

By: Teodor Danciu - teodord

RE: Possible BUG: Deadlock if I use Subreports

2003-05-07 13:28

 

Hi,

 

Of course there is a deadlock!

 

The detail section of your subreport is 842 pixels tall.

There will never be 842 pixels available so that

this detail section could start to print because

in the master report, there are also the top and bottom margins that make together 100 pixels.

 

So, the engine enters a loop in which it creates

new pages in vain, hoping that on the next one

there will be 842 pixels available for the subreport detail section to start.

This is just not going to happen if you keep this

layout.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...