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.
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
IOExceptionandInterruptedException.Having put the above in the try block, the compiler complained about
responsenot being initialised.The compiler also complained about
linesnot being initialised below this.In both cases, I initialised them to null outside of the try blocks, which seemed OK.