The difference here is that URL will not insert the %20 for space that URI will. @param path @return
(String path)
| 172 | * @return |
| 173 | */ |
| 174 | public static URL getAbsoluteURL(String path) { |
| 175 | URL url = null; |
| 176 | try { |
| 177 | url = (path.indexOf("file:") == 0 ? new URL(path) : new File(new File(path).getAbsolutePath()).toURI().toURL()); |
| 178 | if (path.indexOf("!/")>=0) |
| 179 | url = new URL("jar", null, url.toString()); |
| 180 | } catch (MalformedURLException e) { |
| 181 | e.printStackTrace(); |
| 182 | } |
| 183 | return url; |
| 184 | } |
| 185 | |
| 186 | public static URI getAbsoluteURI(String path) { |
| 187 | URI uri = null; |
no test coverage detected