1
1
/*
2
- * Copyright (c) 2009, 2019 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2009, 2022 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
29
29
import java .nio .file .FileVisitResult ;
30
30
import java .nio .file .Files ;
31
31
import java .nio .file .Path ;
32
- import java .nio .file .Paths ;
32
+ import java .nio .file .PathMatcher ;
33
33
import java .nio .file .ProviderMismatchException ;
34
34
import java .nio .file .SimpleFileVisitor ;
35
35
import java .nio .file .StandardCopyOption ;
42
42
import static java .nio .file .StandardWatchEventKinds .ENTRY_CREATE ;
43
43
/**
44
44
* @test
45
- * @bug 8038500 8040059 8150366 8150496 8147539
45
+ * @bug 8038500 8040059 8150366 8150496 8147539 8290047
46
46
* @summary Basic test for zip provider
47
47
*
48
48
* @modules jdk.zipfs
@@ -89,7 +89,7 @@ public static void main(String[] args) throws Exception {
89
89
// Test: copy file from zip file to current (scratch) directory
90
90
Path source = fs .getPath ("/META-INF/services/java.nio.file.spi.FileSystemProvider" );
91
91
if (Files .exists (source )) {
92
- Path target = Paths . get (source .getFileName ().toString ());
92
+ Path target = Path . of (source .getFileName ().toString ());
93
93
Files .copy (source , target , StandardCopyOption .REPLACE_EXISTING );
94
94
try {
95
95
long s1 = Files .readAttributes (source , BasicFileAttributes .class ).size ();
@@ -113,6 +113,19 @@ public static void main(String[] args) throws Exception {
113
113
throw new RuntimeException ("watch service is not supported" );
114
114
} catch (ProviderMismatchException x ) { }
115
115
116
+ // Test: IllegalArgumentException
117
+ try {
118
+ PathMatcher pm = fs .getPathMatcher (":glob" );
119
+ throw new RuntimeException ("IllegalArgumentException not thrown" );
120
+ } catch (IllegalArgumentException iae ) {
121
+ }
122
+ try {
123
+ PathMatcher pm = fs .getPathMatcher ("glob:" );
124
+ } catch (IllegalArgumentException iae ) {
125
+ iae .printStackTrace ();
126
+ throw new RuntimeException ("Unexpected IllegalArgumentException" );
127
+ }
128
+
116
129
// Test: ClosedFileSystemException
117
130
fs .close ();
118
131
if (fs .isOpen ())
0 commit comments