-
Bug
-
Resolution: Fixed
-
P3
-
1.4.2
-
b62
-
x86
-
windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2132134 | 5.0u7 | Praveen G | P3 | Resolved | Fixed | b01 |
Name: gm110360 Date: 08/13/2004
FULL PRODUCT VERSION :
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Home [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Using Wireless LAN 802.11b
A DESCRIPTION OF THE PROBLEM :
When selecting a network filename in Windows XP with Java 1.4.2 JFileChooser
may return wrong filepath.
For example:
public void chooserTest()
{ JFileChooser chooser = new JFileChooser();
chooser.showSaveDialog(this);
return chooser.getSelectedFile().getCanonicalPath();
}
returns "\\Hostname\shareddocs\test.log" (as expected)
if an existing file on a network folder is selected
and returns "C:\Documents and Settings\user\NetHood\SharedDocs on Description (Hostname)\test2.log"
if a non-existing file on a network folder is selected.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use for instance the Windows "Add network place wizard" to create a shortcut to a remote folder,
*but don't assign a drive letter*. So the remote folder becomes accessible by
something like \\RemotePC\SharedFolder. Add a file "test1.log" to this directory.
Now run the above Java program under Windows XP Home edition,
and in the open file dialog, first click on the "My Network Places" button
(preferred folders on the left toolbar), then in the main panel, doubleclick on the network
folder create above. Under filename enter the name of the existent file "test1.log" and click the Save button.
The resulting dialog box displays the string "path = \\RemotePC\SharedFolder\test1.log" (as I would expected).
Now repeat this, but enter the name of the non-existent file "test2.log".
The resulting dialog box now displays the string
"path = C:\Documents and Settings\user\NetHood\SharedFolder on ComputerDescription(RemotePC)\test2.log"
(which is not what I would expect).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The path
"C:\Documents and Settings\user\NetHood\SharedDocs on Description (Hostname)"
should be replaced by
\\Hostname\SharedDocs
ACTUAL -
A windows path with the user's special NetHood folder is returned, which cannot be used to open a file.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class MyApp
{ static public void main(String[] args)
{ try
{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFileChooser chooser = new JFileChooser();
chooser.showSaveDialog(null);
String resultPath = chooser.getSelectedFile().getCanonicalPath();
JOptionPane.showMessageDialog(null, "path = " + resultPath, "Network path test", JOptionPane.ERROR_MESSAGE);
} catch(Exception exc) {}
}
}
---------- END SOURCE ----------
(Incident Review ID: 227396)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Home [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Using Wireless LAN 802.11b
A DESCRIPTION OF THE PROBLEM :
When selecting a network filename in Windows XP with Java 1.4.2 JFileChooser
may return wrong filepath.
For example:
public void chooserTest()
{ JFileChooser chooser = new JFileChooser();
chooser.showSaveDialog(this);
return chooser.getSelectedFile().getCanonicalPath();
}
returns "\\Hostname\shareddocs\test.log" (as expected)
if an existing file on a network folder is selected
and returns "C:\Documents and Settings\user\NetHood\SharedDocs on Description (Hostname)\test2.log"
if a non-existing file on a network folder is selected.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use for instance the Windows "Add network place wizard" to create a shortcut to a remote folder,
*but don't assign a drive letter*. So the remote folder becomes accessible by
something like \\RemotePC\SharedFolder. Add a file "test1.log" to this directory.
Now run the above Java program under Windows XP Home edition,
and in the open file dialog, first click on the "My Network Places" button
(preferred folders on the left toolbar), then in the main panel, doubleclick on the network
folder create above. Under filename enter the name of the existent file "test1.log" and click the Save button.
The resulting dialog box displays the string "path = \\RemotePC\SharedFolder\test1.log" (as I would expected).
Now repeat this, but enter the name of the non-existent file "test2.log".
The resulting dialog box now displays the string
"path = C:\Documents and Settings\user\NetHood\SharedFolder on ComputerDescription(RemotePC)\test2.log"
(which is not what I would expect).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The path
"C:\Documents and Settings\user\NetHood\SharedDocs on Description (Hostname)"
should be replaced by
\\Hostname\SharedDocs
ACTUAL -
A windows path with the user's special NetHood folder is returned, which cannot be used to open a file.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class MyApp
{ static public void main(String[] args)
{ try
{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFileChooser chooser = new JFileChooser();
chooser.showSaveDialog(null);
String resultPath = chooser.getSelectedFile().getCanonicalPath();
JOptionPane.showMessageDialog(null, "path = " + resultPath, "Network path test", JOptionPane.ERROR_MESSAGE);
} catch(Exception exc) {}
}
}
---------- END SOURCE ----------
(Incident Review ID: 227396)
======================================================================
- backported by
-
JDK-2132134 JFileChooser.getSelectedFile() returns incorrect path on Windows network folder
- Resolved
- relates to
-
JDK-5102604 JFileChooser: Linked dir (directory-shortcut) failing (dir w/target.lnk inside)
- Resolved
-
JDK-6180936 REGRESSION: JFileChooser not resolves NetworkNeighbourhood Links in 1.5.0
- Resolved