8021943: FileDialog getFile returns corrupted string after previous setFile
Reviewed-by: anthony, serb
Contributed-by: alexander.zvegintsev@oracle.com
--- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp Tue Sep 03 21:53:14 2013 +0400
+++ b/jdk/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);