@@ -2480,28 +2480,28 @@ void FileMapInfo::stop_sharing_and_unmap(const char* msg) {
2480
2480
ClassPathEntry** FileMapInfo::_classpath_entries_for_jvmti = NULL ;
2481
2481
2482
2482
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
+ }
2483
2488
ClassPathEntry* ent = _classpath_entries_for_jvmti[i];
2484
2489
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 );
2488
2499
} 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 ) {
2495
2502
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);
2497
2504
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
- }
2505
2505
}
2506
2506
}
2507
2507
0 commit comments