question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scripted negative margin causes report execution to break for multiple pages

See original GitHub issue

To reproduce the error you can use the files in the attachment:

  • With the first report parameter P_PATH you should point to a directory where the files resist (“/” or “\” at the end!)

P_PATH=directory with files

  • The second parameter P_GSIZE is intended for switching between small and big header image output.

  • P_KOPF conrols the gap on next pages between page top and start of the content. Further it causes scripted negative margin of -10mm (default) so that the header from the master page will be covered with the report content.

Settings when the report breaks:

P_GSIZE=G P_CONTENT=I

org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
	at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2379)
	at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:325)
	at more.software.reporting.ExecuteReport.executeReport(ExecuteReport.java:314)
	at more.software.reporting.ExecuteReport.run(ExecuteReport.java:515)
Caused by: java.lang.NullPointerException: Cannot read field "segments" because "border" is null
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.drawBorder(PageDeviceRender.java:1113)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.drawTableBorder(PageDeviceRender.java:1333)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.endContainer(PageDeviceRender.java:591)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:190)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:189)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:189)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:189)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:189)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:189)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:189)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:189)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitChildren(PageDeviceRender.java:200)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.addPage(PageDeviceRender.java:546)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitPage(PageDeviceRender.java:511)
	at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.visitContainer(PageDeviceRender.java:184)
	at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:278)
	at org.eclipse.birt.report.engine.layout.emitter.PageEmitter.startPage(PageEmitter.java:51)
	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.outputPage(LayoutEngine.java:961)
	at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.outputPage(PageArea.java:707)
	at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.close(PageArea.java:687)
	at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.close(RootArea.java:248)
	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.closeContainer(LayoutEngine.java:374)
	at org.eclipse.birt.report.engine.nLayout.LayoutEngine._endContainer(LayoutEngine.java:495)
	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.endContainer(LayoutEngine.java:359)
	at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.endPage(ContentEmitterAdapter.java:70)
	at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.endContent(ContentEmitterUtil.java:102)
	at org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.endContainer(DummyPageBuffer.java:61)
	at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.end(HTMLPageLM.java:183)
	at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:98)
	at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
	at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:682)
	at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:321)
	... 2 more

birttest.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
hvbtupcommented, Jan 21, 2022

I corrected your test report in such a way that it actually works. The P_PATH param must include a trailing backslash (on Windows), otherwise the images are not displayed. birttest.zip

With a BIRT 4.2.1 All-In-One-Designer the report looks like test_preview_eclipse_ok.pdf.

The lorem ipsum text is truncated between the bottom of page 1 and the top of page 2, but I think this is what is intended.

Then I tested the report from the All-In-One-Designer which I built from the GitHub sources a few days ago. And I could not reproduce your problem - it does not crash and the report looks the same as with BIRT 4.2.1

You said that you are using org.eclipse.birt.runtime_4.9.0-20190523. This is quite old - probably the bug has been fixed already. It might be related to some older bugfix which introduced new problems and which I reverted somewhere after 2019.

So you should try with the current BIRT sources from GitHub. But be warned, it is not yet perfect, e.g. the POJO runtime doesn’t work at the moment. You can help improving this situation by contributing 😃

As a side note: I said that we are using the same trick. But we do it only for the first page. Like you, we are using grafik to hide the header on the first page. In the layout, we are using a negative top-margin for the top-most layout element, which in our case is a separate object that only is displayed once (at the beginning of the layout.

What we don’t do is to use a negative margin for layout objects on subsequent pages, and we don’t set the margin dynamically in the onCreate event. So we are not exactly in the same situation.

0reactions
hvbtupcommented, Jan 21, 2022

PLS take a look at the (fixed) issue https://github.com/eclipse/birt/issues/636 - this might be related

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Definitive Guide to Using Negative Margins
It does not break the flow of the page if applied to elements without floats. So if you use a negative margin to...
Read more >
Negative Stress Margins – Are They Real?
The purpose of this paper is to discuss various situations wherein negative stress margins are not real, to raise the awareness about how...
Read more >
4.9 Work with the Report Layout - Oracle Help Center
Margin, Header Page, or Trailer Page Objects. Move Objects ... To select multiple objects, click one object, then Shift-click all other objects.
Read more >
Negative Stress Margins – Are They Real? - ResearchGate
Margins of safety are also often evaluated using local stresses for various design concepts and design parameters quickly once analysis models ...
Read more >
Puppeteer documentation - DevDocs
js script that downloads headless_shell instead of Chromium to save disk space. you're bundling Puppeteer to use in Chrome Extension / browser with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found