NPE when added chart [message #1386676] |
Thu, 19 June 2014 11:51 |
Anatoliy Pogorelov Messages: 10 Registered: April 2013 |
Junior Member |
|
|
Hi,
in my RAP application used BIRT reports. My report is not work when added chart. In BIRT persepcive preview report show good(image 1.png). When report formed from RAP I give NPE. Without chart report show good from RAP application (image 2.png).
What am I doing wrong?
SEVERE: An error happened while running the report. Cause:
java.lang.NullPointerException
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:980)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localizeForeign(LocalizedContentVisitor.java:591)
at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:176)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:37)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
My call procedure:
EngineConfig config = null;
IReportEngine engine = null;
IReportRunnable design = null;
IRunAndRenderTask task;
URL url = getReportURL(reportMnemonic);
config = new EngineConfig();
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
InputStream fs = null;
try {
fs = url.openStream();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
design = engine.openReportDesign(fs);
setConnectionProperties(design);
task = engine.createRunAndRenderTask(design);
HTMLRenderOption renderOptions = new HTMLRenderOption();
renderOptions.setOutputFormat(HTMLRenderOption.HTML);
renderOptions.setOutputStream(outputStream);
renderOptions.setImageDirectory(System.getProperty("java.io.tmpdir"));
renderOptions.setSupportedImageFormats("PNG");
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler() {
@Override
public String onCustomImage(IImage image, Object context) {
return registerImage(image, context);
}
@Override
public String onDesignImage(IImage image, IReportContext context) {
super.onDocImage(image, context);
return "/" + registerImage(image, context);
}
@Override
public String onDocImage(IImage image, IReportContext context) {
super.onDocImage(image, context);
return "/" + registerImage(image, context);
}
private String registerImage(IImage image, Object context) {
byte[] imageData = image.getImageData();
ByteArrayInputStream imageDatainputStream = new ByteArrayInputStream(imageData);
String fileName = image.getID();
RWT.getApplicationContext().getResourceManager().register(fileName, imageDatainputStream);
try {
imageDatainputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
return fileName;
}
};
renderOptions.setImageHandler(imageHandler);
task.setRenderOption(renderOptions);
task.run();
task.close();
engine.destroy();
return outputStream;
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02977 seconds