Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException in UpdateChecker #26

Closed
bjorncs opened this issue Nov 4, 2013 · 19 comments
Closed

NullPointerException in UpdateChecker #26

bjorncs opened this issue Nov 4, 2013 · 19 comments
Assignees
Labels

Comments

@bjorncs
Copy link
Contributor

bjorncs commented Nov 4, 2013

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

@pietrorampini
Copy link
Owner

Thanks,

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

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 4, 2013

@pietrorampini
Copy link
Owner

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?

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 8, 2013

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)

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 10, 2013

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.

@pietrorampini
Copy link
Owner

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.

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 14, 2013

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)

@pietrorampini
Copy link
Owner

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?

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 16, 2013

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?

@pietrorampini
Copy link
Owner

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.

@pietrorampini
Copy link
Owner

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

pietrorampini added a commit that referenced this issue Nov 17, 2013
@WebnetMobile
Copy link

Still crashes

@ghost ghost assigned pietrorampini Nov 25, 2013
@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 25, 2013

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

@WebnetMobile
Copy link

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

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 25, 2013

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

@pietrorampini
Copy link
Owner

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

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 26, 2013

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.

@pietrorampini
Copy link
Owner

Thanks. Sorry for the inconvenience.

@bjorncs
Copy link
Contributor Author

bjorncs commented Dec 1, 2013

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

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

No branches or pull requests

3 participants