cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-10472) NullPointerException: Attempt to invoke virtual method 'android.os.Bundle org.apache.cordova.PluginManager.onSaveInstanceState
Date Fri, 29 Jan 2016 18:26:39 GMT

    [ https://issues.apache.org/jira/browse/CB-10472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15123922#comment-15123922
] 

ASF subversion and git services commented on CB-10472:
------------------------------------------------------

Commit 088140aca49196dd648bb99360c94f7ee88d7711 in cordova-android's branch refs/heads/master
from [~csantana]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;h=088140a ]

CB-10472 NullPointerException: org.apache.cordova.PluginManager.onSaveInstanceState
check if pluginManager is null before using it
This closes #255


> NullPointerException: Attempt to invoke virtual method 'android.os.Bundle org.apache.cordova.PluginManager.onSaveInstanceState
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-10472
>                 URL: https://issues.apache.org/jira/browse/CB-10472
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 5.1.0
>         Environment: cordova-android 5.1.0
>            Reporter: Carlos Santana
>            Assignee: Carlos Santana
>              Labels: android
>
> pluginManager not being check for null before using it in CordovaInterfaceImpl
> 01-28 14:24:10.396  27684-27684/io.cordova.hellocordova E/AndroidRuntime﹕ FATAL EXCEPTION:
main
>     Process: io.cordova.hellocordova, PID: 27684
>     java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle
org.apache.cordova.PluginManager.onSaveInstanceState()' on a null object reference
>             at org.apache.cordova.CordovaInterfaceImpl.onSaveInstanceState(CordovaInterfaceImpl.java:173)
>             at org.apache.cordova.CordovaActivity.onSaveInstanceState(CordovaActivity.java:465)
>             at android.app.Activity.performSaveInstanceState(Activity.java:1298)
>             at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1288)
>             at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:3958)
>             at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3369)
>             at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3425)
>             at android.app.ActivityThread.access$1100(ActivityThread.java:151)
>             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)
>             at android.os.Handler.dispatchMessage(Handler.java:102)
>             at android.os.Looper.loop(Looper.java:135)
>             at android.app.ActivityThread.main(ActivityThread.java:5254)
>             at java.lang.reflect.Method.invoke(Native Method)
>             at java.lang.reflect.Method.invoke(Method.java:372)
>             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
>             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
> Recreate
> cordova create testapp
> cd testapp
> cordova platform add android@5.1.0
> Modify MainActivity to launch a second Cordova Activity like this:
> change MainActivity.java
> Notice no init or loadUrl called, this is on purpose in our App for this use case we
want to avoid this, and let the second Activity to call loadUrl
> public class MainActivity extends CordovaActivity
> {
>     @Override
>     public void onCreate(Bundle savedInstanceState)
>     {
>         super.onCreate(savedInstanceState);
>     }
>     @Override
>     protected void onStart(){
>         super.onStart();
>         Intent newActivity = new Intent(this, MainActivity2.class);
>         startActivity(newActivity);
>     }
> }
> Add class io.cordova.hellocordova.MainActivity2.java
> public class MainActivity2 extends CordovaActivity
> {
>     @Override
>     public void onCreate(Bundle savedInstanceState)
>     {
>         super.onCreate(savedInstanceState);
>         // Set by <content src="index.html" /> in config.xml
>         loadUrl(launchUrl);
>     }
> }
> Add activity to AndroidManifest.xml
> <activity android:name="io.cordova.hellocordova.MainActivity2" />
> Since init() or loadUrl was never called in MainActivity, pluginManager never got created,
this let pluginManager be null



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message