Skip to content
Permalink
Browse files

Automatic merge of jdk:master into master

  • Loading branch information
duke
duke committed May 28, 2020
2 parents 1eb656b + f3c463b commit cc9dee58a0a0b99db0a2a097cdb31395eb80c55b
@@ -64,7 +64,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \
LIBS_linux := $(LIBDL), \
LIBS_macosx := -liconv, \
LIBS_aix := -liconv, \
LIBS_windows := $(WIN_JAVA_LIB), \
))

$(BUILD_LIBJDWP): $(call FindLib, java.base, java)
@@ -77,10 +77,10 @@ printLastError(jdwpTransportEnv *t, jdwpTransportError err)

/* Convert this string to UTF8 */
len = (int)strlen(msg);
maxlen = len+len/2+2; /* Should allow for plenty of room */
utf8msg = (jbyte*)jvmtiAllocate(maxlen+1);
maxlen = len * 4 + 1;
utf8msg = (jbyte*)jvmtiAllocate(maxlen);
if (utf8msg != NULL) {
(void)utf8FromPlatform(msg, len, utf8msg, maxlen+1);
(void)utf8FromPlatform(msg, len, utf8msg, maxlen);
}
}
if (rv == JDWPTRANSPORT_ERROR_NONE) {
@@ -26,6 +26,7 @@
#include <ctype.h>

#include "util.h"
#include "utf_util.h"
#include "transport.h"
#include "eventHandler.h"
#include "threadControl.h"
@@ -1652,13 +1653,26 @@ setAgentPropertyValue(JNIEnv *env, char *propertyName, char* propertyValue)
/* Create jstrings for property name and value */
nameString = JNI_FUNC_PTR(env,NewStringUTF)(env, propertyName);
if (nameString != NULL) {
valueString = JNU_NewStringPlatform(env, propertyValue);
if (valueString != NULL) {
/* invoke Properties.setProperty */
JNI_FUNC_PTR(env,CallObjectMethod)
(env, gdata->agent_properties,
gdata->setProperty,
nameString, valueString);
/* convert the value to UTF8 */
int len;
char *utf8value;
int utf8maxSize;

len = (int)strlen(propertyValue);
utf8maxSize = len * 4 + 1;
utf8value = (char *)jvmtiAllocate(utf8maxSize);
if (utf8value != NULL) {
utf8FromPlatform(propertyValue, len, (jbyte *)utf8value, utf8maxSize);
valueString = JNI_FUNC_PTR(env, NewStringUTF)(env, utf8value);
jvmtiDeallocate(utf8value);

if (valueString != NULL) {
/* invoke Properties.setProperty */
JNI_FUNC_PTR(env,CallObjectMethod)
(env, gdata->agent_properties,
gdata->setProperty,
nameString, valueString);
}
}
}
if (JNI_FUNC_PTR(env,ExceptionOccurred)(env)) {

0 comments on commit cc9dee5

Please sign in to comment.
You can’t perform that action at this time.