changeset 8097:ba711056009f

8021943: FileDialog getFile returns corrupted string after previous setFile Reviewed-by: anthony, serb Contributed-by: alexander.zvegintsev@oracle.com
author pchelko
date Wed, 04 Sep 2013 14:32:13 +0400
parents 2ad01ecbaf90
children ba041df8a554
files src/windows/native/sun/windows/awt_FileDialog.cpp
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/windows/awt_FileDialog.cpp	Tue Sep 03 21:53:14 2013 +0400
+++ b/src/windows/native/sun/windows/awt_FileDialog.cpp	Wed Sep 04 14:32:13 2013 +0400
@@ -372,7 +372,9 @@
 
         // Report result to peer.
         if (result) {
-            jint length = (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile);
+            jint length = multipleMode
+                    ? (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile)
+                    : (jint)_tcslen(ofn.lpstrFile);
             jcharArray jnames = env->NewCharArray(length);
             env->SetCharArrayRegion(jnames, 0, length, (jchar*)ofn.lpstrFile);