United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4865948 : jdk1.5.0/sparc/demo/jfc/FileChooserDemo doesn't work as expected w/ Motif L&F

Details
Type:
Bug
Submit Date:
2003-05-19
Status:
Closed
Updated Date:
2003-12-19
Project Name:
JDK
Resolved Date:
2003-11-03
Component:
client-libs
OS:
solaris_8,linux,generic,windows_xp
Sub-Component:
javax.swing
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0,1.4.1_02,5.0
Fixed Versions:
1.4.2_04 (04)

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

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


                                     
2004-06-14
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();
                                     
2004-06-11
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
                                     
2003-05-20



Hardware and Software, Engineered to Work Together