NPE at user logout

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

Moderators: Lapo, Bax

Post Reply
cristianpark
Posts: 8
Joined: 14 Apr 2008, 15:34

NPE at user logout

Post by cristianpark »

Hi guys

I'm working on a simple chat (http://sourceforge.net/projects/chattered/) and I'm adding functionality (SQLLite user DB for remember logged user) and I want to make the logout process for the user (switch user) and when I fire the LogoutEvent I get a NPE. This is my output:

Code: Select all

08-06 16:47:10.100: W/System.err(5603): 31516 [main] INFO sfs2x.client.core.SFSProtocolCodec - Writing message Binary size: 3
08-06 16:47:10.100: W/System.err(5603): 12 00 00                                        	...             
08-06 16:47:10.116: W/System.err(5603): 31532 [main] INFO sfs2x.client.core.SFSIOHandler - Data written: Binary size: 20
08-06 16:47:10.116: W/System.err(5603): 12 00 03 00 01 61 03 00 02 00 01 63 02 00 00 01 	.....a.....c....
08-06 16:47:10.116: W/System.err(5603): 70 12 00 00                                     	p...            
08-06 16:47:10.155: W/System.err(5603): 31572 [New I/O client worker #1-1] INFO sfs2x.client.core.EventDispatcher - Dispatching event OnData to 1 listeners
08-06 16:47:10.155: W/System.err(5603): 31573 [New I/O client worker #1-1] INFO sfs2x.client.core.SFSIOHandler - Data Read: Binary size: 42
08-06 16:47:10.155: W/System.err(5603): 80 00 27 12 00 03 00 01 61 03 00 02 00 01 63 02 	..'.....a.....c.
08-06 16:47:10.155: W/System.err(5603): 00 00 01 70 12 00 01 00 02 7A 6E 08 00 0C 42 61 	...p.....zn...Ba
08-06 16:47:10.155: W/System.err(5603): 74 61 6C 6C 61 4E 61 76 61 6C                   	tallaNaval      
08-06 16:47:10.155: W/System.err(5603): 31573 [New I/O client worker #1-1] INFO sfs2x.client.core.SFSIOHandler - Handling New Packet of size 42
08-06 16:47:10.155: W/System.err(5603): 31573 [New I/O client worker #1-1] INFO sfs2x.client.core.SFSIOHandler - Handling Header Size. Length: 41 (small)
08-06 16:47:10.155: W/System.err(5603): 31573 [New I/O client worker #1-1] INFO sfs2x.client.core.SFSIOHandler - Data size is 39
08-06 16:47:10.155: W/System.err(5603): 31574 [New I/O client worker #1-1] INFO sfs2x.client.core.SFSIOHandler - Handling Data: 39, previous state: 0/39
08-06 16:47:10.155: W/System.err(5603): 31574 [New I/O client worker #1-1] INFO sfs2x.client.core.SFSIOHandler - <<< Packet Complete >>>
08-06 16:47:10.155: W/System.err(5603): 31576 [New I/O client worker #1-1] INFO sfs2x.client.controllers.SystemController - Message: ResLogout { Message id: 2 }
08-06 16:47:10.155: W/System.err(5603): { Dump: }
08-06 16:47:10.155: W/System.err(5603): 	(utf_string) zn: BatallaNaval
08-06 16:47:10.155: W/System.err(5603): 	
[b]08-06 16:47:10.155: W/System.err(5603): 31576 [New I/O client worker #1-1] WARN sfs2x.client.controllers.SystemController - Error in handling event: java.lang.NullPointerException
08-06 16:47:10.155: W/System.err(5603): java.lang.NullPointerException[/b]
08-06 16:47:10.179: W/System.err(5603): 	at sfs2x.client.SmartFox.handleLogout(SmartFox.java:1196)
08-06 16:47:10.179: W/System.err(5603): 	at sfs2x.client.controllers.system.ResLogout.handleResponse(ResLogout.java:23)
You can go through my code on sourceforge, particulary this file [1] I launch the event on line 699 and receive the result on dispatch method (line 150), first thing I do is log the Event fired and I can't even get that when I launch LogoutEvent. Do you know how to solve this?

Thanks in advance

[1] http://sourceforge.net/p/chattered/code ... tered.java
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: NPE at user logout

Post by ThomasLund »

Will check it out - seems there is generally an error on logout/disconnect to be investigated and fixed.

Going to take at least 1+ week before it gets attention, as I'm hit by vacation and conference time

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
cristianpark
Posts: 8
Joined: 14 Apr 2008, 15:34

Re: NPE at user logout

Post by cristianpark »

ThomasLund wrote:Will check it out - seems there is generally an error on logout/disconnect to be investigated and fixed.

Going to take at least 1+ week before it gets attention, as I'm hit by vacation and conference time

/Thomas
Thanks for your reply Thomas, I will be waiting for your revision.
Enjoy your vacation/conference time
cristianpark
Posts: 8
Joined: 14 Apr 2008, 15:34

Re: NPE at user logout

Post by cristianpark »

Hi Thomas, did you check out this error? Do you need further information? Let me know if you need something or can guide me through fix the problem
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPE at user logout

Post by Lapo »

Hi, I am not able to reproduce the problem. Are you sure you are using the latest API available, version 1.0.1?
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
martian77
Posts: 7
Joined: 08 Apr 2011, 09:10
Location: UK - England
Contact:

Re: NPE at user logout

Post by martian77 »

Hi,

I'm getting a similar problem but at the Actionscript end. When the Logout Event is received I get the following output in Flash:
[SFS - INFO] Logout { Message id: 2 }
{ Dump: }

(utf_string) zn: GameZone

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.smartfoxserver.v2::SmartFox/handleLogout()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/SmartFox.as:1912]
at com.smartfoxserver.v2.controllers::SystemController/fnLogout()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/controllers/SystemController.as:827]
at com.smartfoxserver.v2.controllers::SystemController/handleMessage()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/controllers/SystemController.as:127]
at com.smartfoxserver.v2.core::SFSProtocolCodec/dispatchRequest()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:150]
at com.smartfoxserver.v2.core::SFSProtocolCodec/onPacketRead()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:54]
at com.smartfoxserver.v2.core::SFSIOHandler/handlePacketData()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSIOHandler.as:246]
at com.smartfoxserver.v2.core::SFSIOHandler/onDataRead()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/core/SFSIOHandler.as:105]
at com.smartfoxserver.v2.bitswarm::BitSwarmClient/onSocketData()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/bitswarm/BitSwarmClient.as:419]
I've just patched, but the swc file doesn't seem to have updated. Any ideas?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPE at user logout

Post by Lapo »

Hi, please don't post Actionscript problems here, it's the Java forum.
Please start a new thread in the AS3 API forum
Thanks.
Lapo
--
gotoAndPlay()
...addicted to flash games
cristianpark
Posts: 8
Joined: 14 Apr 2008, 15:34

Re: NPE at user logout

Post by cristianpark »

Lapo wrote:Hi, I am not able to reproduce the problem. Are you sure you are using the latest API available, version 1.0.1?
Thanks
I see that the timestamp of that version is 03/05/2012 and I start working with SFS for Android about a couple of months so I think I have that version but I'm not sure, is there a way to check this?
Thanks
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: NPE at user logout

Post by rjgtav »

You can check the API version you're running by tracing the Version property from your SmartFox Instance
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
cristianpark
Posts: 8
Joined: 14 Apr 2008, 15:34

Re: NPE at user logout

Post by cristianpark »

rjgtav wrote:You can check the API version you're running by tracing the Version property from your SmartFox Instance
Thanks, I have 1.0.0, I tried 1.0.1 and it works great

Thanks for your help
martian77
Posts: 7
Joined: 08 Apr 2011, 09:10
Location: UK - England
Contact:

Re: NPE at user logout

Post by martian77 »

Terribly sorry, I just did a search for similar errors and hadn't realised which forum I was in. It seems these would have the same root cause. Any way, I have created a new thread in the Actionscript forum. http://forums.smartfoxserver.com/viewto ... 19&t=15188
Post Reply