Page 1 of 1

USER_DISCONNECT return null user

Posted: 18 Apr 2013, 12:32
by grhwood
Hi,

I have a ServerEventHandler that catch the USER_DISCONNECT event like the following code:

Code: Select all

public void handleServerEvent(ISFSEvent event) throws SFSException {
      User user = (User) event.getParameter(SFSEventParam.USER);
      List<Room> joinedRooms = (List<Room>) event.getParameter(SFSEventParam.JOINED_ROOMS);
   }


The problem is I get the user variable null sometime.

Thanks,

Re: USER_DISCONNECT return null user

Posted: 18 Apr 2013, 13:53
by Lapo
Hi,
this one sounds perplexing. Unless you are using (maybe) a very old version of the server there doesn't seem to be any possibility for this to happen.
If the user object is null there is no way that an event will be dispatched because no action is taken to begin with.

Are you absolutely sure that this is what is happening?
Can you verify that you're running a recent version of the server, possibly the latest? (version 2.6.x)

Thanks

Re: USER_DISCONNECT return null user

Posted: 18 Apr 2013, 14:01
by grhwood
Yes, I'm using the latest 2.6.0

Re: USER_DISCONNECT return null user

Posted: 18 Apr 2013, 14:26
by Lapo
Can you show the NullPointerException that you are getting with the full stack trace? You should have it in the logs.
Thanks

Re: USER_DISCONNECT return null user

Posted: 22 Apr 2013, 09:34
by grhwood
Hi, sorry for the delay, I've double check it, I attached the wrong event handler to event :(

Thanks,