<Swing Dev> RFR: PIT Bug 8167988 : java.nio.file.InvalidPathException if click button in JFileChooser demo of SwingSet2

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Tue Oct 25 09:21:14 UTC 2016


Could you review the updated fix:
   http://cr.openjdk.java.net/~alexsch/8167988/webrev.00

   - Path creation is moved under instanceof ShellFolder check
   - Paths.get(file.getPath()) is changed to file.toPath()

   Thanks,
   Alexandr.

On 10/25/2016 9:36 AM, Semyon Sadetsky wrote:
>
> It seems the fix should be:
>
> ===================================================================
> --- src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
> +++ src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
> @@ -244,10 +244,10 @@
>        * @exception FileNotFoundException if file does not exist
>        */
>       public static ShellFolder getShellFolder(File file) throws FileNotFoundException {
> -        Path path = Paths.get(file.getPath());
>           if (file instanceof ShellFolder) {
>               return (ShellFolder)file;
>           }
> +        Path path = Paths.get(file.getPath());
>           if (!Files.exists(path, LinkOption.NOFOLLOW_LINKS)) {
>               throw new FileNotFoundException();
>           }
> ===================================================================
>
> --Semyon
> On 10/25/2016 1:26 AM, Phil Race wrote:
>> SQE reports some 35 tests fail as a result of this bug.
>> I am backing out the change that caused it from our PIT and need a 
>> reviewer.
>> SQE will verify this before I push.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8167988
>>
>> Fix :
>>
>> hg diff src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
>> diff --git 
>> a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java 
>> b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
>> --- a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
>> +++ b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
>> @@ -30,10 +30,6 @@
>>  import java.awt.Toolkit;
>>  import java.io.*;
>>  import java.io.FileNotFoundException;
>> -import java.nio.file.Files;
>> -import java.nio.file.LinkOption;
>> -import java.nio.file.Path;
>> -import java.nio.file.Paths;
>>  import java.util.*;
>>  import java.util.concurrent.Callable;
>>
>> @@ -244,11 +240,10 @@
>>       * @exception FileNotFoundException if file does not exist
>>       */
>>      public static ShellFolder getShellFolder(File file) throws 
>> FileNotFoundException {
>> -        Path path = Paths.get(file.getPath());
>>          if (file instanceof ShellFolder) {
>>              return (ShellFolder)file;
>>          }
>> -        if (!Files.exists(path, LinkOption.NOFOLLOW_LINKS)) {
>> +        if (!file.exists()) {
>>              throw new FileNotFoundException();
>>          }
>>          return shellFolderManager.createShellFolder(file);
>>
>

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


More information about the swing-dev mailing list