Skip to content

Commit 0a09092

Browse files
committed
8268288: jdk/jfr/api/consumer/streaming/TestOutOfProcessMigration.java fails with "Error: ShouldNotReachHere()"
Reviewed-by: minqi, iklam
1 parent 0d938ce commit 0a09092

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/hotspot/share/cds/filemap.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,28 +2480,28 @@ void FileMapInfo::stop_sharing_and_unmap(const char* msg) {
24802480
ClassPathEntry** FileMapInfo::_classpath_entries_for_jvmti = NULL;
24812481

24822482
ClassPathEntry* FileMapInfo::get_classpath_entry_for_jvmti(int i, TRAPS) {
2483+
if (i == 0) {
2484+
// index 0 corresponds to the ClassPathImageEntry which is a globally shared object
2485+
// and should never be deleted.
2486+
return ClassLoader::get_jrt_entry();
2487+
}
24832488
ClassPathEntry* ent = _classpath_entries_for_jvmti[i];
24842489
if (ent == NULL) {
2485-
if (i == 0) {
2486-
ent = ClassLoader::get_jrt_entry();
2487-
assert(ent != NULL, "must be");
2490+
SharedClassPathEntry* scpe = shared_path(i);
2491+
assert(scpe->is_jar(), "must be"); // other types of scpe will not produce archived classes
2492+
2493+
const char* path = scpe->name();
2494+
struct stat st;
2495+
if (os::stat(path, &st) != 0) {
2496+
char *msg = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, strlen(path) + 128);
2497+
jio_snprintf(msg, strlen(path) + 127, "error in finding JAR file %s", path);
2498+
THROW_MSG_(vmSymbols::java_io_IOException(), msg, NULL);
24882499
} else {
2489-
SharedClassPathEntry* scpe = shared_path(i);
2490-
assert(scpe->is_jar(), "must be"); // other types of scpe will not produce archived classes
2491-
2492-
const char* path = scpe->name();
2493-
struct stat st;
2494-
if (os::stat(path, &st) != 0) {
2500+
ent = ClassLoader::create_class_path_entry(THREAD, path, &st, false, false);
2501+
if (ent == NULL) {
24952502
char *msg = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, strlen(path) + 128);
2496-
jio_snprintf(msg, strlen(path) + 127, "error in finding JAR file %s", path);
2503+
jio_snprintf(msg, strlen(path) + 127, "error in opening JAR file %s", path);
24972504
THROW_MSG_(vmSymbols::java_io_IOException(), msg, NULL);
2498-
} else {
2499-
ent = ClassLoader::create_class_path_entry(THREAD, path, &st, false, false);
2500-
if (ent == NULL) {
2501-
char *msg = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, strlen(path) + 128);
2502-
jio_snprintf(msg, strlen(path) + 127, "error in opening JAR file %s", path);
2503-
THROW_MSG_(vmSymbols::java_io_IOException(), msg, NULL);
2504-
}
25052505
}
25062506
}
25072507

0 commit comments

Comments
 (0)