6741364: Some input method problems after the fix for 6585765
authorart
Tue, 26 Aug 2008 16:31:13 +0400
changeset 1955 e4f3afbad6e9
parent 1954 b93b85df3211
child 1956 c22d63290cb1
6741364: Some input method problems after the fix for 6585765 Summary: the fix for 6585765 is corrected Reviewed-by: uta
jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp
jdk/src/windows/native/sun/windows/awt_InputTextInfor.h
--- a/jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp	Tue Aug 26 13:09:34 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp	Tue Aug 26 16:31:13 2008 +0400
@@ -131,7 +131,7 @@
 
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
     if (m_cStrW > 0) {
-        m_jtext = MakeJavaString(env, m_lpStrW);
+        m_jtext = MakeJavaString(env, m_lpStrW, m_cStrW);
     }
 
     // Merge the string if necessary
@@ -182,12 +182,12 @@
 }
 
 
-jstring AwtInputTextInfor::MakeJavaString(JNIEnv* env, LPWSTR lpStrW) {
+jstring AwtInputTextInfor::MakeJavaString(JNIEnv* env, LPWSTR lpStrW, int cStrW) {
 
-    if (env == NULL || lpStrW == NULL) {
+    if (env == NULL || lpStrW == NULL || cStrW == 0) {
         return NULL;
     } else {
-        return JNU_NewStringPlatform(env, lpStrW);
+        return env->NewString(reinterpret_cast<jchar*>(lpStrW), cStrW);
     }
 }
 
@@ -246,14 +246,14 @@
                 }
 
                 ::LCMapString(lcJPN, LCMAP_FULLWIDTH, lpHWStrW, cHWStrW, lpFWStrW, cFWStrW);
-                readingClauseW[cls] = MakeJavaString(env, lpFWStrW);
+                readingClauseW[cls] = MakeJavaString(env, lpFWStrW, cFWStrW);
                 delete [] lpFWStrW;
             } else {
-                readingClauseW[cls] = MakeJavaString(env, lpHWStrW);
+                readingClauseW[cls] = MakeJavaString(env, lpHWStrW, cHWStrW);
             }
         }
         else {
-            readingClauseW[cls] = MakeJavaString(env, (LPWSTR)NULL);
+            readingClauseW[cls] = NULL;
         }
     }
 
--- a/jdk/src/windows/native/sun/windows/awt_InputTextInfor.h	Tue Aug 26 13:09:34 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_InputTextInfor.h	Tue Aug 26 16:31:13 2008 +0400
@@ -58,7 +58,7 @@
     ~AwtInputTextInfor();
  private:
     /* helper function to return a java string.*/
-    static jstring MakeJavaString(JNIEnv* env, LPWSTR lpStrW);
+    static jstring MakeJavaString(JNIEnv* env, LPWSTR lpStrW, int cStrW);
 
 
     LPARAM m_flags;            /* The message LPARAM. */