question: public String canonicalize ( String simpleURL ) { String resultURL = simpleURL ; if ( simpleURL . startsWith ( "ftp." ) ) { resultURL = "ftp://" + simpleURL ; } else if ( simpleURL . startsWith ( "gopher." ) ) { resultURL = "gopher://" + simpleURL ; } else if ( simpleURL . startsWith ( "/" ) ) { resultURL = "file:" + simpleURL ; } else if ( ! hasProtocolName ( simpleURL ) ) { if ( isSimpleHostName ( simpleURL ) ) { simpleURL = "www." + simpleURL + ".com" ; } resultURL = "http://" + simpleURL ; } return resultURL ; }
target:  Given a possibly abbreviated URL (missing a protocol name, typically), this method's job is to transform that URL into a canonical form, by including a protocol name and additional syntax, if necessary. For a correctly formed URL, this method should just return its argument.