Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » NullPointerException in themes.ColorAndFontProviderImpl(NPE in ColorAndFontProviderImp after git clone)
icon4.gif  NullPointerException in themes.ColorAndFontProviderImpl [message #1751126] Wed, 04 January 2017 16:25 Go to next message
Bob Bobson is currently offline Bob BobsonFriend
Messages: 13
Registered: April 2016
Junior Member
Dear E4 Community,

I would really appreciate your help with solving a very frustrating problem that has been blocking my work since yesterday.

I have been developing an E4 based RCP app for the last few weeks. Its working fine on my main computer but yesterday morning i wanted computer for testing. Since everything is checked into a git repository i thought it would be easy. I did the following:

    Made sure that everything was working and committed on the dev PC
    Cloned the repositories containing my features and plug ins onto the new Test PC
    Set the Target platform on the test pc to my applications target platform
    Ran the application on the test pc through its product file


At this point the application started but threw a lot of instances of the following exception:

[color=red]java.lang.NullPointerException
	at org.eclipse.ui.internal.themes.ColorAndFontProviderImpl.getCurrentTheme(ColorAndFontProviderImpl.java:37)
	at org.eclipse.ui.internal.themes.ColorAndFontProviderImpl.getColor(ColorAndFontProviderImpl.java:33)
	at org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper.findColorByDefinition(CSSSWTColorHelper.java:328)
	at org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper.getRGBA(CSSSWTColorHelper.java:73)
	at org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper.getGradient(CSSSWTColorHelper.java:229)
	at org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTGradientConverterImpl.convert(CSSValueSWTGradientConverterImpl.java:46)
	at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.convert(AbstractCSSEngine.java:1111)
	at org.eclipse.e4.ui.css.swt.properties.custom.CSSPropertye4SelectedTabFillHandler.applyCSSProperty(CSSPropertye4SelectedTabFillHandler.java:46)
	at org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler.applyCSSProperty(AbstractCSSPropertySWTHandler.java:33)
	at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyCSSProperty(AbstractCSSEngine.java:756)
	at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyleDeclaration(AbstractCSSEngine.java:542)
	at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:408)
	at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:357)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.applyStyles(ThemeEngine.java:516)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.setClassnameAndId(PartRenderingEngine.java:1288)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.setCSSInfo(SWTPartRenderer.java:112)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.bindWidget(SWTPartRenderer.java:129)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.createWidget(StackRenderer.java:650)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:975)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:651)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:728)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:722)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:70)
	at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:142)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:665)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:728)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:722)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:70)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveRenderer.processContents(PerspectiveRenderer.java:49)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:665)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:728)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:722)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:82)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:72)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4813)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:211)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:94)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:135)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:108)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:63)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:669)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:728)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:722)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:70)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:725)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:665)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:728)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:722)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1059)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:161)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)[/color]


Running it in the debugger the line of code at is:

		return Workbench.getInstance().getThemeManager().getCurrentTheme();


And Workbench.getInstance() is returning null, which really doesn't sound good!

The application is actually running and seems to function normally (although it all looks weird due to the lack of styling).

I I have spent the last two days fiddling with the target platform and plugins, trying to figure out the difference between the two machine setups, without any luck. Any help would be greatly appreciated.

Thanks in advance!

P.S I'm still relatively new to E4 and RCP development and so may be doing something stupid.

Re: NullPointerException in themes.ColorAndFontProviderImpl [message #1751373 is a reply to message #1751126] Mon, 09 January 2017 13:41 Go to previous messageGo to next message
Bob Bobson is currently offline Bob BobsonFriend
Messages: 13
Registered: April 2016
Junior Member
Update.

I have now been able to get rid of the above problem. In the end completely re-did my target platform specification and product configuration from scratch. The problem then simply disappeared.

I would still be interested in understanding what the actual problem was though, if anyone has any ideas?
Re: NullPointerException in themes.ColorAndFontProviderImpl [message #1752079 is a reply to message #1751373] Wed, 18 January 2017 16:21 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 788
Registered: January 2012
Senior Member

It's hard to know why it went wrong without seeing your full log. For some reason, the workbench wasn't started. There are a bunch of reasons that might happen, including using a mismatched JVM (32-bit vs 64-bit).

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: NullPointerException in themes.ColorAndFontProviderImpl [message #1792623 is a reply to message #1751126] Fri, 20 July 2018 10:10 Go to previous message
Chris Gordon is currently offline Chris GordonFriend
Messages: 1
Registered: September 2016
Junior Member
I had this error as well, after following Lars' new online tutorial (todo rcp application).

I fixed it by replacing the contents list in my product:
Before fix:
com.example.e4.rcp.todo.feature
org.eclipse.platform (I put this in based on an existing product I'm supporting, as it required additional plugins from this feature)
org.eclipse.emf.common
org.eclipse.emf.ecore

After fix:
com.example.e4.rcp.todo.feature
org.eclipse.e4.rcp (this is what lars recommended)
org.eclipse.emf.common
org.eclipse.emf.ecore


Here were the steps to reproduce the problem:
Create a todo product, with the 3 different panels, a basic rcp product shell with an application model 3 view pojos containing JUST @PostConstruct
create an osgi todoservice that is injected into the TodoOverviewPart
relaunch from the product file, in the launcher created, validate
click "add required plugins" (it added about 13 plugins)
Same error

tried again, deleting launcher and product workspace. This time I explicitly added JUST the plugins it complained were missing to the launcher, in this order:
org.eclipse.ecf
org.eclipse.ecf.filetransfer
org.eclipse.ecf.provider.filetransfer
org.eclipse.ecf.identity
org.eclipse.equinox.concurrent (it asked for org.eclipse.equinox.concurrent.future, which wasn't there, so I added this one instead)
same error.

Switched to the org.eclipse.e4.rcp feature instead of org.eclipse.platform, deleted launcher and product workspace, launched from product file, error went away and it didn't require validating and adding plugins in the launcher file.

Only items in my target platform are (exactly what the tutorial instructs):
Eclipse Platform SDK 4.8.0.I20180611-0500
Equinox Target Components 3.14.0.v0180518-2029

I'm too much of a noob to figure out whether or not this is a bug or some configuration error on my part. When using the e4.rcp feature in the product it does not pull in the ecf or concurrent depenencies mentioned above, but nothing else is different other than bringing a feature that is a superset of the correct one.

I hope that helps someone.
Previous Topic:Command handlers are no longer activated after migration to E4
Next Topic:Programmatically update all tooltips when context changes?
Goto Forum:
  


Current Time: Fri Nov 16 13:27:28 GMT 2018

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

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

Back to the top