8236075: Minor bootstrap improvements

Reviewed-by: mchung, alanb
This commit is contained in:
Claes Redestad 2020-01-21 13:28:15 +01:00
parent 3cf8b34d54
commit c639682887
10 changed files with 208 additions and 145 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@ -31,11 +31,6 @@ class ClassLoaderHelper {
private ClassLoaderHelper() {}
/**
* Indicates, whether PATH env variable is allowed to contain quoted entries.
*/
static final boolean allowsQuotedPathElements = false;
/**
* Returns an alternate path name for the given file
* such that if the original pathname did not exist, then the
@ -50,4 +45,25 @@ class ClassLoaderHelper {
}
return new File(name.substring(0, index) + ".jnilib");
}
/**
* Parse a PATH env variable.
*
* Empty elements will be replaced by dot.
*/
static String[] parsePath(String ldPath) {
char ps = File.pathSeparatorChar;
ArrayList<String> paths = new ArrayList<>();
int pathStart = 0;
int pathEnd;
while ((pathEnd = ldPath.indexOf(ps, pathStart)) >= 0) {
paths.add((pathStart < pathEnd) ?
ldPath.substring(pathStart, pathEnd) : ".");
pathStart = pathEnd + 1;
}
int ldLen = ldPath.length();
paths.add((pathStart < ldLen) ?
ldPath.substring(pathStart, ldLen) : ".");
return paths.toArray(new String[paths.size()]);
}
}