title: Java - Malformed URL - Not correct - No protocol
body: <p>This code:</p>
  
  <pre><code>        String file = "";
      String filename = "";
      try{
          BufferedReader ins = new BufferedReader(new FileReader(new File("filename.txt")));//get file name
          while (ins.ready()) {
             filename = ins.readLine();
          }
          ins.close();
          }catch(Exception e){
          }
  
          String[] sa = filename.split("/");
          file = sa[sa.length - 1];
  
          try {
              System.out.println(filename);
          } catch (Exception e) {
              e.printStackTrace();
          }
  </code></pre>
  
  <p>Prints:</p>
  
  <pre><code>http://wordpress.org/plugins/about/readme.txt
  </code></pre>
  
  <p>When I try to do :</p>
  
  <pre><code>         URL url = new URL(filename);
  </code></pre>
  
  <p>I get the malformed URL exception : no protocol
  This is happening for no reason. If I manually assign the filename string to 
  "<a href="http://wordpress.org/plugins/about/readme.txt" rel="nofollow">http://wordpress.org/plugins/about/readme.txt</a>" it will work perfectly , is there something wrong with the file reader?</p>
  
  <p>The thing goes like </p>
  
  <p>Read a string from the file and then make it a URL! Stop editing wrongly!</p>