siramix/buzzwords

Packpurchase: Losing internet while packs in memory causes crash on purchase

Opened this issue · 0 comments

When users lose internet while on the pack purchase screen they will crash the app if they try to purchase something.

To reproduce:

  1. Load up the pack purchase screen (packs now in memory)
  2. Turn on airplane mode
  3. Quickly switch back to the pack purchase screen.
  4. Attempt to purchase one of the packs that's in memory.

D/PackClient( 3974): getInstance
D/PackClient( 3974): getCardsForPack
D/PackClient( 3974): doHTTPGet(http://siramix.com/buzzwords/packs/packs/amazon2.json)
E/Deck ( 3974): Encountered IOException installing pack from server.
W/System.err( 3974): java.net.UnknownHostException: Unable to resolve host "siramix.com": No address associated with hostname
W/System.err( 3974): at java.net.InetAddress.lookupHostByName(InetAddress.java:424)
W/System.err( 3974): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
W/System.err( 3974): at java.net.InetAddress.getAllByName(InetAddress.java:214)
W/System.err( 3974): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
W/System.err( 3974): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
W/System.err( 3974): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
W/System.err( 3974): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
W/System.err( 3974): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
W/System.err( 3974): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/System.err( 3974): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/System.err( 3974): at com.buzzwords.PackClient.doHTTPGet(PackClient.java:202)
W/System.err( 3974): at com.buzzwords.PackClient.getCardsForPack(PackClient.java:111)
W/System.err( 3974): at com.buzzwords.Deck$DeckOpenHelper.installPackFromServer(Deck.java:723)
W/System.err( 3974): at com.buzzwords.Deck.installPack(Deck.java:197)
W/System.err( 3974): at com.buzzwords.GameManager.installPack(GameManager.java:376)
W/System.err( 3974): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:531)
W/System.err( 3974): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1)
W/System.err( 3974): at android.os.AsyncTask$2.call(AsyncTask.java:287)
W/System.err( 3974): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
W/System.err( 3974): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
W/System.err( 3974): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
W/System.err( 3974): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
W/System.err( 3974): at java.lang.Thread.run(Thread.java:856)
W/System.err( 3974): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/System.err( 3974): at libcore.io.Posix.getaddrinfo(Native Method)
W/System.err( 3974): at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
W/System.err( 3974): at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
W/System.err( 3974): ... 22 more
W/System.err( 3974): Caused by: libcore.io.ErrnoException: getaddrinfo failed: ENETUNREACH (Network is unreachable)
W/System.err( 3974): ... 25 more
W/dalvikvm( 3974): threadid=16: thread exiting with uncaught exception (group=0x40b1f300)
E/AndroidRuntime( 3974): FATAL EXCEPTION: AsyncTask #2
E/AndroidRuntime( 3974): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 3974): at android.os.AsyncTask$3.done(AsyncTask.java:299)
E/AndroidRuntime( 3974): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
E/AndroidRuntime( 3974): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
E/AndroidRuntime( 3974): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
E/AndroidRuntime( 3974): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AndroidRuntime( 3974): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
E/AndroidRuntime( 3974): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
E/AndroidRuntime( 3974): at java.lang.Thread.run(Thread.java:856)
E/AndroidRuntime( 3974): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 3974): at android.os.Handler.(Handler.java:121)
E/AndroidRuntime( 3974): at android.widget.Toast$TN.(Toast.java:322)
E/AndroidRuntime( 3974): at android.widget.Toast.(Toast.java:91)
E/AndroidRuntime( 3974): at android.widget.Toast.makeText(Toast.java:238)
E/AndroidRuntime( 3974): at com.buzzwords.PackPurchaseActivity.showToast(PackPurchaseActivity.java:800)
E/AndroidRuntime( 3974): at com.buzzwords.PackPurchaseActivity.access$1(PackPurchaseActivity.java:798)
E/AndroidRuntime( 3974): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:533)
E/AndroidRuntime( 3974): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1)
E/AndroidRuntime( 3974): at android.os.AsyncTask$2.call(AsyncTask.java:287)
E/AndroidRuntime( 3974): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AndroidRuntime( 3974): ... 4 more
W/ActivityManager( 292): Force finishing activity com.buzzwords/.PackPurchaseActivity