title: Java : File.toURI().toURL() on Windows file
body: <p>The system I'm running on is Windows XP, with JRE 1.6.</p>
  
  <p>I do this : </p>
  
  <pre><code>public static void main(String[] args) {
      try {
          System.out.println(new File("C:\\test a.xml").toURI().toURL());
      } catch (Exception e) {
          e.printStackTrace();
      }       
  }
  </code></pre>
  
  <p>and I get this : <code>file:/C:/test%20a.xml</code></p>
  
  <p>How come the given URL doesn't have two slashes before the <code>C:</code> ? I expected <code>file://C:...</code>. Is it normal behaviour?</p>
  
  <hr>
  
  <p><strong>EDIT :</strong></p>
  
  <p>From Java source code : java.net.URLStreamHandler.toExternalForm(URL)</p>
  
  <pre><code>    result.append(":");
      if (u.getAuthority() != null &amp;&amp; u.getAuthority().length() &gt; 0) {
          result.append("//");
          result.append(u.getAuthority());
      }
  </code></pre>
  
  <p>It seems that the Authority part of a file URL is null or empty, and thus the double slash is skipped. So what is the authority part of a URL and is it really absent from the file protocol?</p>