220 } else {
221 // The file/dir must exist, or it would not have been added
222 // into ClassLoader::classpath_entry().
223 //
224 // If we can't access a jar file in the boot path, then we can't
225 // make assumptions about where classes get loaded from.
226 FileMapInfo::fail_stop("Unable to open file %s.", name);
227 }
228
229 size_t len = strlen(name) + 1;
230 _name = MetadataFactory::new_array<char>(ClassLoaderData::the_null_class_loader_data(), (int)len, THREAD);
231 strcpy(_name->data(), name);
232 }
233
234 bool SharedClassPathEntry::validate(bool is_class_path) {
235 struct stat st;
236 const char* name = this->name();
237 bool ok = true;
238 log_info(class, path)("checking shared classpath entry: %s", name);
239 if (os::stat(name, &st) != 0 && is_class_path) {
240 FileMapInfo::fail_continue("Required classpath entry does not exist: %s", name);
241 ok = false;
242 } else if (is_dir() && is_class_path) {
243 if (!os::dir_is_empty(name)) {
244 FileMapInfo::fail_continue("directory is not empty: %s", name);
245 ok = false;
246 }
247 } else if (is_jar_or_bootimage()) {
248 if (_timestamp != st.st_mtime ||
249 _filesize != st.st_size) {
250 ok = false;
251 if (PrintSharedArchiveAndExit) {
252 FileMapInfo::fail_continue(_timestamp != st.st_mtime ?
253 "Timestamp mismatch" :
254 "File size mismatch");
255 } else {
256 FileMapInfo::fail_continue("A jar/jimage file is not the one used while building"
257 " the shared archive file: %s", name);
258 }
259 }
260 }
261 return ok;
262 }
|
220 } else {
221 // The file/dir must exist, or it would not have been added
222 // into ClassLoader::classpath_entry().
223 //
224 // If we can't access a jar file in the boot path, then we can't
225 // make assumptions about where classes get loaded from.
226 FileMapInfo::fail_stop("Unable to open file %s.", name);
227 }
228
229 size_t len = strlen(name) + 1;
230 _name = MetadataFactory::new_array<char>(ClassLoaderData::the_null_class_loader_data(), (int)len, THREAD);
231 strcpy(_name->data(), name);
232 }
233
234 bool SharedClassPathEntry::validate(bool is_class_path) {
235 struct stat st;
236 const char* name = this->name();
237 bool ok = true;
238 log_info(class, path)("checking shared classpath entry: %s", name);
239 if (os::stat(name, &st) != 0 && is_class_path) {
240 // If the archived module path entry does not exist at runtime, it is not fatal
241 // (no need to invalid the shared archive) because the shared runtime visibility check
242 // filters out any archived module classes that do not have a matching runtime
243 // module path location.
244 FileMapInfo::fail_continue("Required classpath entry does not exist: %s", name);
245 ok = false;
246 } else if (is_dir()) {
247 if (!os::dir_is_empty(name)) {
248 FileMapInfo::fail_continue("directory is not empty: %s", name);
249 ok = false;
250 }
251 } else if (is_jar_or_bootimage()) {
252 if (_timestamp != st.st_mtime ||
253 _filesize != st.st_size) {
254 ok = false;
255 if (PrintSharedArchiveAndExit) {
256 FileMapInfo::fail_continue(_timestamp != st.st_mtime ?
257 "Timestamp mismatch" :
258 "File size mismatch");
259 } else {
260 FileMapInfo::fail_continue("A jar/jimage file is not the one used while building"
261 " the shared archive file: %s", name);
262 }
263 }
264 }
265 return ok;
266 }
|