On 11/07/2010 10:41, Simone Tripodi wrote: >> >> I think maybe the requestURL should be a String too - I'm trying to >> handle all of the IOExceptions in the HttpConnector. >> > > discouraged. making the requestURL as a proper URL saves to check the > string is a proper URL and we shouldn't reinvent the wheel.
The requestURL is only passed to the HttpConnector, nowhere else. It will start as a String somewhere in the system, so we have to catch an IOException to create the URL object. This isn't a case of reinventing the wheel at all, it's a case of putting all of the IO operations/checks associated with making the request in one place. I don't see any advantage in doing that try+catch at anywhere before the IO processing begins. The related issue is whether to validate the request before making it - which will probably be necessary in the case of checking the plaintext method is an HTTPS one. Leading on from that, if we automatically* upgraded the plaintext connection to HTTPS, it would mean recreating the URL object, complete with try+catch etc, rather than a simple String regex. * Checked via a system property, defaults to 'on'
signature.asc
Description: OpenPGP digital signature
