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

Java: 3.0.1 crashes with NPE when proguard is used #270

Closed
yshrsmz opened this issue Oct 17, 2018 · 5 comments
Closed

Java: 3.0.1 crashes with NPE when proguard is used #270

yshrsmz opened this issue Oct 17, 2018 · 5 comments
Assignees
Labels

Comments

@yshrsmz
Copy link

yshrsmz commented Oct 17, 2018

On Android, TwitterTextParser.parseText(String) crashes with NPE if proguard is used.

Expected behavior

Should return valid TwitterTextParseResults as usual.

Actual behavior

Crashes with NPE. TwitterTextParser.parseText(String, TwitterTextConfiguration) also crashes.

Below is the crashlog

Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
        at com.twitter.a.h.a(TwitterTextParser.java:173)
        at com.twitter.a.h.a(TwitterTextParser.java:78)
        at net.yslibrary.omnitweety.status.a.c.f(BuildStatusString.kt:35)
        at net.yslibrary.omnitweety.status.a.c.a(BuildStatusString.kt:11)
        at net.yslibrary.omnitweety.status.a.c$a.agp(BuildStatusString.kt:16)
        at net.yslibrary.omnitweety.status.a.c$a.call(BuildStatusString.kt:11)

Here's the code in above crashlog.

private fun getLengthDiff(status: String): Int {
    val result = TwitterTextParser.parseTweet(status)
    return TwitterTextParser.TWITTER_TEXT_WEIGHTED_CHAR_COUNT_CONFIG.maxWeightedTweetLength - result.weightedLength
}

Steps to reproduce the behavior

  1. Create android app
  2. Enable proguard(also add proguard config for Jackson)
  3. Call TwitterTextParser.parseTweet(String) somewhere
@yshrsmz
Copy link
Author

yshrsmz commented Oct 17, 2018

looks like additional proguard config below solved the problem for now.

-keep class com.twitter.twittertext.TwitterTextConfiguration { *; }

@leeaustinadams leeaustinadams self-assigned this Oct 22, 2018
@leeaustinadams
Copy link

Assigned to me and I'll add Android specific portions to the README and we're evaluating options related to configuration in general for some other issues filed.

@andypiper andypiper added the java label Oct 29, 2018
@leeaustinadams
Copy link

I've got a patch internally that packages the necessary proguard rules within the JAR itself. I will update the README. Still working towards a push to GitHub, stay tuned.

@leeaustinadams
Copy link

Hoping to push back to github in the near future!

@leeaustinadams
Copy link

#310 release fixes by removing the JSON data files entirely

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

No branches or pull requests

3 participants