diff -r 4d2a15091124 -r b3055c216762 hotspot/src/share/vm/prims/jvmtiEnv.cpp --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp Wed Jul 05 22:04:04 2017 +0200 +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp Wed Aug 10 15:48:04 2016 -0700 @@ -24,6 +24,8 @@ #include "precompiled.hpp" #include "classfile/classLoaderExt.hpp" +#include "classfile/javaClasses.inline.hpp" +#include "classfile/stringTable.hpp" #include "classfile/modules.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" @@ -224,6 +226,7 @@ return JVMTI_ERROR_NONE; } /* end GetNamedModule */ + // // Class functions // @@ -3465,28 +3468,35 @@ JvmtiEnv::GetSystemProperties(jint* count_ptr, char*** property_ptr) { jvmtiError err = JVMTI_ERROR_NONE; - *count_ptr = Arguments::PropertyList_count(Arguments::system_properties()); - + // Get the number of readable properties. + *count_ptr = Arguments::PropertyList_readable_count(Arguments::system_properties()); + + // Allocate memory to hold the exact number of readable properties. err = allocate(*count_ptr * sizeof(char *), (unsigned char **)property_ptr); if (err != JVMTI_ERROR_NONE) { return err; } - int i = 0 ; - for (SystemProperty* p = Arguments::system_properties(); p != NULL && i < *count_ptr; p = p->next(), i++) { - const char *key = p->key(); - char **tmp_value = *property_ptr+i; - err = allocate((strlen(key)+1) * sizeof(char), (unsigned char**)tmp_value); - if (err == JVMTI_ERROR_NONE) { - strcpy(*tmp_value, key); - } else { - // clean up previously allocated memory. - for (int j=0; jnext()) { + if (p->is_readable()) { + const char *key = p->key(); + char **tmp_value = *property_ptr+readable_count; + readable_count++; + err = allocate((strlen(key)+1) * sizeof(char), (unsigned char**)tmp_value); + if (err == JVMTI_ERROR_NONE) { + strcpy(*tmp_value, key); + } else { + // clean up previously allocated memory. + for (int j=0; j