JDK-4865948 : jdk1.5.0/sparc/demo/jfc/FileChooserDemo doesn't work as expected w/ Motif L&F
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,1.4.1_02,5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux,solaris_8,windows_xp
  • CPU: generic,x86
  • Submitted: 2003-05-19
  • Updated: 2003-12-19
  • Resolved: 2003-11-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2_04 04Fixed
Related Reports
Relates :  
Relates :  
Description

Name: mmR10223			Date: 05/19/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b06, JDK1.4.2-b23
Platform[s]    : all

The problem introduced by bugs 4834662, 4624353 was not fixed completely,
there is still a problem with "multi selection" which has not been fixed yet.

Test source location:
=====================
/net/linux-15/export/home/jdk1.5.0/sparc/demo/jfc/FileChooserDemo/FileChooserDemo.jar

How to reproduce:
=================
1. Run the following script (you may need to change its variables)

2. Set Look and Feel to Motif.
  Enable "Multi Selection" mode.
  Click the "Show File Chooser" button and select more then one files. Click "Open".
  The list of selected files must be shown, but the list has only one item.

--- script start ---
#!/bin/bash
JDK="/net/jdk/export/disk8/local.java/jdk1.5.0/sparc"
cd $JDK/demo/jfc/FileChooserDemo
$JDK/bin/java -jar FileChooserDemo.jar
--- script end ---


Specific machine info:
======================
Hostname: linux-1
OS: Solaris 2.8 (CDE, GNOME2)
Hostname: linux-19
OS: Linux Redhat 7.3
Hostname: linux-16
OS: Window XP Pro

=====================================================================
This is very important bug as this prevents further development on Unix environment ofr Nortel. Need to know plans for fixing this bug.
###@###.### 2003-09-25

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.2_04 tiger-beta FIXED IN: 1.4.2_04 tiger-beta INTEGRATED IN: 1.4.2_04 tiger-b28 tiger-beta VERIFIED IN: 1.4.2_04 tiger-beta
14-06-2004

SUGGESTED FIX ------- MotifFileChooserUI.java ------- *** /tmp/sccs.TDaiEG Tue Oct 21 17:56:28 2003 --- MotifFileChooserUI.java Tue Oct 21 17:54:13 2003 *************** *** 74,79 **** --- 74,109 ---- private String filterLabelText = null; private int filterLabelMnemonic = 0; + private String fileNameString(File file) { + if (file == null) { + return null; + } else { + JFileChooser fc = getFileChooser(); + if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) { + return file.getPath(); + } else { + return file.getName(); + } + } + } + + private String fileNameString(File[] files) { + StringBuffer buf = new StringBuffer(); + for (int i = 0; files != null && i < files.length; i++) { + if (i > 0) { + buf.append(" "); + } + if (files.length > 1) { + buf.append("\""); + } + buf.append(fileNameString(files[i])); + if (files.length > 1) { + buf.append("\""); + } + } + return buf.toString(); + } + public MotifFileChooserUI(JFileChooser filechooser) { super(filechooser); } *************** *** 117,122 **** --- 147,159 ---- if(f != null) { setFileName(getFileChooser().getName(f)); } + } + else if (prop.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) { + File[] files = (File[]) e.getNewValue(); + JFileChooser fc = getFileChooser(); + if (files != null && files.length > 0 && (files.length > 1 || fc.isDirectorySelectionEnabled() || !files[0].isDirectory())) { + setFileName(fileNameString(files)); + } } else if(prop.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) { directoryList.clearSelection(); fileList.clearSelection();
11-06-2004

EVALUATION 4624353 is assigned to swing. ###@###.### 2003-05-20 Brent - woudl you be ok looking at this? ###@###.### 2003-05-20 Sure. At first I though it could be a problem with JOptionPane, but it looks as if multiselect has been broken with the Motif L&F ever since 1.4. The test works w/ 1.3.1, and fails as described with 1.4.* and 1.5.0. The test always works w/ Metal L&F. ###@###.### 2003-05-20 This was fixed in a couple of 1.4.* update releases. I'm going to put the fix back into 1.5 as well. ###@###.### 2003-10-21
20-05-2003