提交 de6ba590 编写于 作者: D dcubed

6648438: 4/4 src/share/vm/prims/jvmtiEnv.cpp:457 assert(phase == JVMTI_PHASE_LIVE,"sanity check")

Summary: Return error on invalid JVMTI_PHASE instead of asserting.
Reviewed-by: dholmes, ohair
上级 29a506ab
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -408,8 +408,10 @@ JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) {
if (phase == JVMTI_PHASE_ONLOAD) {
Arguments::append_sysclasspath(segment);
return JVMTI_ERROR_NONE;
} else {
assert(phase == JVMTI_PHASE_LIVE, "sanity check");
} else if (phase == JVMTI_PHASE_LIVE) {
// The phase is checked by the wrapper that called this function,
// but this thread could be racing with the thread that is
// terminating the VM so we check one more time.
// create the zip entry
ClassPathZipEntry* zip_entry = ClassLoader::create_class_path_zip_entry(segment);
......@@ -430,6 +432,8 @@ JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) {
}
ClassLoader::add_to_list(zip_entry);
return JVMTI_ERROR_NONE;
} else {
return JVMTI_ERROR_WRONG_PHASE;
}
} /* end AddToBootstrapClassLoaderSearch */
......@@ -448,11 +452,12 @@ JvmtiEnv::AddToSystemClassLoaderSearch(const char* segment) {
}
}
return JVMTI_ERROR_NONE;
} else {
} else if (phase == JVMTI_PHASE_LIVE) {
// The phase is checked by the wrapper that called this function,
// but this thread could be racing with the thread that is
// terminating the VM so we check one more time.
HandleMark hm;
assert(phase == JVMTI_PHASE_LIVE, "sanity check");
// create the zip entry (which will open the zip file and hence
// check that the segment is indeed a zip file).
ClassPathZipEntry* zip_entry = ClassLoader::create_class_path_zip_entry(segment);
......@@ -501,6 +506,8 @@ JvmtiEnv::AddToSystemClassLoaderSearch(const char* segment) {
}
return JVMTI_ERROR_NONE;
} else {
return JVMTI_ERROR_WRONG_PHASE;
}
} /* end AddToSystemClassLoaderSearch */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册