ChuckerTeam / chucker

🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Apache License 2.0
3.97k stars 350 forks source link

Null Pointer Exception #168

Closed RazibKani closed 4 years ago

RazibKani commented 4 years ago

:loudspeaker: Describe the bug

App crash because null exception

:bomb: Stacktrace

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.chuckerteam.chucker.api.internal.data.entity.HttpTransaction.getNotificationText()' on a null object reference at com.chuckerteam.chucker.api.internal.support.NotificationHelper.show + 96(NotificationHelper.java:96) at com.chuckerteam.chucker.api.ChuckerCollector.onResponseReceived$library_release + 66(ChuckerCollector.kt:66) at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept + 138(ChuckerInterceptor.kt:138) at okhttp3.internal.http.RealInterceptorChain.proceed + 112(RealInterceptorChain.kt:112) at okhttp3.internal.http.RealInterceptorChain.proceed + 87(RealInterceptorChain.kt:87) at okhttp3.logging.HttpLoggingInterceptor.intercept + 215(HttpLoggingInterceptor.kt:215) at okhttp3.internal.http.RealInterceptorChain.proceed + 112(RealInterceptorChain.kt:112) at okhttp3.internal.http.RealInterceptorChain.proceed + 87(RealInterceptorChain.kt:87) at com.happyfresh.snowflakes.hoverfly.interceptors.ClientInterceptor.intercept + 60(ClientInterceptor.kt:60) at okhttp3.internal.http.RealInterceptorChain.proceed + 112(RealInterceptorChain.kt:112) at okhttp3.internal.http.RealInterceptorChain.proceed + 87(RealInterceptorChain.kt:87) at okhttp3.RealCall.getResponseWithInterceptorChain + 184(RealCall.kt:184) at okhttp3.RealCall$AsyncCall.run + 136(RealCall.kt:136) at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641) at java.lang.Thread.run + 764(Thread.java:764)

:iphone: Smartphone

vbuberen commented 4 years ago

Hey @RazibKani Thanks for reporting the issue. Could you share details of the response, which caused this crash? Probably, you captured it via another network debugging tool? It would help us fix the issue faster.

RazibKani commented 4 years ago

Hi @vbuberen

Thanks for your response,

Unfortunately I don't have any supporting data for that crash. It seems NPE happen intermittently

cortinico commented 4 years ago

Unfortunately I don't have any supporting data for that crash.

Can you please share your build.gradle file (specifically the dependencies block)?

RazibKani commented 4 years ago

Here's my dependencies:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'androidx.appcompat:appcompat:1.0.0'

    // Retrofit
    api 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
    api 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
    api 'com.squareup.retrofit2:converter-gson:2.0.2'
    api 'com.squareup.okhttp3:okhttp:3.1.2'
    api 'com.google.code.gson:gson:2.8.2'
    api 'com.squareup.retrofit:retrofit:1.7.1'
    api 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.0.2'
    api 'com.squareup.okhttp3:logging-interceptor:4.2.1'

    // Coroutine
    api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"

    // Reactive Android
    api 'io.reactivex:rxjava:1.1.6'
    api 'io.reactivex:rxandroid:1.2.1'

    // DBFlow
    kapt "com.github.Raizlabs.DBFlow:dbflow-processor:${DbFlow_version}"
    api "com.github.Raizlabs.DBFlow:dbflow-core:${DbFlow_version}"
    api "com.github.Raizlabs.DBFlow:dbflow:${DbFlow_version}"
    api "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:${DbFlow_version}"

    // Parcel
    api 'org.parceler:parceler-api:1.1.12'
    kapt 'org.parceler:parceler:1.1.12'

    // Apache
    api('org.apache.commons:commons-lang3:3.4') {
        transitive = true
    }
    implementation('commons-validator:commons-validator:1.5.1') {
        exclude group: 'commons-logging', module: 'commons-logging'
    }

    // Android Priority Queue
    implementation 'com.birbit:android-priority-jobqueue:2.0.1'

    // Event Bus
    implementation 'com.squareup:otto:1.3.8'

    // Kotlin Library
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"

    // stetho
    api "com.facebook.stetho:stetho-okhttp3:$stethoVersion"

    // eventbus
    api "org.greenrobot:eventbus:$eventbusVersion"

    // secure storage library
    implementation "de.adorsys.android:securestoragelibrary:$secureStorageLibraryVersion"

    debugApi "com.github.ChuckerTeam.Chucker:library:$chuckerVersion"
    releaseApi "com.github.ChuckerTeam.Chucker:library-no-op:$chuckerVersion"

    testImplementation 'junit:junit:4.12'
    testImplementation 'com.squareup.okhttp3:mockwebserver:3.6.0'

    api project(':happychat-android')
}
vbuberen commented 4 years ago

Thanks. Could you recall how exactly this crash happened? It happened in background or when you looked through the list of transactions or when you clicked on one of transactions? I tried to reproduce, but had no luck. Maybe you have some more clues about the crash.

cortinico commented 4 years ago

@RazibKani Any reason why you're using releaseApi/debugApi rather than implementation configurations:

    debugApi "com.github.ChuckerTeam.Chucker:library:$chuckerVersion"
    releaseApi "com.github.ChuckerTeam.Chucker:library-no-op:$chuckerVersion"
vbuberen commented 4 years ago

Closing due to #223