8203354: assert in ClassLoader::update_module_path_entry_list() could have incorrect message

Converting the assert in ClassLoader::update_module_path_entry_list() to a meaningful error message before aborting the CDS dump.

Reviewed-by: stuefe, iklam
This commit is contained in:
Calvin Cheung 2018-05-24 09:15:09 -07:00
parent b83864b498
commit 55b6a9b02b
2 changed files with 52 additions and 3 deletions

View file

@ -711,8 +711,11 @@ void ClassLoader::add_to_module_path_entries(const char* path,
void ClassLoader::update_module_path_entry_list(const char *path, TRAPS) {
assert(DumpSharedSpaces, "dump time only");
struct stat st;
int ret = os::stat(path, &st);
assert(ret == 0, "module path must exist");
if (os::stat(path, &st) != 0) {
tty->print_cr("os::stat error %d (%s). CDS dump aborted (path was \"%s\").",
errno, os::errno_name(errno), path);
vm_exit_during_initialization();
}
// File or directory found
ClassPathEntry* new_entry = NULL;
new_entry = create_class_path_entry(path, &st, true /* throw_exception */,