Skip to content

Commit 1846a5a

Browse files
committed
1 parent 837e55d commit 1846a5a

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

src/java.base/share/classes/jdk/internal/loader/URLClassPath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void addFile(String s) {
239239
private static URL toFileURL(String s) {
240240
try {
241241
File f = new File(s).getCanonicalFile();
242-
return ParseUtil.fileToEncodedURL(f);
242+
return f.toPath().toUri().toURL();
243243
} catch (IOException e) {
244244
return null;
245245
}

src/java.base/share/classes/sun/net/www/ParseUtil.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,22 +229,6 @@ public static String decode(String s) {
229229
return sb.toString();
230230
}
231231

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-
248232
public static java.net.URI toURI(URL url) {
249233
String protocol = url.getProtocol();
250234
String auth = url.getAuthority();

0 commit comments

Comments
 (0)