src/share/vm/memory/filemap.cpp

Print this page

        

@@ -215,14 +215,19 @@
           }
 
           EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
           SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
         } else {
-          ent->_filesize  = -1;
+          struct stat st;
+          if ((os::stat(name, &st) == 0) && ((st.st_mode & S_IFDIR) == S_IFDIR)) {
           if (!os::dir_is_empty(name)) {
             ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
           }
+            ent->_filesize = -1;
+          } else {
+            ent->_filesize = -2;
+          }
         }
         ent->_name = strptr;
         if (strptr + name_bytes <= strptr_max) {
           strncpy(strptr, name, (size_t)name_bytes); // name_bytes includes trailing 0.
           strptr += name_bytes;

@@ -269,11 +274,11 @@
     } else if (ent->is_dir()) {
       if (!os::dir_is_empty(name)) {
         fail_continue("directory is not empty: %s", name);
         ok = false;
       }
-    } else {
+    } else if (ent->is_jar()) {
       if (ent->_timestamp != st.st_mtime ||
           ent->_filesize != st.st_size) {
         ok = false;
         if (PrintSharedArchiveAndExit) {
           fail_continue(ent->_timestamp != st.st_mtime ?