<Swing Dev> [9] Review request for 8041694: JFileChooser removes trailing spaces in the selected directory name
Anton Litvinov
anton.litvinov at oracle.com
Wed May 11 14:49:44 UTC 2016
Hi Semyon,
Thank you for this information. Current version of the regression test
using the shell script is tested, cross platform and does not contain
any code specific to Windows platform. This shell script is a copy of
many other stable regression tests existing in "jdk9/jdk/test" directory
and is different from them only in its commented test header (jtreg
options like: @summary, @author) and 7 code lines between
"############### YOUR TEST CODE HERE!!!!!!! #############" and
"############### END YOUR TEST CODE !!!!! ############".
What is so bad in usage of the well established approach based on shell
script?
Thank you,
Anton
On 5/11/2016 5:29 PM, Semyon Sadetsky wrote:
> Hi Anton,
>
> In windows you may use "\\?\" prefix with absolute path of a new folder.
> For example:
> new File("\\\\?\\C:\\tmp\\test2 ").mkdir();
>
> --Semyon
>
> On 5/11/2016 4:47 PM, Anton Litvinov wrote:
>> Hello Sergey,
>>
>> Thank you for review of this fix. No, unfortunately, on MS Windows
>> OS, if the method "java.io.File.mkdir()" is called on "java.io.File"
>> instance which contains trailing space characters in the directory
>> name, the corresponding directory is created but without trailing
>> space characters in its name in file system.
>>
>> The method "java.nio.file.Files.createDirectory(Path dir,
>> FileAttribute<?>... attrs)" cannot be used for this purpose also,
>> because "java.nio.file.Path" cannot be constructed for the directory
>> name ending with spaces and "java.io.File.toPath()" throws the
>> exception "java.nio.file.InvalidPathException: Trailing char < > at
>> index N: <DIRECTORY_PATH>".
>>
>> It is possible to create a directory with such a name from the shell
>> script on MS Windows OS, therefore I decided to use the shell script
>> for this regression test.
>>
>> Thank you,
>> Anton
>>
>> On 5/11/2016 4:16 PM, Sergey Bylokhov wrote:
>>> Hi, Anton.
>>> Probably the test can create the folder w/o the shell script?
>>>
>>> On 11.05.16 15:14, Anton Litvinov wrote:
>>>> The bug consists in the fact that the method
>>>> "JFileChooser.getSelectedFile()" returns "java.io.File" object which
>>>> does not contain trailing spaces in the directory name, in spite of
>>>> the
>>>> fact that the corresponding directory in the file system has trailing
>>>> spaces in its name. The fix deletes the code in the method
>>>> "javax.swing.plaf.basic.BasicFileChooserUI.ApproveSelectionAction.actionPerformed"
>>>>
>>>> which deliberately modifies the selected directory string name by
>>>> removing trailing spaces from it.
>>>>
>>>> All automatic regression tests from open and closed sets located in
>>>> "javax/swing/JFileChooser" directories were run on MS Windows 7 OS
>>>> during verification of the fix.
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20160511/79ec1b3b/attachment.html>
More information about the swing-dev
mailing list