Skip to content

NullPointer in HttpClient for IOException but no errorStream #85

@bweefting

Description

@bweefting

We get an error-logging from within Prismic.
As this happens while handling an exception before logging it, it hides the actual issue.

`
package io.prismic.core;
public class HttpClient {

public static JsonNode fetch(String url, Logger logger, Cache cache, Proxy proxy) {
....
} catch (IOException e) {
String body;
String errorText = "Unknown error";
JsonNode errorJson = new ObjectMapper().readTree(httpConnection.getErrorStream());
`

The httpConnection.getErrorStream is (per documentation) possibly NULL.
The readTree() method however does not support that.

Seems at least a simple-NULL-check could prevent this.

Another PR (#69) is open for quite some time.
Is there any activity on this repo, if alternative libraries are available would like to learn that :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions