Open lucasrowe opened 11 years ago
NPE is due to GameManager being null.
public class PackSyncronizer extends AsyncTask <Pack, Void, Integer>
{
private ProgressDialog dialog;
final SharedPreferences userPurchases = getSharedPreferencesForCurrentUser();
final SharedPreferences.Editor syncPrefEditor = getSyncPreferences().edit();
//TODO FIX THIS. IT CRASHES.
// final BuzzWordsApplication application = (BuzzWordsApplication) getApplication();
// final GameManager gm = application.getGameManager();
final GameManager gm = new GameManager(PackPurchaseActivity.this);
another stack trace...this time when putting the NPE ahead of each install path.
E/GameManager(24282): restoreState() E/GameManager(24282): IOException while restoring Game Manager. E/AndroidRuntime(24282): FATAL EXCEPTION: AsyncTask #1 E/AndroidRuntime(24282): java.lang.RuntimeException: An error occured while executing doInBackground() E/AndroidRuntime(24282): at android.os.AsyncTask$3.done(AsyncTask.java:299) E/AndroidRuntime(24282): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) E/AndroidRuntime(24282): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) E/AndroidRuntime(24282): at java.util.concurrent.FutureTask.run(FutureTask.java:239) E/AndroidRuntime(24282): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) E/AndroidRuntime(24282): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) E/AndroidRuntime(24282): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) E/AndroidRuntime(24282): at java.lang.Thread.run(Thread.java:856) E/AndroidRuntime(24282): Caused by: java.lang.NullPointerException E/AndroidRuntime(24282): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:557) E/AndroidRuntime(24282): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1) E/AndroidRuntime(24282): at android.os.AsyncTask$2.call(AsyncTask.java:287) E/AndroidRuntime(24282): at java.util.concurrent.FutureTask.run(FutureTask.java:234) E/AndroidRuntime(24282): ... 4 more
To Repro Set the permissions in Amazon S3 for a pack to private (remove Everyone's Open/Download privilege). Attempt to download the pack in Buzzwords
The Fix This is a two part fix.
1 Fix the NPE.
E/PackPurchase(13482): Failed to update or install STARTER packId: 1 name: Buzzwords I W/System.err(13482): java.lang.NullPointerException W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:572) W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1) W/System.err(13482): at android.os.AsyncTask$2.call(AsyncTask.java:287) W/System.err(13482): at java.util.concurrent.FutureTask.run(FutureTask.java:234) W/System.err(13482): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) W/System.err(13482): at java.lang.Thread.run(Thread.java:856) E/PackPurchase(13482): Failed to update or install STARTER packId: 2 name: Buzzwords II W/System.err(13482): java.lang.NullPointerException W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:572) W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1) W/System.err(13482): at android.os.AsyncTask$2.call(AsyncTask.java:287) W/System.err(13482): at java.util.concurrent.FutureTask.run(FutureTask.java:234) W/System.err(13482): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) W/System.err(13482): at java.lang.Thread.run(Thread.java:856) E/PackPurchase(13482): Failed to update or install PURCHASED packId: 100 name: Extra Buzzwords W/System.err(13482): java.lang.NullPointerException W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:556) W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1) W/System.err(13482): at android.os.AsyncTask$2.call(AsyncTask.java:287) W/System.err(13482): at java.util.concurrent.FutureTask.run(FutureTask.java:234) W/System.err(13482): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) D/dalvikvm( 818): GC_CONCURRENT freed 469K, 25% free 9535K/12612K, paused 9ms+11ms, total 84ms W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) D/dalvikvm( 818): WAIT_FOR_CONCURRENT_GC blocked 60ms D/dalvikvm( 2374): GC_FOR_ALLOC freed 781K, 10% free 13040K/14468K, paused 919ms, total 920ms W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) W/System.err(13482): at java.lang.Thread.run(Thread.java:856) E/PackPurchase(13482): Failed to update or install PURCHASED packId: 150 name: Fun Mix W/System.err(13482): java.lang.NullPointerException W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:556) W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1) W/System.err(13482): at android.os.AsyncTask$2.call(AsyncTask.java:287) W/System.err(13482): at java.util.concurrent.FutureTask.run(FutureTask.java:234) W/System.err(13482): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) W/System.err(13482): at java.lang.Thread.run(Thread.java:856) E/PackPurchase(13482): Failed to update or install PURCHASED packId: 200 name: Winter Holidays W/System.err(13482): java.lang.NullPointerException W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:556) W/System.err(13482): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1) W/System.err(13482): at android.os.AsyncTask$2.call(AsyncTask.java:287) D/dalvikvm( 818): GC_CONCURRENT freed 119K, 23% free 9806K/12612K, paused 3ms+11ms, total 47ms W/System.err(13482): at java.util.concurrent.FutureTask.run(FutureTask.java:234) W/System.err(13482): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) W/System.err(13482): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) W/System.err(13482): at java.lang.Thread.run(Thread.java:856)