246 bytes += name_bytes;
247 log_info(class, path)("add main shared path (%s) %s", (cpe->is_jar_file() ? "jar" : "dir"), name);
248 } else {
249 SharedClassPathEntry* ent = shared_classpath(cur_entry);
250 if (cpe->is_jar_file()) {
251 struct stat st;
252 if (os::stat(name, &st) != 0) {
253 // The file/dir must exist, or it would not have been added
254 // into ClassLoader::classpath_entry().
255 //
256 // If we can't access a jar file in the boot path, then we can't
257 // make assumptions about where classes get loaded from.
258 FileMapInfo::fail_stop("Unable to open jar file %s.", name);
259 }
260
261 EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
262 SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
263 } else {
264 struct stat st;
265 if (os::stat(name, &st) == 0) {
266 if ((st.st_mode & S_IFDIR) == S_IFDIR) {
267 if (!os::dir_is_empty(name)) {
268 ClassLoader::exit_with_path_failure(
269 "Cannot have non-empty directory in archived classpaths", name);
270 }
271 ent->_filesize = -1;
272 }
273 }
274 if (ent->_filesize == 0) {
275 // unknown
276 ent->_filesize = -2;
277 }
278 }
279 ent->_name = strptr;
280 if (strptr + name_bytes <= strptr_max) {
281 strncpy(strptr, name, (size_t)name_bytes); // name_bytes includes trailing 0.
282 strptr += name_bytes;
283 } else {
284 assert(0, "miscalculated buffer size");
285 }
286 }
|
246 bytes += name_bytes;
247 log_info(class, path)("add main shared path (%s) %s", (cpe->is_jar_file() ? "jar" : "dir"), name);
248 } else {
249 SharedClassPathEntry* ent = shared_classpath(cur_entry);
250 if (cpe->is_jar_file()) {
251 struct stat st;
252 if (os::stat(name, &st) != 0) {
253 // The file/dir must exist, or it would not have been added
254 // into ClassLoader::classpath_entry().
255 //
256 // If we can't access a jar file in the boot path, then we can't
257 // make assumptions about where classes get loaded from.
258 FileMapInfo::fail_stop("Unable to open jar file %s.", name);
259 }
260
261 EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
262 SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
263 } else {
264 struct stat st;
265 if (os::stat(name, &st) == 0) {
266 if ((st.st_mode & S_IFMT) == S_IFDIR) {
267 if (!os::dir_is_empty(name)) {
268 ClassLoader::exit_with_path_failure(
269 "Cannot have non-empty directory in archived classpaths", name);
270 }
271 ent->_filesize = -1;
272 }
273 }
274 if (ent->_filesize == 0) {
275 // unknown
276 ent->_filesize = -2;
277 }
278 }
279 ent->_name = strptr;
280 if (strptr + name_bytes <= strptr_max) {
281 strncpy(strptr, name, (size_t)name_bytes); // name_bytes includes trailing 0.
282 strptr += name_bytes;
283 } else {
284 assert(0, "miscalculated buffer size");
285 }
286 }
|