user = url.getUserInfo();
  protected String toExternalForm(URL url)  {    String protocol;    String host;    String file;    String ref;    String user;    int port;    protocol = url.getProtocol();    // JDK 1.2 online doc infers that host could be null because it    // explicitly states that file cannot be null, but is silent on host.    host = url.getHost();    if (host == null)      host = "";    port = url.getPort();    file = url.getFile();    ref = url.getRef();    user = url.getUserInfo();    // Guess a reasonable size for the string buffer so we have to resize    // at most once.    int size = protocol.length() + host.length() + file.length() + 24;    StringBuffer sb = new StringBuffer(size);    if (protocol.length() != 0)      {	sb.append(protocol);	sb.append(":");      }    if (host.length() != 0)      {	sb.append("//");	if (user != null && ! "".equals(user))	  sb.append(user).append('@');	sb.append(host);	// Append port if port was in URL spec.	if (port >= 0)	  sb.append(':').append(port);      }    sb.append(file);    if (ref != null)      sb.append('#').append(ref);    return sb.toString();  }