< prev index next >

src/hotspot/share/cds/cdsProtectionDomain.cpp

Print this page
*** 86,22 ***
      //
      //   Note that if an element of these 3 _shared_xxx arrays is null, it will be initialized by
      //   the corresponding SystemDictionaryShared::get_shared_xxx() function.
      Handle manifest = get_shared_jar_manifest(index, CHECK_NH);
      Handle url = get_shared_jar_url(index, CHECK_NH);
!     int index_offset = index - ClassLoaderExt::app_class_paths_start_index();
!     if (index_offset < PackageEntry::max_index_for_defined_in_class_path()) {
!       if (pkg_entry == nullptr || !pkg_entry->is_defined_by_cds_in_class_path(index_offset)) {
!         // define_shared_package only needs to be called once for each package in a jar specified
!         // in the shared class path.
!         define_shared_package(class_name, class_loader, manifest, url, CHECK_NH);
!         if (pkg_entry != nullptr) {
!           pkg_entry->set_defined_by_cds_in_class_path(index_offset);
          }
        }
-     } else {
-       define_shared_package(class_name, class_loader, manifest, url, CHECK_NH);
      }
      return get_shared_protection_domain(class_loader, index, url, THREAD);
    }
  }
  
--- 86,24 ---
      //
      //   Note that if an element of these 3 _shared_xxx arrays is null, it will be initialized by
      //   the corresponding SystemDictionaryShared::get_shared_xxx() function.
      Handle manifest = get_shared_jar_manifest(index, CHECK_NH);
      Handle url = get_shared_jar_url(index, CHECK_NH);
!     if (!CDSConfig::is_loading_packages()) {
!       int index_offset = index - ClassLoaderExt::app_class_paths_start_index();
!       if (index_offset < PackageEntry::max_index_for_defined_in_class_path()) {
!         if (pkg_entry == nullptr || !pkg_entry->is_defined_by_cds_in_class_path(index_offset)) {
!           // define_shared_package only needs to be called once for each package in a jar specified
!           // in the shared class path.
!           define_shared_package(class_name, class_loader, manifest, url, CHECK_NH);
!           if (pkg_entry != nullptr) {
+             pkg_entry->set_defined_by_cds_in_class_path(index_offset);
+           }
          }
+       } else {
+         define_shared_package(class_name, class_loader, manifest, url, CHECK_NH);
        }
      }
      return get_shared_protection_domain(class_loader, index, url, THREAD);
    }
  }
  
< prev index next >