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

Bug 396786

Summary: NPE in UIThread when refreshing the browser without closing the workbench
Product: [RT] RAP Reporter: Benjamin Wolff <eclipse>
Component: WorkbenchAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1    
Version: 2.0   
Target Milestone: 2.0 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Benjamin Wolff CLA 2012-12-17 14:32:07 EST
When refreshing a RAP application (or simply re-entering the URL) without prior closing of the workbench, the UIThread throws an NPE while disposing the workbench. This does not happen when the workbench is closed before using the 'Exit' Menu. Hoewever, the application seems to run despite this exception.

This problem can be reproduced with the Workbench Demo and using the current git master bundles.

Here is the stacktrace that is created.


Exception in thread "UIThread [1gieyctp5kcia170xq97gsxke9]" java.lang.NullPointerException
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1252)
	at java.util.ResourceBundle.getBundle(ResourceBundle.java:1028)
	at org.eclipse.rap.rwt.RWT$NLS.getISO8859_1Encoded(RWT.java:118)
	at org.eclipse.ui.internal.WorkbenchMessages.get(WorkbenchMessages.java:1143)
	at org.eclipse.ui.internal.Workbench$13.handleException(Workbench.java:1128)
	at org.eclipse.core.runtime.SafeRunner.handleException(SafeRunner.java:75)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:44)
	at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:1118)
	at org.eclipse.ui.internal.Workbench.access$12(Workbench.java:1071)
	at org.eclipse.ui.internal.Workbench$21.run(Workbench.java:1337)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66)
	at org.eclipse.ui.internal.Workbench.close(Workbench.java:1335)
	at org.eclipse.ui.internal.Workbench.close(Workbench.java:1297)
	at org.eclipse.ui.internal.Workbench$ShutdownHandler.handleEvent(Workbench.java:387)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:85)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:622)
	at org.eclipse.swt.widgets.Display.sendDisposeEvent(Display.java:698)
	at org.eclipse.swt.widgets.Display.release(Display.java:681)
	at org.eclipse.swt.graphics.Device.dispose(Device.java:288)
	at org.eclipse.rap.rwt.internal.lifecycle.UIThread.processShutdown(UIThread.java:169)
	at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:317)
	at java.lang.Thread.run(Thread.java:722)
	at org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:104)
Comment 1 Ivan Furnadjiev CLA 2012-12-18 02:40:11 EST
I got similar NPE on Workbench Demo start:
!ENTRY org.eclipse.core.jobs 4 2 2012-12-18 09:39:11.863
!MESSAGE An internal error occurred during: "Decoration Calculation".
!STACK 0
java.lang.NullPointerException
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1252)
	at java.util.ResourceBundle.getBundle(ResourceBundle.java:1028)
	at org.eclipse.rap.rwt.RWT$NLS.getISO8859_1Encoded(RWT.java:118)
	at org.eclipse.ui.internal.WorkbenchMessages.get(WorkbenchMessages.java:1143)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$4.doRun(DecorationScheduler.java:352)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$4$1.run(DecorationScheduler.java:321)
	at org.eclipse.rap.rwt.internal.lifecycle.ContextUtil.runNonUIThreadWithFakeContext(ContextUtil.java:67)
	at org.eclipse.rap.rwt.internal.service.UISessionImpl.exec(UISessionImpl.java:167)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$4.run(DecorationScheduler.java:319)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Comment 2 Ivan Furnadjiev CLA 2012-12-18 03:25:11 EST
The problem is in RWT#getLocale() which returns null in case of fake context.
Comment 3 Ivan Furnadjiev CLA 2012-12-18 05:17:42 EST
Fixed with commit e54811202a7842ddcd6bbaa7af18fcd2da8a28ae.
Comment 4 Benjamin Wolff CLA 2012-12-18 12:55:19 EST
Hi Ivan,

I can confirm that this bug does not occur anymore, nice!

And you receive the Academy Award for short bug-report-to-resolve-time, yet again :D.