I'm performing an endpoint check but somehow I got a NoSuchElementException:
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod(HttpMethod.HEAD.name());
conn.setUseCaches(false);
conn.setConnectTimeout(CONNECT_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
final HttpStatus rc = HttpStatus.valueOf(conn.getResponseCode());
According to the logs, it failing on the
final HttpStatus rc = HttpStatus.valueOf(conn.getResponseCode());
What I'm not sure is why is this happening, I've checked Java documentation regarding HttpURLConnection and HttpStatus and none of them will throw a this kind of exception.
I've go through the documentation and also tried to insert values that may trigger that exception so I can understand a little bit why this is happening but I've no luck