question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerException in Buffer#write

See original GitHub issue

Using Okio 1.2.0 along with OkHttp 2.1.0, I’m seeing an NPE when reading HTTP responses:

java.lang.NullPointerException
    at okio.Buffer.write(Buffer.java:854)
    at okio.RealBufferedSink.write(RealBufferedSink.java:44)
    at com.squareup.okhttp.internal.http.HttpConnection$FixedLengthSink.write(HttpConnection.java:300)
    at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:140)
    at okio.RealBufferedSink.write(RealBufferedSink.java:69)
    at com.squareup.okhttp.RequestBody$1.writeTo(RequestBody.java:72)
    at com.squareup.okhttp.Call.getResponse(Call.java:237)  
    at com.squareup.okhttp.Call.execute(Call.java:84)

Evidently, source.head is null. Could this be due to the older OkHttp version?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
JakeWhartoncommented, Aug 15, 2019

Those come from the Android OS and its copy of Okio from a few years ago.

On Wed, Aug 14, 2019, 7:20 PM Ray Li notifications@github.com wrote:

Opened issue at Firebase repo firebase/firebase-android-sdk#709 https://github.com/firebase/firebase-android-sdk/issues/709

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/square/okio/issues/134?email_source=notifications&email_token=AAAQIEMK4F5TXK3AG6MGLYTQESHLDA5CNFSM4A6YDVMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4KMLFY#issuecomment-521454999, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAQIEKTNM75HAZO2X2AAT3QESHLDANCNFSM4A6YDVMA .

0reactions
turgayulutascommented, Aug 27, 2019

I have that same problem. Has anyone found the solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java: BufferedWriter NullPointerException - Stack Overflow
I am attempting to write a method that has to take in a Writer object and use that to provide output to a...
Read more >
Null Pointer Exception with BufferedWriter - Oracle Communities
Hi Guys, When I try to run this code I get a NullPointer Exception, and I can't work out why.
Read more >
java.lang.NullPointerException okio.Buffer.write #6723 - GitHub
The socket field is guarded by the lock and set to null on close/failure. But it may pass send calls during socket opening....
Read more >
java - why is there a NullPointerException? [SOLVED] - Daniweb
Two of the destination files are OK and one is truncated. Here is the code: import java.io.BufferedReader; import java.io.BufferedWriter; import ...
Read more >
What is a NullPointerException and how do I fix it - Edureka
NullPointerException ) and what causes them? ... Java; What is a NullPointerException and how do I fix. ... BufferedWriter; import java.io.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found