Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20435] NullPointerException is thrown in logcat if you use the latest SDK with latest Facebook module

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionDuplicate
Resolution Date2016-02-20T06:13:43.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsqe-5.2.0, regression
ReporterWilson Luu
AssigneeAshraf Abu
Created2016-02-20T01:09:14.000+0000
Updated2016-02-21T23:50:00.000+0000

Description

*Details:* NullPointerException is thrown in logcat if you use the latest SDK with latest Facebook module. *Notes:* This is *a regression* from SDK 5.2.0.v20160208101502 and 5.1.2.GA. *Steps to reproduce:*

In the Stable KitchenSink, open tiapp.xml

Replace the Android section with the following:

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <application>
                <activity android:alwaysRetainTaskState="true"
                    android:configChanges="keyboardHidden|orientation"
                    android:label="KitchenSink"
                    android:name=".KitchensinkActivity" android:theme="@style/Theme.Titanium">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.LAUNCHER"/>
                    </intent-filter>
                </activity>
                <activity
                    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
                    android:label="KitchenSinkFacebook"
                    android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
                <activity android:label="KitchenSinkFacebook"
                    android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
                <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
            </application>
            <uses-sdk android:targetSdkVersion="23"/>
        </manifest>
        <activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity"/>
        <services>
            <service type="interval" url="testservice.js"/>
        </services>
    </android>

Make sure facebook module 5.0.0 is selected

Install KitchenSink to device

Wait for app to launch

*Actual:* NullPointerException is thrown in logcat:
[ERROR] :  TiApplication: (AsyncTask #1) [2,2] Sending event: exception on thread: AsyncTask #1 msg:java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference; Titanium 5.2.0,2016/02/19 12:45,fd837d1
[ERROR] :  TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.util.TiFileHelper2.hasStoragePermission(TiFileHelper2.java:89)
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.util.TiResponseCache.get(TiResponseCache.java:314)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.CacheAdapter.getJavaCachedResponse(CacheAdapter.java:103)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.CacheAdapter.get(CacheAdapter.java:47)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:22
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:384)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
[ERROR] :  TiApplication: 	at com.facebook.GraphResponse.fromHttpConnection(GraphResponse.java:253)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeConnectionAndWait(GraphRequest.java:1255)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1157)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1124)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1108)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:1083)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:977)
[ERROR] :  TiApplication: 	at com.facebook.internal.Utility.getAppSettingsQueryResponse(Utility.java:868)
[ERROR] :  TiApplication: 	at com.facebook.internal.Utility.access$1(Utility.java:860)
[ERROR] :  TiApplication: 	at com.facebook.internal.Utility$1.run(Utility.java:797)
[ERROR] :  TiApplication: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
[ERROR] :  TiApplication: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
[ERROR] :  TiApplication: 	at java.lang.Thread.run(Thread.java:818)
*Expected:* NullPointerException should not be thrown.

Comments

  1. Ashraf Abu 2016-02-20

    Resolving this as a duplicate of TIMOB-20434
  2. Wilson Luu 2016-02-21

    Closing ticket as duplicate of TIMOB-20434.

JSON Source