title: java.net.MalformedURLException: no protocol on URL based on a string modified with URLEncoder
body: <p>So I was attempting to use this String in a URL :- </p>
  
  <pre><code>http://site-test.com/Meetings/IC/DownloadDocument?meetingId=c21c905c-8359-4bd6-b864-844709e05754&amp;itemId=a4b724d1-282e-4b36-9d16-d619a807ba67&amp;file=\\s604132shvw140\Test-Documents\c21c905c-8359-4bd6-b864-844709e05754_attachments\7e89c3cb-ce53-4a04-a9ee-1a584e157987\myDoc.pdf
  </code></pre>
  
  <p>In this code: -</p>
  
  <pre><code>String fileToDownloadLocation = //The above string
  URL fileToDownload = new URL(fileToDownloadLocation);
  HttpGet httpget = new HttpGet(fileToDownload.toURI());
  </code></pre>
  
  <p>But at this point I get the error: -</p>
  
  <pre><code>java.net.URISyntaxException: Illegal character in query at index 169:Blahblahblah
  </code></pre>
  
  <p>I realised with a bit of googling this was due to the characters in the URL (guessing the &amp;), so I then added in some code so it now looks like so: -</p>
  
  <pre><code>String fileToDownloadLocation = //The above string
  fileToDownloadLocation = URLEncoder.encode(fileToDownloadLocation, "UTF-8");
  URL fileToDownload = new URL(fileToDownloadLocation);
  HttpGet httpget = new HttpGet(fileToDownload.toURI());
  </code></pre>
  
  <p>However, when I try and run this I get an error when I try and create the URL, the error then reads: -</p>
  
  <pre><code>java.net.MalformedURLException: no protocol: http%3A%2F%2Fsite-test.testsite.com%2FMeetings%2FIC%2FDownloadDocument%3FmeetingId%3Dc21c905c-8359-4bd6-b864-844709e05754%26itemId%3Da4b724d1-282e-4b36-9d16-d619a807ba67%26file%3D%5C%5Cs604132shvw140%5CTest-Documents%5Cc21c905c-8359-4bd6-b864-844709e05754_attachments%5C7e89c3cb-ce53-4a04-a9ee-1a584e157987%myDoc.pdf
  </code></pre>
  
  <p>It looks like I can't do the encoding until after I've created the URL else it replaces slashes and things which it shouldn't, but I can't see how I can create the URL with the string and then format it so its suitable for use.  I'm not particularly familiar with all this and was hoping someone might be able to point out to me what I'm missing to get string A into a suitably formatted URL to then use with the correct characters replaced?</p>
  
  <p>Any suggestions greatly appreciated!</p>