threerings / playn

Legacy 1.x version of PlayN library.
http://playn.io/
Apache License 2.0
195 stars 66 forks source link

NullPointerException using PlayN.net().get(url,callback) API #69

Open fredstroup opened 9 years ago

fredstroup commented 9 years ago

Hi,

1.9-SNAPSHOT robovm iPhone 6 with iOS 8.1

Using the PlayN.net().get(url,callback)API the game hangs on the simulator and I saw the following stack several times (but not systematically) on the real device:

java.lang.NullPointerException 
 at playn.robovm.RoboNet$1.connectionDidFinishLoading$(RoboNet.java) 
 at org.robovm.apple.foundation.NSURLConnectionDataDelegate$ObjCProxy.$cb$connectionDidFinishLoading$(Unknown Source) 
 at org.robovm.apple.uikit.UIApplication.main(Native Method) 
 at org.robovm.apple.uikit.UIApplication.main(UIApplication.java) 
 at metro.robovm.MetroRoboVM.main(MetroRoboVM.java)
samskivert commented 9 years ago

I think this has changed in the latest version of the code. If you can try again with the latest PlayN snapshot (which you'll have to build and install, but that should be as easy as git clone ..blahblahplayn.. ; mvn -f playn/pom.xml install), I'd appreciate knowing if it has been magically fixed or not.

I suspect it might have to do with the headers map being null, but that map now comes through a magic RoboVM marhsaler which may turn a null map into an empty map, I'm not sure.

samskivert commented 9 years ago

Oh, I just noticed you're using the snapshot. Well, can you just "git pull" and update your snapshot. The latest code should show RoboNet$1.didFinishLoading in the stack trace, not RoboNet$1.connectionDidFinishLoading$, which is old.

fredstroup commented 9 years ago

Hi,

After the git pull, the stack trace indeed changed, but the NullPointerException is still there.

java.lang.NullPointerException at playn.robovm.RoboNet$1.didFinishLoading(RoboNet.java) at org.robovm.apple.foundation.NSURLConnectionDataDelegate$ObjCProxy.$cb$connectionDidFinishLoading$(Unknown Source) at org.robovm.apple.uikit.UIApplication.main(Native Method) at org.robovm.apple.uikit.UIApplication.main(UIApplication.java) at metro.robovm.MetroRoboVM.main(MetroRoboVM.java)

Le 6 déc. 2014 à 22:10, Michael Bayne notifications@github.com a écrit :

Oh, I just noticed you're using the snapshot. Well, can you just "git pull" and update your snapshot. The latest code should show RoboNet$1.didFinishLoading in the stack trace, not RoboNet$1.connectionDidFinishLoading$, which is old.

— Reply to this email directly or view it on GitHub.

samskivert commented 9 years ago

I just pushed a fix to master which hopefully prevents this NPE. If you can check it out and let me know if the problem goes away, I'd appreciate it.

fredstroup commented 9 years ago

Hi Michael,

I was able to replicate the issue with the real device :

java.lang.NullPointerException at playn.robovm.RoboNet$1.didFinishLoading(RoboNet.java) at org.robovm.apple.foundation.NSURLConnectionDataDelegate$ObjCProxy.$cb$connectionDidFinishLoading$(Unknown Source) at org.robovm.apple.uikit.UIApplication.main(Native Method) at org.robovm.apple.uikit.UIApplication.main(UIApplication.java) at metro.robovm.MetroRoboVM.main(MetroRoboVM.java)

and with the simulator:

java.lang.NullPointerException [ERROR] [ERROR] at playn.robovm.RoboNet.access$300(RoboNet.java) [ERROR] at playn.robovm.RoboNet$1.didFinishLoading(RoboNet.java) [ERROR] at org.robovm.apple.foundation.NSURLConnectionDataDelegate$ObjCProxy.$cb$connectionDidFinishLoading$(Unknown Source) [ERROR] at org.robovm.apple.uikit.UIApplication.main(Native Method) [ERROR] at org.robovm.apple.uikit.UIApplication.main(UIApplication.java) [ERROR] at metro.robovm.MetroRoboVM.main(MetroRoboVM.java)

Note that the NPE is not systematic. I managed to use the simulator with the same code with no issues.

Le 15 déc. 2014 à 18:36, Michael Bayne notifications@github.com a écrit :

I just pushed a fix to master which hopefully prevents this NPE. If you can check it out and let me know if the problem goes away, I'd appreciate it.

— Reply to this email directly or view it on GitHub.