title: sun.net.www.ParseUtil.decode() vs java.net.URLDecoder.decode()
body: <p>I have some legacy code that is calling <code>sun.net.www.ParseUtil.decode()</code>. I would like to avoid calling vendor specific functions, so I want to replace the call with something else.</p>
  
  <p>Can I use java.net.URLDecoder.decode() as a drop-in replacement or is there something I should look out for?</p>
  
  <p>The call is used to convert a file URL to a normal path inside a custom classloader:</p>
  
  <pre><code>URL url = //...
  if(url.getProtocol().equals("file"))) {
      String path = url.getFile().replace('/', File.separatorChar);
      path = ParseUtil.decode(path);
      if (path.endsWith(File.separator)){
         path += "-";
      }
      p = new FilePermission(path, SecurityConstants.FILE_READ_ACTION);
   }
  </code></pre>
  
  <p>(Note that this is almost exactly the same code as in <a href="http://www.docjar.com/html/api/java/net/URLClassLoader.java.html#661" rel="nofollow"><code>java.net.UrlClassLoader.getPermissions()</code></a>)</p>