changeset 6793:4c8b79d3200a

8021943: FileDialog getFile returns corrupted string after previous setFile Reviewed-by: anthony, serb Contributed-by: alexander.zvegintsev@oracle.com
author art
date Thu, 07 Nov 2013 15:36:23 +0400
parents ae26ea897101
children 06aa743f86e2
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 Nov 05 13:25:23 2013 -0800
+++ b/src/windows/native/sun/windows/awt_FileDialog.cpp	Thu Nov 07 15:36:23 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);