8211723: AppCDS: referring to a jar file in any way other than exactly how it was done during dumping doesn't work

Replaced os::file_name_strncmp() with os::same_files().

Reviewed-by: iklam, jiangli
This commit is contained in:
Calvin Cheung 2019-06-28 09:49:10 -07:00
parent 302b8d06ce
commit 5d1361df03
24 changed files with 822 additions and 192 deletions

View file

@ -53,6 +53,8 @@ public:
void set_next(ClassPathEntry* next);
virtual bool is_modules_image() const = 0;
virtual bool is_jar_file() const = 0;
// Is this entry created from the "Class-path" attribute from a JAR Manifest?
virtual bool from_class_path_attr() const = 0;
virtual const char* name() const = 0;
virtual JImageFile* jimage() const = 0;
virtual void close_jimage() = 0;
@ -73,6 +75,7 @@ class ClassPathDirEntry: public ClassPathEntry {
public:
bool is_modules_image() const { return false; }
bool is_jar_file() const { return false; }
bool from_class_path_attr() const { return false; }
const char* name() const { return _dir; }
JImageFile* jimage() const { return NULL; }
void close_jimage() {}
@ -99,13 +102,15 @@ class ClassPathZipEntry: public ClassPathEntry {
private:
jzfile* _zip; // The zip archive
const char* _zip_name; // Name of zip archive
bool _from_class_path_attr; // From the "Class-path" attribute of a jar file
public:
bool is_modules_image() const { return false; }
bool is_jar_file() const { return true; }
bool from_class_path_attr() const { return _from_class_path_attr; }
const char* name() const { return _zip_name; }
JImageFile* jimage() const { return NULL; }
void close_jimage() {}
ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append);
ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append, bool from_class_path_attr);
virtual ~ClassPathZipEntry();
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
ClassFileStream* open_stream(const char* name, TRAPS);
@ -122,6 +127,7 @@ private:
public:
bool is_modules_image() const;
bool is_jar_file() const { return false; }
bool from_class_path_attr() const { return false; }
bool is_open() const { return _jimage != NULL; }
const char* name() const { return _name == NULL ? "" : _name; }
JImageFile* jimage() const { return _jimage; }
@ -257,7 +263,8 @@ class ClassLoader: AllStatic {
public:
static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
bool throw_exception,
bool is_boot_append, TRAPS);
bool is_boot_append,
bool from_class_path_attr, TRAPS);
// If the package for the fully qualified class name is in the boot
// loader's package entry table then add_package() sets the classpath_index
@ -281,6 +288,7 @@ class ClassLoader: AllStatic {
static bool update_class_path_entry_list(const char *path,
bool check_for_duplicates,
bool is_boot_append,
bool from_class_path_attr,
bool throw_exception=true);
CDS_ONLY(static void update_module_path_entry_list(const char *path, TRAPS);)
static void print_bootclasspath();