Hi Semyon, 

 

I had a discussion with Sergey,Phil regarding this. While there was a similar 
bug filed against Core-libs (https://bugs.openjdk.java.net/browse/JDK-6578565) 
, it was closed out as not an issue.

I have checked it on Java8, and it behaves correctly on Windows - it trims the 
paths and then creates/selects the folder. 

>From Java9 onwards, the InvalidPathException is thrown, since ShellFolder.java 
>file uses nio to get the path, and the nio throws the exception as reported in 
>the bug.

 

Phil suggested that, we should fix the bug at our level if we can, since nio 
may not consider this to be a problem at their level.

Hence this suggested fix.

 

Thanks,

Krishna

 

From: Semyon Sadetsky 
Sent: Friday, February 16, 2018 10:04 PM
To: Krishna Addepalli <krishna.addepa...@oracle.com>; swing-dev@openjdk.java.net
Subject: Re: <Swing Dev> [11][JDK-8196673] JFileChooser throws 
InvalidPathException when changing to directory with added space

 

According to Pardeep Sharma comment the bug is reproducible since 6u45. Do you 
confirm this or it is a regression introduced in 9?

>From the stack trace it doesn't look as a client-libs issue but a NIO issue.

--Semyon

On 02/16/2018 04:40 AM, Krishna Addepalli wrote:

Hi Sergey, Phil

 

Please review a fix for JDK-8196673: 
https://bugs.openjdk.java.net/browse/JDK-8196673

Webrev: HYPERLINK 
"http://cr.openjdk.java.net/%7Ekaddepalli/8196673/webrev00"http://cr.openjdk.java.net/~kaddepalli/8196673/webrev00

 

The problem is in Java9 and later, when a directory path that contains 
leading/trailing space is provided, it throws an InvalidPathException. As per 
Phil's recommendation, I have added a simple fix, which will trim the path for 
Windows, whereas for other platforms, it keeps it as it is.

 

Thanks,

Krishna

 

Reply via email to