--- old/src/java.base/share/classes/java/lang/ClassLoader.java 2018-09-10 14:12:17.443490752 -0400 +++ new/src/java.base/share/classes/java/lang/ClassLoader.java 2018-09-10 14:12:16.967490752 -0400 @@ -68,6 +68,7 @@ import jdk.internal.ref.CleanerFactory; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; +import jdk.internal.util.PathParser; import sun.reflect.misc.ReflectUtil; import sun.security.util.SecurityConstants; @@ -2555,53 +2556,8 @@ private static String[] initializePath(String propName) { String ldPath = System.getProperty(propName, ""); - int ldLen = ldPath.length(); - char ps = File.pathSeparatorChar; - int psCount = 0; - - if (ClassLoaderHelper.allowsQuotedPathElements && - ldPath.indexOf('\"') >= 0) { - // First, remove quotes put around quoted parts of paths. - // Second, use a quotation mark as a new path separator. - // This will preserve any quoted old path separators. - char[] buf = new char[ldLen]; - int bufLen = 0; - for (int i = 0; i < ldLen; ++i) { - char ch = ldPath.charAt(i); - if (ch == '\"') { - while (++i < ldLen && - (ch = ldPath.charAt(i)) != '\"') { - buf[bufLen++] = ch; - } - } else { - if (ch == ps) { - psCount++; - ch = '\"'; - } - buf[bufLen++] = ch; - } - } - ldPath = new String(buf, 0, bufLen); - ldLen = bufLen; - ps = '\"'; - } else { - for (int i = ldPath.indexOf(ps); i >= 0; - i = ldPath.indexOf(ps, i + 1)) { - psCount++; - } - } - String[] paths = new String[psCount + 1]; - int pathStart = 0; - for (int j = 0; j < psCount; ++j) { - int pathEnd = ldPath.indexOf(ps, pathStart); - paths[j] = (pathStart < pathEnd) ? - ldPath.substring(pathStart, pathEnd) : "."; - pathStart = pathEnd + 1; - } - paths[psCount] = (pathStart < ldLen) ? - ldPath.substring(pathStart, ldLen) : "."; - return paths; + return PathParser.parsePath(ldPath, "."); } // Invoked in the java.lang.Runtime class to implement load and loadLibrary.