Litecoin-Java / bitcoin-wallet

Bitcoin Wallet app for your Android device. Standalone Bitcoin node, no centralized backend required.
https://play.google.com/store/apps/details?id=de.schildbach.wallet
31 stars 42 forks source link

NullPointerException in ExchangeRatesProvider #64

Closed mindlapse closed 10 years ago

mindlapse commented 10 years ago

=== application info ===

Version: 3.30.7 (161) Package: de.schildbach.wallet_ltc Test/Prod: prod Time: 2014-02-15 19:59:05 -0500 Time of launch: 2014-02-15 19:58:58 -0500 Time of last update: 2014-02-15 17:08:38 -0500 Time of first install: 2014-02-15 17:08:38 -0500 Network: org.litecoin.production Keychain size: 1 Transactions: 0 Inputs: 0 Outputs: 0 (spent: 0) Last block seen: 514845 (a870db6ce97c2ac878869d37fc35a7177b2a96802c1ce70c9864dc17ec001d69) Databases:

Contents of FilesDir /data/data/de.schildbach.wallet_ltc/files: 2014-02-15 19:59:03 4096 files

Contents of LogDir /data/data/de.schildbach.wallet_ltc/app_log: 2014-02-15 17:08:44 4096 app_log

=== stack trace ===

java.lang.RuntimeException: An error occured while executing doInBackground() at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:137) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) at java.util.concurrent.FutureTask.setException(FutureTask.java:219) at java.util.concurrent.FutureTask.run(FutureTask.java:239) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) Caused by: java.lang.NullPointerException at de.schildbach.wallet.ExchangeRatesProvider$GoogleRatesProvider.getRates(ExchangeRatesProvider.java:352) at de.schildbach.wallet.ExchangeRatesProvider.query(ExchangeRatesProvider.java:159) at android.content.ContentProvider.query(ContentProvider.java:652) at android.content.ContentProvider$Transport.query(ContentProvider.java:189) at android.content.ContentResolver.query(ContentResolver.java:374) at android.content.ContentResolver.query(ContentResolver.java:317) at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:49) at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:35) at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40) at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123) at java.util.concurrent.FutureTask.run(FutureTask.java:234) ... 3 more

Cause:

java.lang.NullPointerException at de.schildbach.wallet.ExchangeRatesProvider$GoogleRatesProvider.getRates(ExchangeRatesProvider.java:352) at de.schildbach.wallet.ExchangeRatesProvider.query(ExchangeRatesProvider.java:159) at android.content.ContentProvider.query(ContentProvider.java:652) at android.content.ContentProvider$Transport.query(ContentProvider.java:189) at android.content.ContentResolver.query(ContentResolver.java:374) at android.content.ContentResolver.query(ContentResolver.java:317) at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:49) at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:35) at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40) at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856)

=== device info ===

Device Model: LG-D803 Android Version: 4.2.2 Board: MSM8974 Brand: lge Device: g2 Display: JDQ39B Finger Print: lge/g2_rgs_ca/g2:4.2.2/JDQ39B/D803R10c.1378294758:user/release-keys Host: LGEARND9B3 ID: JDQ39B Product: g2_rgs_ca Tags: release-keys Time: 1378294868000 Type: user User: younhyung.cho Configuration: {1.0 302mcc720mnc en_CA ldltr sw360dp w360dp h567dp 480dpi nrml port finger -keyb/v/h -nav/h s.111-1fontTypeIndex} Screen Layout: size 2 long 16 Display Metrics: DisplayMetrics{density=3.0, width=1080, height=1776, scaledDensity=3.0, xdpi=422.03, ydpi=424.069} Memory Class: 128/256

PUT ADDITIONAL COMMENTS TO THE TOP. DOWN HERE NOBODY WILL NOTICE.

hank commented 10 years ago

Thanks - I'll add another null check in. Cheers.

UngarnFCP commented 10 years ago

From logcat

W/de.schildbach.wallet.ExchangeRatesProvider( 8785): Problem fetching exchange rates W/de.schildbach.wallet.ExchangeRatesProvider( 8785): java.lang.ArithmeticException: Rounding necessary W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at java.math.BigDecimal.toBigIntegerExact(BigDecimal.java:2450) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at de.schildbach.wallet.util.GenericUtils.toNanoCoins(GenericUtils.java:113) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at de.schildbach.wallet.ExchangeRatesProvider$GoogleRatesProvider.getRates(ExchangeRatesProvider.java:404) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at de.schildbach.wallet.ExchangeRatesProvider.query(ExchangeRatesProvider.java:161) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.content.ContentProvider.query(ContentProvider.java:652) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.content.ContentProvider$Transport.query(ContentProvider.java:189) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.content.ContentResolver.query(ContentResolver.java:373) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.content.ContentResolver.query(ContentResolver.java:316) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:49) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:35) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at java.util.concurrent.FutureTask.run(FutureTask.java:234) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) W/de.schildbach.wallet.ExchangeRatesProvider( 8785): at java.lang.Thread.run(Thread.java:838)

hank commented 10 years ago

As yes I found this a few days ago as well. A fix will be released with the next version. The toNanoCoins function was converting numbers and throwing exceptions if floating point rounding occurred. Since it's an exchange rate, a bit of small rounding is fine.

mindlapse commented 10 years ago

I see the crash very often when resuming the app, I wouldn't complain if a minor patch version is released :) On 2014-02-17 9:39 AM, "hank" notifications@github.com wrote:

As yes I found this a few days ago as well. A fix will be released with the next version. The toNanoCoins function was converting numbers and throwing exceptions if floating point rounding occurred. Since it's an exchange rate, a bit of small rounding is fine.

Reply to this email directly or view it on GitHubhttps://github.com/Litecoin-Java/bitcoin-wallet/issues/64#issuecomment-35286954 .

hank commented 10 years ago

Ah ok. I'll see if I can get a new version out in the next few days. I'm in the middle of some rather major changes now, but I can probably table those and revert some of them in order to release since this is effecting you.

hank commented 10 years ago

Sorry this has taken me so long - lots of things going on. I'm working on this today.

mindlapse commented 10 years ago

No problem - I wouldn't mind helping out (10 yrs java experience), but I'm waiting for a new laptop On 2014-03-17 10:10 AM, "hank" notifications@github.com wrote:

Sorry this has taken me so long - lots of things going on. I'm working on this today.

Reply to this email directly or view it on GitHubhttps://github.com/Litecoin-Java/bitcoin-wallet/issues/64#issuecomment-37819046 .

hank commented 10 years ago

Cool - yeah if you want to contribute, feel free by forking the repo and shooting me pull requests. Just noticed your github avatar - looks familiar :). I guess I'm not the only one who likes facemasks. I've just committed my first stab at refactoring the exchange rates fetching, which fixes this crash AFAIK:

e2b7026770ea276768ae68408f900a1a4f3f83b9

I'll be pushing out a new official version tonight.

hank commented 10 years ago

Fixed, and I haven't seen any reports for quite a while.