From 1530a30f52266e56a013336f3f1bc6572b0f6337 Mon Sep 17 00:00:00 2001 From: Alexander Zvegintsev <alexander.zvegintsev@oracle.com> Date: Wed, 4 Sep 2013 14:32:13 +0400 Subject: [PATCH] 8021943: FileDialog getFile returns corrupted string after previous setFile Reviewed-by: anthony, serb --- jdk/src/windows/native/sun/windows/awt_FileDialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp index d60fbd329b1..276f3647e68 100644 --- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp +++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp @@ -372,7 +372,9 @@ AwtFileDialog::Show(void *p) // 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);