Skip to content

400 error throwing FileNotFoundException #154

Description

@nynymike

We recently had a complaint from a client about a 400 response from the token endpoint that was causing AppAuth to throw a FileNotFoundException.

com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:238) at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)

It looks like it came from this library:
https://android.googlesource.com/platform/external/okhttp/+/781c9c2/okhttp-urlconnection/src/main/java/com/squareup/okhttp/internal/huc/HttpURLConnectionImpl.java

@Override public final InputStream getInputStream() throws IOException {
if (getResponseCode() >= HTTP_BAD_REQUEST) {
throw new FileNotFoundException(url.toString());
}

So instead of returning the 400, and other details about the message, it just throws a very confusing FileNotFoundException... which you would think would be a 404 if it really couldn't find a resource.

It makes me wonder about the quality of the underlying HTTP library. Is okhttp really good enough? Wouldn't you want to use at least goodhttp or even greathttp?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions