Fixing a MultiLineItem error in BIRT

It's a simple report. Just a couple of fields. You know it has to churn through a lot of data, but you did everything correct, and BIRT still decides to kick out an error stack. The latest example of this is when I did a simple inventory label report. I expected to get pages of inventory item numbers and descriptions, but instead I got this:1

java.lang.IllegalStateException: can't re-generate content for MultiLineItem

Reading through the entire error stack shows the culprit on the last three lines:

Caused by: java.lang.IllegalStateException: can't re-generate content for MultiLineItem at org.eclipse.birt.report.engine.internal.document.v4.DynamicTextItemExecutor.doCreateContent(DynamicTextItemExecutor.java:41) at org.eclipse.birt.report.engine.internal.document.v4.ReportItemExecutor.execute(ReportItemExecutor.java:285)

After some research I found that the problem was the BIRT engine was choking on a dynamic text box (aka MultiLineItem) as the report data is generated into HTML. The report was using Dynamic Text to concatenate the item.description and inventory.issueunit fields, like this:

    BirtStr.left(row["description"], 40) + ' (' + row["issueunit"] + ')'

Changing the field from Dynamic Text element to a Data element with String data type fixed the issue. This was great because it didn't change the output from the report. Shown below are two bin labels, on the left is a Dynamic Text element and on the right is a Data element.

The Dynamic Text element was created with this:

The Data element with a String data type was created with this:

While the visual output from the the report appears to be the same, the underlying HTML must be rendered differently to cause the error. Comparing the HTML output of each element would show the differences:

Dynamic Text Element:

<tr style=" height: 0.333in;" valign="bottom">
    <td class="style_12" colspan="2">
        <div style=" text-align:center;">FILTER, AIR, MINI PLEAT, 24 X 24 X 12, F (EA)</div>
    </td>
</tr>

Data Element:

<tr style=" height: 0.333in;" valign="bottom">
    <td class="style_12" colspan="2">
        <div style=" text-align:center;">FILTER, AIR, MINI PLEAT, 24 X 24 X 12, F (EA)</div>
    </td>
</tr>

See! They're... uh, umm.... exactly the same.

So what's the root cause of the error? No clue.2 Just know if you get an stack trace related to MultiLineItem, change the field from Dynamic Text to a Data element with a String data type.


  1. The entire stack trace was much longer, but this was the crucial piece. 

  2. While the rendered HTML is identical, my guess is there was a character string that choked in a .js script that BIRT uses to communicate with some Java class files to parse the raw data to render the output HTML. 

Comments

Top