--- old/src/java.base/share/classes/sun/security/tools/PathList.java 2018-09-10 14:12:25.111490752 -0400 +++ new/src/java.base/share/classes/sun/security/tools/PathList.java 2018-09-10 14:12:24.651490752 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, 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 @@ -27,11 +27,9 @@ import java.io.File; import java.io.IOException; -import java.lang.String; -import java.util.StringTokenizer; -import java.net.URL; -import java.net.URLClassLoader; import java.net.MalformedURLException; +import java.net.URL; +import java.nio.file.Paths; /** * A utility class for handle path list @@ -63,21 +61,10 @@ * @return the resulting array of directory and JAR file URLs */ public static URL[] pathToURLs(String path) { - StringTokenizer st = new StringTokenizer(path, File.pathSeparator); - URL[] urls = new URL[st.countTokens()]; - int count = 0; - while (st.hasMoreTokens()) { - URL url = fileToURL(new File(st.nextToken())); - if (url != null) { - urls[count++] = url; - } - } - if (urls.length != count) { - URL[] tmp = new URL[count]; - System.arraycopy(urls, 0, tmp, 0, count); - urls = tmp; - } - return urls; + return Paths.pathToStrings(path) + .stream() + .map(s -> fileToURL(new File(s))) + .toArray(URL[]::new); } /**