Community
Participate
Working Groups
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.
What version of the source are you looking at? I don't see a method ViewRegistry.saveState(IMemento) in 3.4 or 3.5 stream. Can you attach the stack trace?
Created attachment 141159 [details] Stack trace
I'm sorry, it is the ViewFactory class instead of ViewRegistry. I'm using 3.5 (Galileo Release from June, 24th). Stack trace is attached. (In reply to comment #1) > What version of the source are you looking at? I don't see a method > ViewRegistry.saveState(IMemento) in 3.4 or 3.5 stream. Can you attach the > stack trace? >
Would you be able to contribute a patch?
(In reply to comment #4) > Would you be able to contribute a patch? I'm not sure how to contribute a patch. If this means to provide a fixed source file, class file or plugin jar, then I am. Otherwise please tell me what you expect. I have checked out the corresponding code, added the described null check and tested it running into the next NullPointerException while saving the perspective state (now instead of viewstate) because of the same problem (IViewDescriptor is null because of disabled xp activities). I'll attach this stack trace too. This leads me to the assumption, that there has to be generally thought about dealing with expression based activities and UI elements that may be no longer available when disabling such activites.
Created attachment 141272 [details] Stack trace after local fix of the original problem
(In reply to comment #5) > (In reply to comment #4) > > Would you be able to contribute a patch? > > I'm not sure how to contribute a patch. If this means to provide a fixed source > file, class file or plugin jar, then I am. Otherwise please tell me what you > expect. Sorry, I should have given you the pointer right away: http://wiki.eclipse.org/Platform_UI/How_to_Contribute#Creating_a_Patch
Created attachment 141390 [details] Patch for both ViewFactory and Perspective null check
(In reply to comment #5) > This leads me to the assumption, that there has to be generally thought about > dealing with expression based activities and UI elements that may be no longer > available when disabling such activites. I agree that this is not yet a well-tested mechanism. Thanks for filing this bug and attaching a patch, looking forward to more of those! ;-)
Patch looks fine and safe and I also learned something new from it! Grrrrrrrrrrreat! Thanks for your contribution, Sascha!
Released to R3_5_maintenance.
Sascha, would you be able to verify that the NPE does not occur anymore when using a 3.5.1 candidate build?
(In reply to comment #12) > Sascha, would you be able to verify that the NPE does not occur anymore when > using a 3.5.1 candidate build? I like to verify it, but please give me a few days, I'm currently very busy...