Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347967

Summary: Logging throws an NPE in the EntryPoint before creating the WorkbenchAdvisor
Product: [RT] RAP Reporter: Serge Démoulin <serge_demoulin68>
Component: WorkbenchAssignee: Project Inbox <rap-inbox>
Status: ASSIGNED --- QA Contact:
Severity: minor    
Priority: P3    
Version: 1.4   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Serge Démoulin CLA 2011-06-01 11:50:02 EDT
Build Identifier: 

The call of org.eclipse.core.runtime.Plugin.getBundle().log(IStatus) produce an NPE when called before the creation of the WorkbenchAdvisor.
The cause is that org.eclipse.ui.internal.Workbench.getInstance().getAdvisor().getWorkbenchErrorHandler().handle() is indirectly called and Workbench.getInstance() returns null (see stacktrace under). Precision : at the start of the OSGi platform the logging was possible without NPE from the start() methods of the plugins.

In my case the workaround is to create the WorkbenchAdvisor first.

STACK TRACE
java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchErrorHandlerProxy.handle(WorkbenchErrorHandlerProxy.java:35)
	at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:189)
	at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:231)
	at org.eclipse.ui.statushandlers.StatusManager$StatusManagerLogListener.logging(StatusManager.java:305)
	at org.eclipse.core.internal.runtime.RuntimeLog.logToListeners(RuntimeLog.java:160)
	at org.eclipse.core.internal.runtime.PlatformLogWriter.logged(PlatformLogWriter.java:100)
	at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.safeLogged(ExtendedLogReaderServiceFactory.java:84)
	at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.logPrivileged(ExtendedLogReaderServiceFactory.java:165)
	at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.log(ExtendedLogReaderServiceFactory.java:146)
	at org.eclipse.equinox.log.internal.ExtendedLogServiceFactory.log(ExtendedLogServiceFactory.java:65)
	at org.eclipse.equinox.log.internal.ExtendedLogServiceImpl.log(ExtendedLogServiceImpl.java:87)
	at org.eclipse.equinox.log.internal.LoggerImpl.log(LoggerImpl.java:54)
	at org.eclipse.core.internal.runtime.Log.log(Log.java:60)
	at de.markant.infrastructure.util.log.InfrastructureLogUtil.log(InfrastructureLogUtil.java:32)
	at de.markant.infrastructure.util.log.InfrastructureLogUtil.log(InfrastructureLogUtil.java:24)
	at de.markant.infrastructure.util.log.InfrastructureLogUtil.log(InfrastructureLogUtil.java:63)
	at de.markant.infrastructure.util.log.InfrastructureLogUtil.log(InfrastructureLogUtil.java:50)
	at de.markant.infrastructure.util.log.InfrastructureLogUtil.log(InfrastructureLogUtil.java:42)
	at de.markant.infrastructure.util.log.InfrastructureLogUtil.log(InfrastructureLogUtil.java:73)
	at de.markant.zas.web.erfassung.ui.application.ZasWebErfassungEntryPoint.createUI(ZasWebErfassungEntryPoint.java:59)
	at de.markant.zas.web.erfassung.ui.application.ZasWebErfassungEntryPoint.createUI(ZasWebErfassungEntryPoint.java:120)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:73)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:211)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:88)
	at java.lang.Thread.run(Thread.java:595)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)

Reproducible: Always

Steps to Reproduce:
Call 'org.eclipse.core.runtime.Plugin.getBundle().log(IStatus)' as first instruction in the methods createUI() of the EntryPoint. #
I didn't try with an Application.
Comment 1 Serge Démoulin CLA 2011-06-01 11:51:51 EDT
The RAP Version was the 1.4.0-RC2