jdk/test/java/nio/file/FileSystem/Basic.java
author bpb
Tue, 07 Feb 2017 11:01:04 -0800
changeset 43687 d4ec7c5646b6
parent 34543 7c2e29c8d285
child 44121 3ed4e4e86d3f
permissions -rw-r--r--
8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores Summary: On Unix platforms, spawn a 'df' process and skip FileStore check if it hangs Reviewed-by: alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     1
/*
43687
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
     2
 * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     4
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     8
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    13
 * accompanied this code).
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    14
 *
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3065
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3065
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3065
diff changeset
    21
 * questions.
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    22
 */
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    23
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    24
/* @test
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    25
 * @bug 4313887 6838333 8132497
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    26
 * @summary Unit test for java.nio.file.FileSystem
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    27
 * @library .. /lib/testlibrary
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    28
 * @build jdk.testlibrary.FileUtils
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    29
 * @run main/othervm Basic
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    30
 */
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    31
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    32
import java.io.File;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    33
import java.io.IOException;
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    34
import java.net.URI;
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    35
import java.net.URISyntaxException;
43687
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    36
import java.nio.file.Files;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    37
import java.nio.file.FileStore;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    38
import java.nio.file.FileSystem;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    39
import java.nio.file.FileSystems;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    40
import java.nio.file.Path;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    41
import java.nio.file.Paths;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    42
import java.nio.file.ProviderNotFoundException;
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    43
import java.util.HashMap;
43687
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    44
import java.util.concurrent.TimeUnit;
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    45
import jdk.testlibrary.FileUtils;
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    46
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    47
/**
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
    48
 * Simple sanity checks for java.nio.file.FileSystem
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    49
 */
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    50
public class Basic {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    51
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    52
    static void check(boolean okay, String msg) {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    53
        if (!okay)
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    54
            throw new RuntimeException(msg);
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    55
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    56
43687
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    57
    static void checkFileStores(String os, FileSystem fs) throws IOException {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    58
        boolean checkFileStores = true;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    59
        if (!os.equals("Windows")) {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    60
            // try to check whether 'df' hangs
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    61
            System.out.println("\n--- Begin df output ---");
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    62
            System.out.flush();
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    63
            Process proc = new ProcessBuilder("df").inheritIO().start();
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    64
            try {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    65
                proc.waitFor(90, TimeUnit.SECONDS);
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    66
            } catch (InterruptedException ignored) {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    67
            }
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    68
            System.out.println("--- End df output ---\n");
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    69
            System.out.flush();
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    70
            try {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    71
                int exitValue = proc.exitValue();
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    72
                if (exitValue != 0) {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    73
                    System.err.printf("df process exited with %d != 0%n",
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    74
                        exitValue);
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    75
                    checkFileStores = false;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    76
                }
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    77
            } catch (IllegalThreadStateException ignored) {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    78
                System.err.println("df command apparently hung");
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    79
                checkFileStores = false;
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    80
            }
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    81
        }
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    82
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    83
        // sanity check method
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    84
        if (checkFileStores) {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    85
            System.out.println("\n--- Begin FileStores ---");
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    86
            for (FileStore store: fs.getFileStores()) {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    87
                System.out.println(store);
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    88
            }
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    89
            System.out.println("--- EndFileStores ---\n");
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    90
        } else {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    91
            System.err.println("Skipping FileStore check due to df failure");
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    92
        }
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    93
    }
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
    94
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    95
    static void checkSupported(FileSystem fs, String... views) {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    96
        for (String view: views) {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    97
            check(fs.supportedFileAttributeViews().contains(view),
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    98
                "support for '" + view + "' expected");
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
    99
        }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   100
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   101
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   102
    static void checkNoUOE() throws IOException, URISyntaxException {
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   103
        String dir = System.getProperty("test.dir", ".");
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   104
        String fileName = dir + File.separator + "foo.bar";
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   105
        Path path = Paths.get(fileName);
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   106
        Path file = Files.createFile(path);
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   107
        try {
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   108
            URI uri = new URI("jar", file.toUri().toString(), null);
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   109
            System.out.println(uri);
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   110
            FileSystem fs = FileSystems.newFileSystem(uri, new HashMap());
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   111
            fs.close();
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   112
        } catch (ProviderNotFoundException pnfe) {
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   113
            System.out.println("Expected ProviderNotFoundException caught: "
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   114
                + "\"" + pnfe.getMessage() + "\"");
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   115
        }
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   116
    }
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   117
43687
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
   118
    public static void main(String[] args)
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
   119
        throws IOException, URISyntaxException {
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
   120
        String os = System.getProperty("os.name");
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   121
        FileSystem fs = FileSystems.getDefault();
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   122
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   123
        // close should throw UOE
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   124
        try {
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   125
            fs.close();
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   126
            throw new RuntimeException("UnsupportedOperationException expected");
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   127
        } catch (UnsupportedOperationException e) { }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   128
        check(fs.isOpen(), "should be open");
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   129
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   130
        check(!fs.isReadOnly(), "should provide read-write access");
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   131
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   132
        check(fs.provider().getScheme().equals("file"),
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   133
            "should use 'file' scheme");
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   134
43687
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
   135
        // sanity check FileStores
d4ec7c5646b6 8173910: (fs) java/nio/file/FileSystem/Basic.java should conditionally check FileStores
bpb
parents: 34543
diff changeset
   136
        checkFileStores(os, fs);
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   137
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   138
        // sanity check supportedFileAttributeViews
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   139
        checkSupported(fs, "basic");
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   140
        if (os.equals("SunOS"))
3065
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2057
diff changeset
   141
            checkSupported(fs, "posix", "unix", "owner", "acl", "user");
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   142
        if (os.equals("Linux"))
3065
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2057
diff changeset
   143
            checkSupported(fs, "posix", "unix", "owner", "dos", "user");
12538
211d6e82fe51 7130404: [macosx] "os.arch" value should be "x86_64" for compatibility with Apple JDK6
jmelvin
parents: 12047
diff changeset
   144
        if (os.contains("OS X"))
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
   145
            checkSupported(fs, "posix", "unix", "owner");
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   146
        if (os.equals("Windows"))
3065
452aaa2899fc 6838333: New I/O: Update file system API to jsr203/nio2-b101
alanb
parents: 2057
diff changeset
   147
            checkSupported(fs, "owner", "dos", "acl", "user");
32097
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   148
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   149
        // sanity check non-throwing of UnsupportedOperationException by
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   150
        // FileSystems.newFileSystem(URI, ..)
5f00777700b0 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
bpb
parents: 12538
diff changeset
   151
        checkNoUOE();
2057
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   152
    }
3acf8e5e2ca0 6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff changeset
   153
}