HapRamp v0.0.11 - App crashes due to parsing error on posts having a title being started by a special character

in #utopian-io6 years ago

Project Information

Expected behavior

Posts having a title being started by a special character should be displayed when tapped.

Actual behavior

Upon tapping a post that has a title being started by a special character, the app crashes.

How to reproduce

  • In the "Home" page, select a "Community" and tap its designated icon.
  • Select a post that has a title being started by a special character and tap it.
  • Upon tapping that post, the app crashes.

Logcat Report

08-17 22:14:27.440  9321  9321 E AndroidRuntime: FATAL EXCEPTION: main
08-17 22:14:27.440  9321  9321 E AndroidRuntime: Process: com.hapramp, PID: 9321
08-17 22:14:27.440  9321  9321 E AndroidRuntime: java.lang.ExceptionInInitializerError
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.InlineParserImpl.parseEntity(InlineParserImpl.java:751)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.InlineParserImpl.parseInline(InlineParserImpl.java:303)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.InlineParserImpl.parse(InlineParserImpl.java:174)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.ParagraphParser.parseInlines(ParagraphParser.java:61)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.DocumentParser.processInlines(DocumentParser.java:410)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.DocumentParser.finalizeAndProcess(DocumentParser.java:529)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.DocumentParser.parse(DocumentParser.java:118)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.parser.Parser.parse(Parser.java:63)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at com.hapramp.utils.RegexUtils.getHtmlContent(RegexUtils.java:15)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at com.hapramp.ui.activity.DetailedActivity.renderMarkdown(DetailedActivity.java:296)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at com.hapramp.ui.activity.DetailedActivity.bindPostValues(DetailedActivity.java:285)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at com.hapramp.ui.activity.DetailedActivity.collectExtras(DetailedActivity.java:181)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at com.hapramp.ui.activity.DetailedActivity.onCreate(DetailedActivity.java:162)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:6904)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.app.ActivityThread.access$1100(ActivityThread.java:229)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7406)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
08-17 22:14:27.440  9321  9321 E AndroidRuntime: Caused by: java.lang.NullPointerException: lock == null
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at java.io.Reader.<init>(Reader.java:64)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at java.io.InputStreamReader.<init>(InputStreamReader.java:122)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.util.Html5Entities.readEntities(Html5Entities.java:54)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    at org.commonmark.internal.util.Html5Entities.<clinit>(Html5Entities.java:17)
08-17 22:14:27.440  9321  9321 E AndroidRuntime:    ... 25 more

In the above logcat report, the issue is caused by java.lang.NullPointerException: lock == null, at Html5Entities.java especially in lines 17 and 54, which in turn causes error in the following files: InlineParserImpl.java, ParagraphParser.java, DocumentParser.java, Parser.java, DetailedActivity.java, RegexUtils.java and etc.

Environment

  • App version: 1ramp v0.0.10 (at the time of detection) and v0.0.11
  • Device: Samsung Galaxy J2 Prime (SM-G532G/DS)
  • Operating system: Android version 6.0.1

Recording Of The Bug

Post 1

GitHub Account

https://github.com/josephace135

GitHub Issue

Issue #109.

Sort:  

Hi @josephace135, thanks for making this contribution.

I was able to replicate the above error. The app crashes when loading a post that has a special character before the title's text. The developers are aware of this thanks to you, and should have it fixed before the next version release.

  1. The post title contains sufficient information. Although, at first I wondered if the crash occurred whenever a special character was in the title, regardless of it's position in the title sentence.
  2. The expected and actual behaviors were properly explained as well
  3. The steps you provided were easy to follow. I had to add "design" to my initially selected communities, cause the others lacked posts with titles that started with special characters.
  4. I see you took the corrections on how to report a logcat and the important lines to include. The error here Caused by: java.lang.NullPointerException: lock == nullwas caused by the application's inability to access an object before it has been created, at least that's what this exception means. This could have been as a result of the exception encountered in this line java.lang.ExceptionInInitializerError You get this error whenever something goes wrong in the static initializer block. The special character obviously messed some code up, that the PO would have to look into.
  5. No proposed fix, still a great report.

Thanks again for the contribution, it is a great find. I look forward to your next contribution,

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @fego!

So far this week you've reviewed 4 contributions. Keep up the good work!

Hey @josephace135
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Hi @josephace135! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. We are currently in test modus upvoting quality Utopian-io contributions! Nice work!

Congratulations @josephace135! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the total payout received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard and the Veterans on Steemit - The First Community Badge.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @josephace135! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard and the Veterans on Steemit - The First Community Badge.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @josephace135! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard and the Veterans on Steemit - The First Community Badge.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by josephace135 from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63501.83
ETH 2650.23
USDT 1.00
SBD 2.81