File tree Expand file tree Collapse file tree 2 files changed +1
-17
lines changed
src/java.base/share/classes Expand file tree Collapse file tree 2 files changed +1
-17
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ public void addFile(String s) {
239
239
private static URL toFileURL (String s ) {
240
240
try {
241
241
File f = new File (s ).getCanonicalFile ();
242
- return ParseUtil . fileToEncodedURL ( f );
242
+ return f . toPath (). toUri (). toURL ( );
243
243
} catch (IOException e ) {
244
244
return null ;
245
245
}
Original file line number Diff line number Diff line change @@ -229,22 +229,6 @@ public static String decode(String s) {
229
229
return sb .toString ();
230
230
}
231
231
232
- public static URL fileToEncodedURL (File file )
233
- throws MalformedURLException
234
- {
235
- String path = file .getAbsolutePath ();
236
- path = ParseUtil .encodePath (path );
237
- if (!path .startsWith ("/" )) {
238
- path = "/" + path ;
239
- }
240
- if (!path .endsWith ("/" ) && file .isDirectory ()) {
241
- path = path + "/" ;
242
- }
243
- @ SuppressWarnings ("deprecation" )
244
- var result = new URL ("file" , "" , path );
245
- return result ;
246
- }
247
-
248
232
public static java .net .URI toURI (URL url ) {
249
233
String protocol = url .getProtocol ();
250
234
String auth = url .getAuthority ();
You can’t perform that action at this time.
0 commit comments