Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Login screen causes a null pointer exception in ExceptionHandler.handleException(Throwable t)(Login screen causes a null pointer exception in ExceptionHandler.handleException(Throwable t))
Login screen causes a null pointer exception in ExceptionHandler.handleException(Throwable t) [message #659539] Mon, 14 March 2011 13:37 Go to next message
Philippe NEMBRARD is currently offline Philippe NEMBRARDFriend
Messages: 9
Registered: August 2010
Junior Member
We have a RAP application based on 1.3 M3, its contents depends on the user authorizations.
That's why we implemented an ApplicationWindow. It is called in the IEntryPoint.createUI().
We do call the Window.run() method.
Here is the code

public void run()
{
// Don't return from open() until window closes
setBlockOnOpen(true);

// Set the shell style
setShellStyle(SWT.TITLE);

// Open the main window
open();
}

So this blocks until the window closes, and then we create the workbench.
It has worked fine for monthes.

But we have problems on a production environnement. The log is

java.lang.NullPointerException
org.eclipse.ui.internal.ExceptionHandler.handleException(Exc eptionHandler.java:62)
org.eclipse.jface.window.Window.runEventLoop(Window.java:838 )
org.eclipse.jface.window.Window.open(Window.java:810)

The line that seems to cause the problem is
wb.getAdvisor().eventLoopException(t);

Well, I'm confused because that problem did not appear before, and now it appears on
a production environnement...

Ca you give me the reason ?

Otherwise, what is the best way to implement the type of login screen I want ?

Thanks
Re: Login screen causes a null pointer exception in ExceptionHandler.handleException(Throwable t) [message #659724 is a reply to message #659539] Tue, 15 March 2011 11:01 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

it would be interesting whether wb is null or wb.getAdvisor() returns
null. The fact that the workbench exception handler has been set to the
Window suggests that the workbench is already started at this point.

There were a couple of discussions here regarding login dialogs for RAP,
if you search the archives, you'll surely find something.

If not, could you post your createUI() method?


Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Login screen causes a null pointer exception in ExceptionHandler.handleException(Throwable t) [message #659757 is a reply to message #659724] Tue, 15 March 2011 14:12 Go to previous messageGo to next message
Philippe NEMBRARD is currently offline Philippe NEMBRARDFriend
Messages: 9
Registered: August 2010
Junior Member
here is my code

public int createUI()
{
Display display = PlatformUI.createDisplay();
// Display login dialog until logged in
TPMUserInfo userInfo = null;
while (userInfo == null)
{
LoginScreen loginScreen = new LoginScreen(display.getActiveShell());
loginScreen.run();
userInfo = loginScreen.getUserInfo();

if (userInfo != null)
{
// save user info and rights into session
RWT.getSessionStore().setAttribute("userInfo", userInfo);
}
}

// The user is authenticated, start the workbench
if (userInfo != null)
{
PlatformUI.createAndRunWorkbench(display,
new ApplicationWorkbenchAdvisor());
return PlatformUI.RETURN_OK;
}
// User authentication failed, stop application
else
{
return PlatformUI.RETURN_EMERGENCY_CLOSE;
}
}

In this way of coding, I understand that it could cause a problem in org.eclipse.ui.internal.ExceptionHandler.handleException

that is why i patch RAP code as follows

Workbench wb = Workbench.getInstance();
//if (wb != null)
if (wb != null && wb.getAdvisor() != null)
{
wb.getAdvisor().eventLoopException(t);
}


In fact we never had this problem before, but now in the new production environnement the machine is really faster, and i think it is the reason that this problem has revealed.

What is for your the best way of creating a login screen.

Thanks for your answer
Re: Login screen causes a null pointer exception in ExceptionHandler.handleException(Throwable t) [message #659763 is a reply to message #659757] Tue, 15 March 2011 14:24 Go to previous message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
I think the actual problem is caused by bug
340008: Consider Window#setExceptionHandler() to have session scope
https://bugs.eclipse.org/bugs/show_bug.cgi?id=340008

HTH
Rüdiger

On 15.03.2011 15:12, Philippe NEMBRARD wrote:
> here is my code
>
> public int createUI()
> {
> Display display = PlatformUI.createDisplay();
> // Display login dialog until logged in
> TPMUserInfo userInfo = null;
> while (userInfo == null)
> {
> LoginScreen loginScreen = new LoginScreen(display.getActiveShell());
> loginScreen.run();
> userInfo = loginScreen.getUserInfo();
>
> if (userInfo != null)
> {
> // save user info and rights into session
> RWT.getSessionStore().setAttribute("userInfo", userInfo);
> }
> }
>
> // The user is authenticated, start the workbench
> if (userInfo != null)
> {
> PlatformUI.createAndRunWorkbench(display,
> new ApplicationWorkbenchAdvisor());
> return PlatformUI.RETURN_OK;
> }
> // User authentication failed, stop application
> else
> {
> return PlatformUI.RETURN_EMERGENCY_CLOSE;
> }
> }
>
> In this way of coding, I understand that it could cause a problem in
> org.eclipse.ui.internal.ExceptionHandler.handleException
>
> that is why i patch RAP code as follows
>
> Workbench wb = Workbench.getInstance();
> //if (wb != null) if (wb != null && wb.getAdvisor() != null)
> {
> wb.getAdvisor().eventLoopException(t);
> }
>
> In fact we never had this problem before, but now in the new production
> environnement the machine is really faster, and i think it is the reason
> that this problem has revealed.
>
> What is for your the best way of creating a login screen.
>
> Thanks for your answer
Previous Topic:[ANN] Revoked: Platform filters in RAP
Next Topic:DateTime Bug?
Goto Forum:
  


Current Time: Wed Apr 24 23:02:07 GMT 2024

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

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

Back to the top