I have HTML based queries in my code and one specific kind seems to give rise to IOExceptions
upon receiving 505 response from the server. I have looked up the
from the API documentation for the URL class:
The URL class does not itself encode or decode any URL components [...]. It is the responsibility of the caller to encode any fields, which need to be escaped prior to calling URL, and also to decode any escaped fields, that are returned from URL.
so if you have any spaces in your url-str encode it before calling new URL(url-str)