<Swing Dev> [11][JDK-8196673] JFileChooser throws InvalidPathException when changing to directory with added space

Krishna Addepalli krishna.addepalli at oracle.com
Tue Feb 20 15:35:24 UTC 2018


 

I have added the necessary information to the bug. 

As for Sergey's question, the native file dialog also trims the strings before creating/selecting a file/folder.

 

So, now I'm not clear if we are going ahead with the fix or raise a new bug against nio, and wait for them to fix it?

Phil, Semyon could you suggest?

 

Thanks,

Krishna

From: Semyon Sadetsky 
Sent: Saturday, February 17, 2018 1:03 AM
To: Phil Race <philip.race at oracle.com>; Krishna Addepalli <krishna.addepalli at oracle.com>; swing-dev at openjdk.java.net
Subject: Re: <Swing Dev> [11][JDK-8196673] JFileChooser throws InvalidPathException when changing to directory with added space

 

On 02/16/2018 10:36 AM, Phil Race wrote:

Seems that was about 20 emails ago in another off-list thread about this bug.
It hasn't been posted to this list or added to the bug evaluation as far as I can see.
Add that and the links to the evaluation, not just here.

Since nio did already close 6578565 as not an issue I doubt it will be re-considered
despite the points Semyon raises about other use cases for nio.

At least we should try to file a new bug against NIO. They might be confused by Windows documentation because default meaning of "shell" on Linux is not the same as on Windows. 

--Semyon



So the closest to whatever 8 was doing is fine.
Sergey asked what the native FileDialog does and that is likely worth checking
and including in the bug evaluation .. which probably should be updated to
explain the problem better. It is the shell + UI that does not support it, not the
windows OS.

I find it irksome we have so many tests that directly use sun.awt.shell.ShellFolder
but that is another issue ..

-phil.

On 02/16/2018 10:18 AM, Krishna Addepalli wrote:

Hi Phil,

 

"Vagueness that it is an nio problem without pointing to why just makes me
have to investigate it myself to see why .. I'd prefer that the bug owner do that :-)"




I did provide a standalone program, that reproduces the exact exception reported in the bug. Just repeating it here again for reference:

 

import java.nio.file.Paths;

public class PathExceptionBug {

    public static void main(String args[]) throws Exception {

        Paths.get("C:\\testspace  ");

    }

}

 

When Sergey pointed out the bug(JDK-6578565), and suggested that NIO may close it, then we discussed about fixing it in our code, instead of assigning it to them.

 

Thanks,

Krishna

 

From: Phil Race 
Sent: Friday, February 16, 2018 10:38 PM
To: Krishna Addepalli HYPERLINK "mailto:krishna.addepalli at oracle.com"<krishna.addepalli at oracle.com>; Semyon Sadetsky HYPERLINK "mailto:semyon.sadetsky at oracle.com"<semyon.sadetsky at oracle.com>; HYPERLINK "mailto:swing-dev at openjdk.java.net"swing-dev at openjdk.java.net
Subject: Re: <Swing Dev> [11][JDK-8196673] JFileChooser throws InvalidPathException when changing to directory with added space

 

Right, what I said was that perhaps nio is behaving as specified in this case.
If a standalone nio program can be written that shows nio contravening its spec.
then a bug should be raised against nio. I did not verify what the case is there ..
I just suggested that should be investigated.

Vagueness that it is an nio problem without pointing to why just makes me
have to investigate it myself to see why .. I'd prefer that the bug owner do that :-)

But otherwise (no nio bug)  we'll have to deal with what nio specifies.
If we can fix it locally *and* file a bug against nio then that is also an issue.
Also nio may take a while to get to it ..

-phil

On 02/16/2018 08:56 AM, Krishna Addepalli wrote:

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 HYPERLINK "mailto:krishna.addepalli at oracle.com"<krishna.addepalli at oracle.com>; HYPERLINK "mailto:swing-dev at openjdk.java.net"swing-dev at 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

 

 

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180220/ad8c2477/attachment.html>


More information about the swing-dev mailing list