JDK 9 RFR of 8176237: (fs) java/nio/file/FileStore/Basic.java should conditionally check FileStores

Chris Hegarty chris.hegarty at oracle.com
Thu Mar 9 16:52:17 UTC 2017


Thanks Brian. +1

-Chris.

> On 9 Mar 2017, at 16:22, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> 
> On Mar 9, 2017, at 4:30 AM, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> 
>>> Looks okay but FileUtils.areFileSystemsAccessible() needs a comment so that future users of this test infrastructure have something to read.
>> 
>> Also, FileUtils already has a field, `isWindows`, that can be used
>> rather than re-reading the `os.name` system property.
> 
> OK I’ve made these two changes in
> 
> http://cr.openjdk.java.net/~bpb/8176237/webrev.01/
> 
> The difference with webrev.00 is included below.
> 
> Thanks,
> 
> Brian
> 
> --- a/test/lib/testlibrary/jdk/testlibrary/FileUtils.java
> +++ b/test/lib/testlibrary/jdk/testlibrary/FileUtils.java
> @@ -192,19 +192,27 @@
>          return excs;
>      }
>  
> +    /**
> +     * Checks whether all file systems are accessible. This is performed
> +     * by checking free disk space on all mounted file systems via a
> +     * separate, spawned process. File systems are considered to be
> +     * accessible if this process completes successfully before a given
> +     * fixed duration has elapsed.
> +     *
> +     * @implNote On Unix this executes the {@code df} command in a separate
> +     * process and on Windows always returns {@code true}.
> +     */
>      public static boolean areFileSystemsAccessible() throws IOException {
>          boolean areFileSystemsAccessible = true;
> -        if (!System.getProperty("os.name").equals("Windows")) {
> +        if (!isWindows) {
>              // try to check whether 'df' hangs
> -            System.out.println("\n--- Begin df output ---");
> +            System.out.println("\n--- df output ---");
>              System.out.flush();
>              Process proc = new ProcessBuilder("df").inheritIO().start();
>              try {
>                  proc.waitFor(90, TimeUnit.SECONDS);
>              } catch (InterruptedException ignored) {
>              }
> -            System.out.println("--- End df output ---\n");
> -            System.out.flush();



More information about the nio-dev mailing list