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

Potential NPE during AndroidCacheFileFactory initialization #414

Closed
koral-- opened this issue Aug 5, 2020 · 0 comments · Fixed by #427
Closed

Potential NPE during AndroidCacheFileFactory initialization #414

koral-- opened this issue Aug 5, 2020 · 0 comments · Fixed by #427
Milestone

Comments

@koral--
Copy link
Contributor

koral-- commented Aug 5, 2020

✍️ Describe the bug

The current code at: https://github.com/ChuckerTeam/chucker/blob/develop/library/src/main/java/com/chuckerteam/chucker/internal/support/AndroidCacheFileFactory.kt#L17 assumes that context.cacheDir returns non-null value. However, on Android older than 7.0 this method can return null: http://androidxref.com/6.0.0_r1/xref/frameworks/base/core/java/android/app/ContextImpl.java#425

💣 Steps to reproduce

  1. Cause cache dir to be not creatable eg. create regular file with the same name beforehand or fill entire disk space.
  2. Invoke ChuckerInterceptor constructor.

🔧 Expected behavior

Not sure what is that cache used for. If it is mandatory, NPE could be wrapped by IOException.

📷 Screenshots

N/A

📱 Tech info

  • OS: < 7.0
  • Chucker version: at least one which is built from commit 392a63b or newer.

📄 Additional context

I haven't encountered this issue at runtime. Just realized that it may happen during #413 investigation.

@ghost ghost added the Pending PR The resolution for the issue is in PR label Aug 17, 2020
@cortinico cortinico added the bug Something isn't working label Aug 23, 2020
@ghost ghost removed Pending PR The resolution for the issue is in PR bug Something isn't working labels Aug 25, 2020
@vbuberen vbuberen added this to the 3.3.0 milestone Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants