Hi Semyon,
Thanks for the suggestion. I have made changes accordingly, and here is the new webrev: http://cr.openjdk.java.net/~kaddepalli/8196673/webrev01 Krishna From: Semyon Sadetsky Sent: Thursday, February 22, 2018 5:34 AM To: Krishna Addepalli <krishna.addepa...@oracle.com>; Philip Race <philip.r...@oracle.com>; swing-dev@openjdk.java.net Subject: Re: <Swing Dev> [11][JDK-8196673] JFileChooser throws InvalidPathException when changing to directory with added space On 2/21/18 11:08 AM, Krishna Addepalli wrote: Hi Semyon, I can raise a bug, but Sergey suggested that nio is being used because of following fix: > in jdk9 nio api is used because of the fix for: > http://mail.openjdk.java.net/pipermail/jdk9-dev/2016-September/004953. > html > we should not break it. This is what I meant above. It should be fixed differently without usage of NIO. I think Files.exists() may be omitted when ShellFolder is queried by Windows shell API. The FNF exception could be thrown when null is returned. --Semyon @Sergey, could you post the correct link to the mail, since that link is not working? Hence, I have made the fix which simply trims the path on Windows, and doesnot alter the string on other platforms. Thanks, Krishna From: Semyon Sadetsky Sent: Tuesday, February 20, 2018 10:39 PM To: Krishna Addepalli HYPERLINK "mailto:krishna.addepa...@oracle.com"<krishna.addepa...@oracle.com>; Philip Race HYPERLINK "mailto:philip.r...@oracle.com"<philip.r...@oracle.com>; HYPERLINK "mailto:swing-dev@openjdk.java.net"swing-dev@openjdk.java.net Subject: Re: <Swing Dev> [11][JDK-8196673] JFileChooser throws InvalidPathException when changing to directory with added space On 02/20/2018 07:35 AM, Krishna Addepalli wrote: 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? I suggest to file the bug against NIO and try to re-fix the 7067885 in a different way without usage of NIO. --Semyon Thanks, Krishna From: Semyon Sadetsky Sent: Saturday, February 17, 2018 1:03 AM To: Phil Race HYPERLINK "mailto:philip.r...@oracle.com"<philip.r...@oracle.com>; Krishna Addepalli HYPERLINK "mailto:krishna.addepa...@oracle.com"<krishna.addepa...@oracle.com>; HYPERLINK "mailto:swing-dev@openjdk.java.net"swing-dev@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.addepa...@oracle.com"<krishna.addepa...@oracle.com>; Semyon Sadetsky HYPERLINK "mailto:semyon.sadet...@oracle.com"<semyon.sadet...@oracle.com>; HYPERLINK "mailto:swing-dev@openjdk.java.net"swing-dev@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.addepa...@oracle.com"<krishna.addepa...@oracle.com>; HYPERLINK "mailto:swing-dev@openjdk.java.net"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