NPE when lag monitor not enabled

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

guycoleman
Posts: 7
Joined: 20 Jul 2011, 15:58

NPE when lag monitor not enabled

Postby guycoleman » 09 Mar 2012, 10:43

I'm seeing a NullPointer exception in the Java client during logout when the lag monitor is not enabled:

Code: Select all

java.lang.NullPointerException
   at sfs2x.client.SmartFox.handleLogout(SmartFox.java:1196)
   at sfs2x.client.controllers.system.ResLogout.handleResponse(ResLogout.java:23)
   at sfs2x.client.controllers.SystemController.handleMessage(SystemController.java:104)
   at sfs2x.client.core.SFSProtocolCodec.dispatchRequest(SFSProtocolCodec.java:144)
   at sfs2x.client.core.SFSProtocolCodec.onPacketRead(SFSProtocolCodec.java:50)
   at sfs2x.client.core.SFSIOHandler.handlePacketData(SFSIOHandler.java:281)
   at sfs2x.client.core.SFSIOHandler.onDataRead(SFSIOHandler.java:130)
   at sfs2x.client.bitswarm.BitSwarmClient.onSocketData(BitSwarmClient.java:357)
   at sfs2x.client.bitswarm.BitSwarmClient.access$200(BitSwarmClient.java:26)
   at sfs2x.client.bitswarm.BitSwarmClient$3.dispatch(BitSwarmClient.java:105)
   at sfs2x.client.core.EventDispatcher.dispatchEvent(EventDispatcher.java:52)
   at sfs2x.client.core.sockets.TCPSocketLayer.callOnData(TCPSocketLayer.java:144)
   at sfs2x.client.core.sockets.TCPSocketLayer.handleBinaryData(TCPSocketLayer.java:138)
   at sfs2x.client.core.sockets.TCPSocketLayer.access$700(TCPSocketLayer.java:23)
   at sfs2x.client.core.sockets.TCPSocketLayer$NettyIOHandler.messageReceived(TCPSocketLayer.java:273)
   at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
   at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
   at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
   at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:351)
   at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:282)
   at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:202)
   at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
   at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)


Also a similar one when disconnect is called:

Code: Select all

java.lang.NullPointerException
   at sfs2x.client.util.LagMonitor.stop(LagMonitor.java:52)
   at sfs2x.client.SmartFox.reset(SmartFox.java:196)
   at sfs2x.client.SmartFox.onSocketClose(SmartFox.java:1036)
   at sfs2x.client.SmartFox.access$100(SmartFox.java:50)
   at sfs2x.client.SmartFox$2.dispatch(SmartFox.java:160)
   at sfs2x.client.core.EventDispatcher.dispatchEvent(EventDispatcher.java:52)
   at sfs2x.client.bitswarm.BitSwarmClient.dispatchEvent(BitSwarmClient.java:348)
   at sfs2x.client.bitswarm.BitSwarmClient.onSocketClose(BitSwarmClient.java:304)
   at sfs2x.client.bitswarm.BitSwarmClient.access$100(BitSwarmClient.java:26)
   at sfs2x.client.bitswarm.BitSwarmClient$2.dispatch(BitSwarmClient.java:99)
   at sfs2x.client.core.EventDispatcher.dispatchEvent(EventDispatcher.java:52)
   at sfs2x.client.core.sockets.TCPSocketLayer.callOnDisconnect(TCPSocketLayer.java:160)
   at sfs2x.client.core.sockets.TCPSocketLayer.handleDisconnection(TCPSocketLayer.java:125)
   at sfs2x.client.core.sockets.TCPSocketLayer.access$400(TCPSocketLayer.java:23)
   at sfs2x.client.core.sockets.TCPSocketLayer$NettyIOHandler.channelDisconnected(TCPSocketLayer.java:252)
   at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:132)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
   at org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:360)
   at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:595)
   at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:115)
   at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:771)
   at org.jboss.netty.channel.SimpleChannelHandler.disconnectRequested(SimpleChannelHandler.java:334)
   at org.jboss.netty.channel.SimpleChannelHandler.handleDownstream(SimpleChannelHandler.java:286)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
   at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582)
   at org.jboss.netty.channel.Channels.disconnect(Channels.java:689)
   at org.jboss.netty.channel.AbstractChannel.disconnect(AbstractChannel.java:214)
   at sfs2x.client.core.sockets.TCPSocketLayer.disconnect(TCPSocketLayer.java:203)
   at sfs2x.client.bitswarm.BitSwarmClient.disconnect(BitSwarmClient.java:240)
   at sfs2x.client.SmartFox.disconnect(SmartFox.java:494)


Does the Java client support running without the lag monitor?

[edit] fix subject typo
Last edited by guycoleman on 16 Mar 2012, 15:38, edited 1 time in total.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: NPE when log monitor not enabled

Postby ThomasLund » 16 Mar 2012, 15:35

Thanks for reporting - will investigate and fix!

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: NPE when lag monitor not enabled

Postby ThomasLund » 16 Mar 2012, 15:58

Fixed! Thanks
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
guycoleman
Posts: 7
Joined: 20 Jul 2011, 15:58

Re: NPE when lag monitor not enabled

Postby guycoleman » 16 Mar 2012, 16:18

Great, thanks for the quick fix.

Any idea when the new client API will be available?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: NPE when lag monitor not enabled

Postby ThomasLund » 16 Mar 2012, 16:29

Throw me your email in a PM and I can send you a build.

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
User avatar
rgfernan
Posts: 11
Joined: 20 Mar 2010, 00:25
Location: Buenos Aires, Argentina
Contact:

Re: NPE when lag monitor not enabled

Postby rgfernan » 09 May 2012, 19:09

This seems to be happening again with client API of the new version. I go back to release 3 and it works again.
Roberto G. Fernández
Technical Leader

WILLDOM, WE DO IT_
AR: +54 (11) 4821 1582
US: +1 (954) 905 7439
Skype: roberto.g.fernandez
User avatar
Bax
Site Admin
Posts: 4479
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: NPE when lag monitor not enabled

Postby Bax » 11 May 2012, 07:14

rgfernan wrote:This seems to be happening again with client API of the new version. I go back to release 3 and it works again.

With "new version" are you referring to the SmartFoxServer 2.1.0 patch? Because it doesn't contain the API. All API updates are available here: http://www.smartfoxserver.com/download/sfs2x#p=updates
Paolo Bax
The SmartFoxServer Team
User avatar
rgfernan
Posts: 11
Joined: 20 Mar 2010, 00:25
Location: Buenos Aires, Argentina
Contact:

Re: NPE when lag monitor not enabled

Postby rgfernan » 11 May 2012, 13:50

Ok. I meant the libraries on the final release. I will download the updates then.
Thanks.
Roberto G. Fernández
Technical Leader

WILLDOM, WE DO IT_
AR: +54 (11) 4821 1582
US: +1 (954) 905 7439
Skype: roberto.g.fernandez
cristianpark
Posts: 8
Joined: 14 Apr 2008, 15:34

Re: NPE when lag monitor not enabled

Postby cristianpark » 06 Aug 2012, 05:53

I'm facing this too with the newest version available on download links. All I do is

Code: Select all

sfsClient.send(new LogoutRequest());
as you can see on my code here [1], the event is launched when the user is loged and joined into a room (in a simple chat) and he/she press the back button (back to login screen), I register the listener but I can't get to the log on the dispatch method since I'm having the null pointer error

Thanks in advance

[1] http://sourceforge.net/p/chattered/code ... tered.java

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 2 guests