On Sunday, December 11, 2011 19:55:28 dsimcha wrote: > On 12/11/2011 7:53 PM, dsimcha wrote: > > Should the protocol detection be case-insensitive, i.e. "ftp://" == > > "FTP://"? > > Oh, one more thing: Factor the protocol detection out into a function. > You have the same expression cut and pasted everywhere: > > if(url.startsWith("ftp://") || url.startsWith("ftps://") ...
And startsWith will take multiple arguments, so the code definitely shouldn't have x.startsWith(y) || x.startsWith(z) || ... It's more verbose and less efficient that way. - Jonathan M Davis