Mercurial > hg > icedtea8-forest > jdk
changeset 12508:af0e709d28f9 jdk8u131-b05
8163528: Better library loading
Reviewed-by: mullan
Contributed-by: florian@bogner.sh
author | valeriep |
---|---|
date | Wed, 23 Nov 2016 19:46:28 +0000 |
parents | 35a5813daea1 |
children | 4a42e488b516 |
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 Tue Jan 17 15:35:57 2017 +0300 +++ b/src/share/classes/sun/misc/Launcher.java Wed Nov 23 19:46:28 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, 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; @@ -213,8 +209,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