@@ -2347,28 +2347,28 @@ void FileMapInfo::stop_sharing_and_unmap(const char* msg) {
2347
2347
ClassPathEntry** FileMapInfo::_classpath_entries_for_jvmti = NULL ;
2348
2348
2349
2349
ClassPathEntry* FileMapInfo::get_classpath_entry_for_jvmti (int i, TRAPS) {
2350
+ if (i == 0 ) {
2351
+ // index 0 corresponds to the ClassPathImageEntry which is a globally shared object
2352
+ // and should never be deleted.
2353
+ return ClassLoader::get_jrt_entry ();
2354
+ }
2350
2355
ClassPathEntry* ent = _classpath_entries_for_jvmti[i];
2351
2356
if (ent == NULL ) {
2352
- if (i == 0 ) {
2353
- ent = ClassLoader::get_jrt_entry ();
2354
- assert (ent != NULL , " must be" );
2355
- } else {
2356
- SharedClassPathEntry* scpe = shared_path (i);
2357
- assert (scpe->is_jar (), " must be" ); // other types of scpe will not produce archived classes
2357
+ SharedClassPathEntry* scpe = shared_path (i);
2358
+ assert (scpe->is_jar (), " must be" ); // other types of scpe will not produce archived classes
2358
2359
2359
- const char * path = scpe->name ();
2360
- struct stat st;
2361
- if (os::stat (path, &st) != 0 ) {
2360
+ const char * path = scpe->name ();
2361
+ struct stat st;
2362
+ if (os::stat (path, &st) != 0 ) {
2363
+ char *msg = NEW_RESOURCE_ARRAY_IN_THREAD (THREAD, char , strlen (path) + 128 );
2364
+ jio_snprintf (msg, strlen (path) + 127 , " error in finding JAR file %s" , path);
2365
+ THROW_MSG_ (vmSymbols::java_io_IOException (), msg, NULL );
2366
+ } else {
2367
+ ent = ClassLoader::create_class_path_entry (THREAD, path, &st, false , false );
2368
+ if (ent == NULL ) {
2362
2369
char *msg = NEW_RESOURCE_ARRAY_IN_THREAD (THREAD, char , strlen (path) + 128 );
2363
- jio_snprintf (msg, strlen (path) + 127 , " error in finding JAR file %s" , path);
2370
+ jio_snprintf (msg, strlen (path) + 127 , " error in opening JAR file %s" , path);
2364
2371
THROW_MSG_ (vmSymbols::java_io_IOException (), msg, NULL );
2365
- } else {
2366
- ent = ClassLoader::create_class_path_entry (THREAD, path, &st, false , false );
2367
- if (ent == NULL ) {
2368
- char *msg = NEW_RESOURCE_ARRAY_IN_THREAD (THREAD, char , strlen (path) + 128 );
2369
- jio_snprintf (msg, strlen (path) + 127 , " error in opening JAR file %s" , path);
2370
- THROW_MSG_ (vmSymbols::java_io_IOException (), msg, NULL );
2371
- }
2372
2372
}
2373
2373
}
2374
2374
0 commit comments