Project: Eclipse_Platform_UI
Bug 282874 [ViewMgmt] [ActivityMgmt] NullpointerException during saving state of view registry with disabled xp based activities
Reported: 2009-07-08 11:16:47 | Status: resolved fixed

I'm using expression based activities and perspectives to provide UI elements depending on a user's role. Login/logout sets a variable of a custum source provider describing the user's role and triggers the expressions used to enable/disable some activies. After successful login a role specific perspective is shown. After logout (also implicitly done before closing the workbench) with disabling the acitivies and closing the workbench ViewRegistry#saveState(IMemento) raises a NullPointerException. The line 287 IViewDescriptor desc = viewReg.find(refs[i].getId()); returns null because of the (during logout) disabled activities for views that were part of the role specific perspective and subsequent causes the NullPointerException. From my point of view this has to be at least checked against null.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewFactory.java