593 setup_search_path(sys_class_path);
594 }
595
596 #if INCLUDE_CDS
597 int ClassLoader::get_shared_paths_misc_info_size() {
598 return _shared_paths_misc_info->get_used_bytes();
599 }
600
601 void* ClassLoader::get_shared_paths_misc_info() {
602 return _shared_paths_misc_info->buffer();
603 }
604
605 bool ClassLoader::check_shared_paths_misc_info(void *buf, int size) {
606 SharedPathsMiscInfo* checker = SharedClassUtil::allocate_shared_paths_misc_info((char*)buf, size);
607 bool result = checker->check();
608 delete checker;
609 return result;
610 }
611 #endif
612
613 void ClassLoader::setup_search_path(const char *class_path) {
614 int offset = 0;
615 int len = (int)strlen(class_path);
616 int end = 0;
617
618 // Iterate over class path entries
619 for (int start = 0; start < len; start = end) {
620 while (class_path[end] && class_path[end] != os::path_separator()[0]) {
621 end++;
622 }
623 EXCEPTION_MARK;
624 ResourceMark rm(THREAD);
625 char* path = NEW_RESOURCE_ARRAY(char, end - start + 1);
626 strncpy(path, &class_path[start], end - start);
627 path[end - start] = '\0';
628 update_class_path_entry_list(path, false);
629 #if INCLUDE_CDS
630 if (DumpSharedSpaces) {
631 check_shared_classpath(path);
632 }
633 #endif
634 while (class_path[end] == os::path_separator()[0]) {
635 end++;
636 }
637 }
638 }
639
640 ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const struct stat* st,
641 bool lazy, bool throw_exception, TRAPS) {
642 JavaThread* thread = JavaThread::current();
643 if (lazy) {
644 return new LazyClassPathEntry(path, st, throw_exception);
645 }
646 ClassPathEntry* new_entry = NULL;
647 if ((st->st_mode & S_IFREG) == S_IFREG) {
648 // Regular file, should be a zip file
|
593 setup_search_path(sys_class_path);
594 }
595
596 #if INCLUDE_CDS
597 int ClassLoader::get_shared_paths_misc_info_size() {
598 return _shared_paths_misc_info->get_used_bytes();
599 }
600
601 void* ClassLoader::get_shared_paths_misc_info() {
602 return _shared_paths_misc_info->buffer();
603 }
604
605 bool ClassLoader::check_shared_paths_misc_info(void *buf, int size) {
606 SharedPathsMiscInfo* checker = SharedClassUtil::allocate_shared_paths_misc_info((char*)buf, size);
607 bool result = checker->check();
608 delete checker;
609 return result;
610 }
611 #endif
612
613 void ClassLoader::setup_search_path(const char *class_path, bool canonicalize) {
614 int offset = 0;
615 int len = (int)strlen(class_path);
616 int end = 0;
617
618 // Iterate over class path entries
619 for (int start = 0; start < len; start = end) {
620 while (class_path[end] && class_path[end] != os::path_separator()[0]) {
621 end++;
622 }
623 EXCEPTION_MARK;
624 ResourceMark rm(THREAD);
625 char* path = NEW_RESOURCE_ARRAY(char, end - start + 1);
626 strncpy(path, &class_path[start], end - start);
627 path[end - start] = '\0';
628 if (canonicalize) {
629 char* canonical_path = NEW_RESOURCE_ARRAY(char, JVM_MAXPATHLEN + 1);
630 if (get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
631 path = canonical_path;
632 }
633 }
634 update_class_path_entry_list(path, /*check_for_duplicates=*/canonicalize);
635 #if INCLUDE_CDS
636 if (DumpSharedSpaces) {
637 check_shared_classpath(path);
638 }
639 #endif
640 while (class_path[end] == os::path_separator()[0]) {
641 end++;
642 }
643 }
644 }
645
646 ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const struct stat* st,
647 bool lazy, bool throw_exception, TRAPS) {
648 JavaThread* thread = JavaThread::current();
649 if (lazy) {
650 return new LazyClassPathEntry(path, st, throw_exception);
651 }
652 ClassPathEntry* new_entry = NULL;
653 if ((st->st_mode & S_IFREG) == S_IFREG) {
654 // Regular file, should be a zip file
|