Mercurial > hg > icedtea7-forest > jdk
changeset 9153:32c7a748163c
8163528: Better library loading
Reviewed-by: mullan
Contributed-by: florian@bogner.sh
author | valeriep |
---|---|
date | Thu, 20 Apr 2017 16:42:00 +0100 |
parents | d4266a3f85a6 |
children | ca9a077974d5 |
files | src/share/classes/sun/misc/Launcher.java |
diffstat | 1 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/sun/misc/Launcher.java Thu Apr 20 07:09:08 2017 +0100 +++ b/src/share/classes/sun/misc/Launcher.java Thu Apr 20 16:42:00 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,11 +28,7 @@ import java.io.File; import java.io.IOException; import java.io.FilePermission; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.MalformedURLException; -import java.net.URLStreamHandler; -import java.net.URLStreamHandlerFactory; +import java.net.*; import java.util.HashSet; import java.util.StringTokenizer; import java.util.Set; @@ -211,8 +207,16 @@ URL[] urls = super.getURLs(); File prevDir = null; for (int i = 0; i < urls.length; i++) { - // Get the ext directory from the URL - File dir = new File(urls[i].getPath()).getParentFile(); + // Get the ext directory from the URL; convert to + // URI first, so the URL will be decoded. + URI uri; + try { + uri = urls[i].toURI(); + } catch (URISyntaxException ue) { + // skip this URL if cannot convert it to URI + continue; + } + File dir = new File(uri).getParentFile(); if (dir != null && !dir.equals(prevDir)) { // Look in architecture-specific subdirectory first // Read from the saved system properties to avoid deadlock