Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Using the LocalResourceManager causes NPE after RAP update 2.3
Using the LocalResourceManager causes NPE after RAP update 2.3 [message #1396622] Tue, 08 July 2014 15:08 Go to next message
Flavio Donze is currently offline Flavio DonzeFriend
Messages: 179
Registered: July 2009
Location: Switzerland
Senior Member
Hello

For single sourcing I have a own ResourceManager, one for RAP and one for RCP.
In this ResourceManager I use the org.eclipse.jface.resource.LocalResourceManager.

After updating RAP, from 2.2 to 2.3 I get the posted exception after the second session is started.

I traced it down to the Resource handling, changing the following code helped,
from
return getResourceManager().createImage(descriptor); // getResourceManager() => LocalResourceManager
to
return descriptor.createImage();

My question is, does RAP handle those images, is it save or could this create a memory leak?

greets and thanks in advance
Flavio

java.lang.NullPointerException: null
at org.eclipse.swt.graphics.Image.getImageData(Image.java:347) ~[na:na]
at org.eclipse.jface.resource.ImageDataImageDescriptor.<init>(ImageDataImageDescriptor.java:36) ~[na:na]
at org.eclipse.jface.resource.ImageDescriptor.createFromImage(ImageDescriptor.java:146) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPartReference.computeImageDescriptor(WorkbenchPartReference.java:337) ~[na:na]
at org.eclipse.ui.internal.EditorReference.computeImageDescriptor(EditorReference.java:420) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPartReference.refreshFromPart(WorkbenchPartReference.java:330) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:611) ~[na:na]
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:310) ~[na:na]
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:185) ~[na:na]
at ch.scodi.rap.design.stacks.ViewStackPresentation.selectPart(ViewStackPresentation.java:763) ~[na:na]
at org.eclipse.rap.ui.interactiondesign.internal.ConfigurableStackProxy.selectPart(ConfigurableStackProxy.java:424) ~[na:na]
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1262) ~[na:na]
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1215) ~[na:na]
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1614) ~[na:na]
at org.eclipse.ui.internal.PartStack.add(PartStack.java:508) ~[na:na]
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:106) ~[na:na]
at org.eclipse.ui.internal.PartStack.add(PartStack.java:494) ~[na:na]
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:115) ~[na:na]
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:65) ~[na:na]
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225) ~[na:na]
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213) ~[na:na]
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:775) ~[na:na]
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:673) ~[na:na]
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:633) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2855) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2763) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2755) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2706) ~[na:na]
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2702) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2686) ~[na:na]
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2669) ~[na:na]
at com.softmodeler.ui.UIUtil.openEditor(UIUtil.java:337) ~[na:na]
at com.softmodeler.ui.UIUtil.openViewerEditor(UIUtil.java:305) ~[na:na]
at ch.scodi.ui.rap.viewer.ViewerUtil.openEntryLevelDocument(ViewerUtil.java:641) ~[na:na]
at ch.scodi.ui.rap.viewer.ApplicationWorkbenchWindowAdvisor.postWindowCreate(ApplicationWorkbenchWindowAdvisor.java:209) ~[na:na]
at org.eclipse.ui.internal.WorkbenchWindow.fireWindowCreated(WorkbenchWindow.java:1407) ~[na:na]
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:780) ~[na:na]
at org.eclipse.ui.internal.Workbench$20.runWithException(Workbench.java:1286) ~[na:na]
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:32) ~[na:na]
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:230) ~[na:na]
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) ~[na:na]
at org.eclipse.swt.widgets.Display.syncExec(Display.java:1092) ~[na:na]
at org.eclipse.ui.internal.StartupThreading.runWithWorkbenchExceptions(StartupThreading.java:55) ~[na:na]
at org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Workbench.java:1283) ~[na:na]
at org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Workbench.java:2061) ~[na:na]
at org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbench.java:1992) ~[na:na]
at org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWindow(WorkbenchConfigurer.java:188) ~[na:na]
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:790) ~[na:na]
at org.eclipse.ui.internal.Workbench$27.runWithException(Workbench.java:1640) ~[na:na]
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:32) ~[na:na]
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:230) ~[na:na]
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150) ~[na:na]
at org.eclipse.swt.widgets.Display.syncExec(Display.java:1092) ~[na:na]
at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:110) ~[na:na]
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1635) ~[na:na]
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2655) ~[na:na]
at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530) ~[na:na]
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:701) ~[na:na]
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) ~[na:na]
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:684) ~[na:na]
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157) ~[na:na]
at com.softmodeler.ui.rap.RAPApplication.createUI(RAPApplication.java:157) ~[na:na]
at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:172) ~[na:na]
at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:284) ~[na:na]
at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_60]
at org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:105) ~[na:na]


Organisations- und Prozessdokumentation Software
Qualit├Ąt Management QMS :: Information Management IMS
http://www.scodi.ch
Re: Using the LocalResourceManager causes NPE after RAP update 2.3 [message #1400457 is a reply to message #1396622] Mon, 14 July 2014 08:13 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1959
Registered: July 2009
Senior Member
Hi Flavio,
if the NPE is introduced in RAP 2.3 please open a bugzilla and we will
investigate the cause. Snippet to reproduce the exception is welcomed.
Why do you think that descriptor.createImage() could create a memory leak?
Best,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Using the LocalResourceManager causes NPE after RAP update 2.3 [message #1400483 is a reply to message #1400457] Mon, 14 July 2014 09:03 Go to previous message
Flavio Donze is currently offline Flavio DonzeFriend
Messages: 179
Registered: July 2009
Location: Switzerland
Senior Member
Hi Ivan

Thanks for your reply.
I once read an artikel about eclipse and resources, that you should use a ResourceManager for Images, Fonts and Colors.
Otherwise resources are not disposed or so...

But if you say descriptor.createImage() does not bring any problemns, my question is answered.

The NPE was a result of using the LocalResourceManager, so I won't create an issue.

greets
Flavio


Organisations- und Prozessdokumentation Software
Qualit├Ąt Management QMS :: Information Management IMS
http://www.scodi.ch
Previous Topic:Tooltips in TreeViewer
Next Topic:UI component not reclaimed
Goto Forum:
  


Current Time: Mon May 25 17:55:32 GMT 2015

Powered by FUDForum. Page generated in 0.02852 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software