pietrorampini / UpdateChecker

Increase your app's updates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NullPointerException in UpdateChecker

bjorncs opened this issue · comments

I have received several reports about NullPointerException in the method containsNumber(String) in the UpdateChecker class.

Thanks,

I'll fix it soon, can you provide me the package name of the app where you get this error from?

I've tested the true app. No bug found.
I've tested a sample app with the same package. No bug found.
Can you provide me more info please?

Here is a typical crash report. The crash does only happen in a very few cases, it mostly works fine.
My app is using the Proguard for obfuscation, so method names in the following stack trace are missing, but the line numbers and class names should be correct.

java.lang.NullPointerException
at com.rampo.updatechecker.UpdateChecker.c(SourceFile:291)
at com.rampo.updatechecker.UpdateChecker.a(SourceFile:180)
at com.rampo.updatechecker.AsyncCheck.a(SourceFile:403)
at com.rampo.updatechecker.AsyncCheck.onPostExecute(SourceFile:347)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
at android.os.Handler.dispatchMessage(Handler.java:99)

I will reintegrate the UpdateChecker library into my next app update. It might be the case that is crash was related to the two other bugs I reported. I will report back once I know how it goes.

Thanks in advance.
Il giorno 10/nov/2013, alle ore 23:36, Bjørn Christian Seime notifications@github.com ha scritto:

I will reintegrate the UpdateChecker library into my next app update. It might be the case that is crash was related to the two other bugs I reported. I will report back once I know how it goes.


Reply to this email directly or view it on GitHub.

I am stilling getting similar reports with your last update (albeit very few reports, from only two devices in total of several thousand). There is a big change that this is related to a device specific bug.

java.lang.NullPointerException
at com.rampo.updatechecker.UpdateChecker.c(SourceFile:291)
at com.rampo.updatechecker.UpdateChecker.a(SourceFile:180)
at com.rampo.updatechecker.AsyncCheck.a(SourceFile:405)
at com.rampo.updatechecker.AsyncCheck.onPostExecute(SourceFile:349)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)

Seems that the String versionDownloadable is = null . But I can't understand how this could happen.
This is the allocation of versionDownloadable: https://github.com/rampo/UpdateChecker/blob/master/library/src/com/rampo/updatechecker/UpdateChecker.java#L384
Something is not working on parsing the versionDownloadable from Play Store.
I think the HTML classes switch the page required from my library to the right translated version of the page as Google do in the play.google.com domain, and this cause the break of the parsing process in some countries, but I have to test this possibility.
Can you tell me in which countries this bug was spotted? and from which devices?

The ACRA reports does not contain any user locations. Some of the phones were setup with French localization, other with German and a lot with English, so it seems like the error is not related to any specific language or location.

Its not device specific either. I got bug reports from HTC, Samsung, Sony etc, using any Android version from 2.3 to 4.3.

Anyway, the doInBackground() method does return VERSION_FOUND, even for cases when line.contains(HTML_TAGS_TO_GET_RIGHT_LINE) is never true, which leads to versionDownloadable never being set. Is this intentional?

Anyway, the doInBackground() method does return VERSION_FOUND, even for cases when line.contains(HTML_TAGS_TO_GET_RIGHT_LINE) is never true, which leads to versionDownloadable never being set. Is this intentional?

Probably this is the bug. I've tested the library with a lot of apps before publish it, but I've never thought about the cases where (line.contains(HTML_TAGS_TO_GET_RIGHT_LINE)) return false. Probably this cause the NullPointerException because the String versionDownloadable keep allocated to null. I'm gonna fix and test this soon.

Also, @bjorncs I advice to you to use more powerful Bug Tracking services like BugSense or Crashlytics, they provide so more detailed reports.

Still crashes

@WebnetMobile: Did you download the library from the bugfixing branch?

@bjorncs branch you say? most likely i updated from master. If it is not in master, then, well.... why? :/

I guess because the fix is not yet confirmed to work. He will probably merge to master once the fixes are known to work.

Still crashes

Have you tested the master branch or bugfixing ?
I've pushed 2bd1d8c to bugfixing instead of master because I've tested a lot of times the library but I can't spot this bug. For this reason, can you test this for me? @WebnetMobile @bjorncs

I will hopefully have time to push an update of my app with the bug fixes during this week. I will let you know once I know for sure the fix is working.

Thanks. Sorry for the inconvenience.

The fixed was not working correctly. ERROR was returned if the first line was not containing the version name (which is never the case). Check my pull request here with proper fix: e16bd99