Why does HttpURLConnection.getResponseCode() throw ArrayIndexOutOfBoundsException?
HttpURLConnection uc = (HttpURLConnection)urlImge.openConnection(); uc.setConnectTimeout(5000); uc.setReadTimeout(5000); uc.setDoInput(true); uc.setRequestProperty(“Authorization”, “Basic ” + encoding); if ((uc.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED){ … } uc.getResponseCode() in the above code occasionally throws the following exception: Exception: size=32 offset=0 byteCount=1448 Class: java.lang.ArrayIndexOutOfBoundsException Stack trace: java.lang.ArrayIndexOutOfBoundsException: size=32 offset=0 byteCount=1448 at com.android.okhttp.okio.Util.checkOffsetAndCount(Util.java:31) at com.android.okhttp.okio.Okio$1.write(Okio.java:73) at com.android.okhttp.okio.AsyncTimeout$1.write(AsyncTimeout.java:157) at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:177) at com.android.okhttp.okio.RealBufferedSink.writeUtf8(RealBufferedSink.java:59) at com.android.okhttp.internal.http.Http1xStream.writeRequest(Http1xStream.java:169) at com.android.okhttp.internal.http.Http1xStream.writeRequestHeaders(Http1xStream.java:125) at […]
Why does HttpURLConnection.getResponseCode() throw ArrayIndexOutOfBoundsException?
HttpURLConnection uc = (HttpURLConnection)urlImge.openConnection(); uc.setConnectTimeout(5000); uc.setReadTimeout(5000); uc.setDoInput(true); uc.setRequestProperty(“Authorization”, “Basic ” + encoding); if ((uc.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED){ … } uc.getResponseCode() in the above code occasionally throws the following exception: Exception: size=32 offset=0 byteCount=1448 Class: java.lang.ArrayIndexOutOfBoundsException Stack trace: java.lang.ArrayIndexOutOfBoundsException: size=32 offset=0 byteCount=1448 at com.android.okhttp.okio.Util.checkOffsetAndCount(Util.java:31) at com.android.okhttp.okio.Okio$1.write(Okio.java:73) at com.android.okhttp.okio.AsyncTimeout$1.write(AsyncTimeout.java:157) at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:177) at com.android.okhttp.okio.RealBufferedSink.writeUtf8(RealBufferedSink.java:59) at com.android.okhttp.internal.http.Http1xStream.writeRequest(Http1xStream.java:169) at com.android.okhttp.internal.http.Http1xStream.writeRequestHeaders(Http1xStream.java:125) at […]
Why does HttpURLConnection.getResponseCode() throw ArrayIndexOutOfBoundsException?
HttpURLConnection uc = (HttpURLConnection)urlImge.openConnection(); uc.setConnectTimeout(5000); uc.setReadTimeout(5000); uc.setDoInput(true); uc.setRequestProperty(“Authorization”, “Basic ” + encoding); if ((uc.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED){ … } uc.getResponseCode() in the above code occasionally throws the following exception: Exception: size=32 offset=0 byteCount=1448 Class: java.lang.ArrayIndexOutOfBoundsException Stack trace: java.lang.ArrayIndexOutOfBoundsException: size=32 offset=0 byteCount=1448 at com.android.okhttp.okio.Util.checkOffsetAndCount(Util.java:31) at com.android.okhttp.okio.Okio$1.write(Okio.java:73) at com.android.okhttp.okio.AsyncTimeout$1.write(AsyncTimeout.java:157) at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:177) at com.android.okhttp.okio.RealBufferedSink.writeUtf8(RealBufferedSink.java:59) at com.android.okhttp.internal.http.Http1xStream.writeRequest(Http1xStream.java:169) at com.android.okhttp.internal.http.Http1xStream.writeRequestHeaders(Http1xStream.java:125) at […]