mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
6648438: 4/4 src/share/vm/prims/jvmtiEnv.cpp:457 assert(phase == JVMTI_PHASE_LIVE,"sanity check")
Return error on invalid JVMTI_PHASE instead of asserting. Reviewed-by: dholmes, ohair
This commit is contained in:
parent
779247f1cb
commit
8dd1b6ace1
1 changed files with 13 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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 */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue