8244703: "platform encoding not initialized" exceptions with debugger, JNI
Reviewed-by: alanb, sspitsyn
This commit is contained in:
parent
23ce03d2ca
commit
f3c463b50a
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user