--- old/test/jdk/java/nio/file/FileSystem/Basic.java 2020-04-07 13:49:56.000000000 -0700 +++ new/test/jdk/java/nio/file/FileSystem/Basic.java 2020-04-07 13:49:55.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 6838333 8132497 + * @bug 4313887 6838333 8132497 8242292 * @summary Unit test for java.nio.file.FileSystem * @library .. /test/lib * @build jdk.test.lib.Platform @@ -91,6 +91,23 @@ } } + static void checkIAE() throws IOException, URISyntaxException { + String dir = System.getProperty("test.dir", "."); + String fileName = dir + File.separator + "foo.bar"; + Path path = Path.of(dir, fileName); + URI uri = new URI(path.toString()); + System.out.println(uri); + try { + FileSystem fs = FileSystems.getFileSystem(uri); + throw new RuntimeException("IllegalArgumentException expected"); + } catch (IllegalArgumentException iae) { + System.out.println("Expected IllegalArgumentException caught: " + + "\"" + iae.getMessage() + "\""); + } catch (Exception e) { + throw new RuntimeException("IllegalArgumentException expected", e); + } + } + public static void main(String[] args) throws IOException, URISyntaxException { String os = System.getProperty("os.name"); @@ -122,6 +139,10 @@ if (os.equals("Windows")) checkSupported(fs, "owner", "dos", "acl", "user"); + // sanity check throwing of IllegalArgumentException by + // FileSystems.getFileSystem(URI) if the URI scheme is null + checkIAE(); + // sanity check non-throwing of UnsupportedOperationException by // FileSystems.newFileSystem(URI, ..) checkNoUOE();