Shikhar13 / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

AndroidPeer causes NullPointerException when restarting app #312

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On Android, when I have a WebBrowser in a form, when I exit and then re-enter 
the app I get the following exception:

09-01 16:38:20.329: E/AndroidRuntime(18471): FATAL EXCEPTION: main
09-01 16:38:20.329: E/AndroidRuntime(18471): java.lang.NullPointerException
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
com.codename1.impl.android.AndroidImplementation$AndroidPeer$6.run(Unknown 
Source)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
android.os.Handler.handleCallback(Handler.java:605)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
android.os.Handler.dispatchMessage(Handler.java:92)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
android.os.Looper.loop(Looper.java:137)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
android.app.ActivityThread.main(ActivityThread.java:4424)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
java.lang.reflect.Method.invokeNative(Native Method)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
java.lang.reflect.Method.invoke(Method.java:511)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-01 16:38:20.329: E/AndroidRuntime(18471):    at 
dalvik.system.NativeStart.main(Native Method)

I have not been able to reproduce the following NullPointerException, but I 
also encountered this exception from AndroidPeer when I had a WebBrowser in the 
form:

09-01 14:32:46.975: E/AndroidRuntime(14200): FATAL EXCEPTION: main
09-01 14:32:46.975: E/AndroidRuntime(14200): java.lang.NullPointerException
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
com.codename1.impl.android.AndroidImplementation$AndroidPeer$2.run(Unknown 
Source)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
android.os.Handler.handleCallback(Handler.java:605)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
android.os.Handler.dispatchMessage(Handler.java:92)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
android.os.Looper.loop(Looper.java:137)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
android.app.ActivityThread.main(ActivityThread.java:4424)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
java.lang.reflect.Method.invokeNative(Native Method)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
java.lang.reflect.Method.invoke(Method.java:511)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-01 14:32:46.975: E/AndroidRuntime(14200):    at 
dalvik.system.NativeStart.main(Native Method)

Looking at the code of AndroidPeer, it seems that accessing 
AndroidImplementation.this.relativeLayout(and possible 
AndroidImplementation.this.myView) is probably causing the exception as the 
relativeLayout (and myView) field in AndroidImplementation is set to null in 
AndroidImplementation.deinitialize.

Original issue reported on code.google.com by Ian.Te...@gmail.com on 1 Sep 2012 at 10:26

GoogleCodeExporter commented 9 years ago

Original comment by shai.almog on 2 Sep 2012 at 7:49

GoogleCodeExporter commented 9 years ago
fixed, thanks

Original comment by cf27...@gmail.com on 2 Sep 2012 at 12:24

GoogleCodeExporter commented 9 years ago

Original comment by cf27...@gmail.com on 2 Sep 2012 at 12:25

GoogleCodeExporter commented 9 years ago
This issue has not been fixed. I still get NPE's in AndroidPeer$2,$4,$6 (with 
the same stack traces) when I have a BrowserComponent in the form.

They occur when I have BrowserComponent in the current form, I then hit the 
home button, I then launch my app again, it opens to the previous form that has 
the BrowserCompnent. Sometimes the npe happens immediately, other times when I 
remove the BrowserComponent from the form and add a new one.

Original comment by Ian.Te...@gmail.com on 2 Sep 2012 at 9:24

GoogleCodeExporter commented 9 years ago
The issue needs a server redeploy. We will do this sometime during the week.

Original comment by shai.almog on 3 Sep 2012 at 5:15