From 611c29cf1ced3e7c6b6e53e5805b8473d175805c Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Thu, 28 Sep 2023 21:50:30 +0200 Subject: [PATCH] Fix of images which are embedded like URL on an embedded html document into a birt report element (e.g. dynamic text) (#1436) --- .../engine/emitter/html/HTMLReportEmitter.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java index 808fe24d51..0d0b994c7e 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java @@ -3302,16 +3302,15 @@ public BackgroundImageInfo handleStyleImage(String uri, boolean isBackground, IS ReportDesignHandle design = (ReportDesignHandle) runnable.getDesignHandle(); URL url = design.findResource(uri, IResourceLocator.IMAGE, reportContext.getAppContext()); String fileExtension = null; - Module module = design.getModule(); - BackgroundImageInfo backgroundImage = null; + ResourceLocatorWrapper rl = null; + ExecutionContext exeContext = ((ReportContent) this.report).getExecutionContext(); + if (exeContext != null) { + rl = exeContext.getResourceLocator(); + } + BackgroundImageInfo backgroundImage = new BackgroundImageInfo("", null, 0, 0, 0, 0, rl, module); if (isBackground && imageStyle != null) { - ResourceLocatorWrapper rl = null; - ExecutionContext exeContext = ((ReportContent) this.report).getExecutionContext(); - if (exeContext != null) { - rl = exeContext.getResourceLocator(); - } String uriString = EmitterUtil.getBackgroundImageUrl(imageStyle, design, this.report.getReportContext() == null ? null : this.report.getReportContext().getAppContext()); @@ -3375,7 +3374,9 @@ public BackgroundImageInfo handleStyleImage(String uri, boolean isBackground, IS default: assert (false); } - backgroundImage.setUri(imgUri); + if (backgroundImage != null) { + backgroundImage.setUri(imgUri); + } } return backgroundImage; }