I am getting for the first time
Caused by: java.io.IOException: HTTP/1.1 header parser received no bytes
(my app seemed to work up to now...)
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest
.newBuilder()
.GET()
.uri(URI.create("..."))
.header("Content-Type", "application/json")
.build();
System.out.print(httpRequest.toString()); // dbg - it's ok
HttpResponse<String> response = null;
try {
response = httpClient.send(httpRequest,
HttpResponse.BodyHandlers.ofString());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
if (response != null && response.statusCode() == 200) {
JSONObject jsonObject = new JSONObject(response.body());
JSONArray jsonArray = jsonObject.getJSONArray("data");
ObjectMapper objectMapper = ObjectMapperCreator.getNewObjectMapper();
try {
if (jsonArray.length() > 0) {
correctlyCaught = true;
return objectMapper.readValue(jsonArray.get(0).toString(), GeocodingResponse.class);
}
} catch (IOException e) {
e.printStackTrace();
}
}
this is the code. Why am I getting this error?