Skip to content

Exceptions not handled in code on "Creating a Stream on an HTTP Source" #244

@authentictech

Description

@authentictech

In Learn -> The Stream API -> Creating Streams, the "Creating a Stream on an HTTP Source" section, I found that the compiler complains about some exceptions not being handled:

HttpResponse<Stream<String>> response = client.send(request, HttpResponse.BodyHandlers.ofLines());

Here, the compiler wants to handle IOException and InterruptedException.

Having put the above in the try block, the compiler complained about response not being initialised.

The compiler also complained about lines not being initialised below this.

In both cases, I initialised them to null outside of the try blocks, which seemed OK.

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