diff -r f31aacbd0f36 -r f3a6b82e25cf hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Mon Nov 05 19:33:44 2012 -0500 +++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Nov 07 17:53:02 2012 -0500 @@ -3706,8 +3706,10 @@ } } else { // Try to load the agent from the standard dll directory - os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), name); - library = os::dll_load(buffer, ebuf, sizeof ebuf); + if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), + name)) { + library = os::dll_load(buffer, ebuf, sizeof ebuf); + } #ifdef KERNEL // Download instrument dll if (library == NULL && strcmp(name, "instrument") == 0) { @@ -3732,8 +3734,9 @@ #endif // KERNEL if (library == NULL) { // Try the local directory char ns[1] = {0}; - os::dll_build_name(buffer, sizeof(buffer), ns, name); - library = os::dll_load(buffer, ebuf, sizeof ebuf); + if (os::dll_build_name(buffer, sizeof(buffer), ns, name)) { + library = os::dll_load(buffer, ebuf, sizeof ebuf); + } if (library == NULL) { const char *sub_msg = " on the library path, with error: "; size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1;