Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

NPE in Login under Android < 4 #54

Closed
srvrguy opened this issue May 24, 2013 · 6 comments
Closed

NPE in Login under Android < 4 #54

srvrguy opened this issue May 24, 2013 · 6 comments
Labels

Comments

@srvrguy
Copy link
Member

srvrguy commented May 24, 2013

A NPE occurs on first login under Android versions below 4.0. Following is a logcat of the issue, including output from Atarashii!. Log was taken on an HTC Glacier on Android 2.3.4.

Re-launching the application and running a sync will make the application work.

V/MALX    ( 2714): Grid Cell Size for anime: 160x228
V/MALX    ( 2714): getAnimeRecordsFromDB() has been invoked for list watching
W/MALX    ( 2714): mManager is null. Attempting to re-create the object.
V/MALX    ( 2714): Successfully re-created mManager
V/MALX    ( 2714): Grid Cell Size for manga: 160x228
V/MALX    ( 2714): getMangaRecordsFromDB() has been invoked for list reading
E/AndroidRuntime( 2714): FATAL EXCEPTION: AsyncTask #3
E/AndroidRuntime( 2714): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 2714):        at android.os.AsyncTask$3.done(AsyncTask.java:200)
E/AndroidRuntime( 2714):        at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
E/AndroidRuntime( 2714):        at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
E/AndroidRuntime( 2714):        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
E/AndroidRuntime( 2714):        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
E/AndroidRuntime( 2714):        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
E/AndroidRuntime( 2714):        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
E/AndroidRuntime( 2714):        at java.lang.Thread.run(Thread.java:1027)
E/AndroidRuntime( 2714): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 2714):        at net.somethingdreadful.MAL.PrefManager.<init>(PrefManager.java:17)
E/AndroidRuntime( 2714):        at net.somethingdreadful.MAL.api.MALApi.<init>(MALApi.java:27)
E/AndroidRuntime( 2714):        at net.somethingdreadful.MAL.MALManager.<init>(MALManager.java:45)
E/AndroidRuntime( 2714):        at net.somethingdreadful.MAL.ItemGridFragment$getMangaRecordsTask.doInBackground(ItemGridFragment.java:255)
E/AndroidRuntime( 2714):        at net.somethingdreadful.MAL.ItemGridFragment$getMangaRecordsTask.doInBackground(ItemGridFragment.java:1)
E/AndroidRuntime( 2714):        at android.os.AsyncTask$2.call(AsyncTask.java:185)
E/AndroidRuntime( 2714):        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
E/AndroidRuntime( 2714):        ... 4 more
@srvrguy
Copy link
Member Author

srvrguy commented Jun 1, 2013

As of 21f286d, I cannot reproduce this issue. It may have been taken care of by some of the changes in that commit.

I'll leave this issue open for a while and will close it if I continue to have no success in reproducing it.

@srvrguy
Copy link
Member Author

srvrguy commented Jun 1, 2013

I reproduced the issue on a physical G1 (CM 6.1 - Android 2.2.1) and myTouch 4G (Android 2.3.4).

@AnimaSA
Copy link
Contributor

AnimaSA commented Jul 11, 2013

Can't manage to reproduce this issue. I tested with a freshly created 2.3.3 AVD, with a fresh install of the app. However, I did build against API 17 instead of API 15, so perhaps that fixed it? I'll be pushing that change shortly anyways.

AnimaSA added a commit that referenced this issue Jul 11, 2013
Updated to build against API 17 instead of 15. As a nice
coincidence, I can't seem to reproduce #54, the SDK update
may have fixed what was crashing the Asyntask in versions
below 4.0.
@srvrguy
Copy link
Member Author

srvrguy commented Jul 16, 2013

I can reproduce on actual 2.3 hardware. I'm not sure why it's working in emulator at this point. It might be timing related.

@srvrguy
Copy link
Member Author

srvrguy commented Jul 16, 2013

Tracking further, it seems context is null when MALManager is being initialized.

@srvrguy
Copy link
Member Author

srvrguy commented Jul 16, 2013

So, I tried changing some calls around to pass context down, but I get all the way up to ItemGridFragment.getRecords and context is still null.

I'm still trying to find a way to pass along a proper application context, but I'm appreciative of any suggestions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants