-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b01
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8299176 | 11.0.19-oracle | Ramesh Gangadhar | P4 | Resolved | Fixed | b01 |
JDK-8299694 | 11.0.19 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
The tests in test/jdk/java/nio/file/DirectoryStream/Basic.java for validating the output from newDirectoryStream when specifying a glob value is not correct and should be changed to:
$ hg diff test/jdk/java/nio/file/DirectoryStream/Basic.java
diff -r 413c28945e0f test/jdk/java/nio/file/DirectoryStream/Basic.java
--- a/test/jdk/java/nio/file/DirectoryStream/Basic.java Wed Dec 05 19:17:22 2018 +0100
+++ b/test/jdk/java/nio/file/DirectoryStream/Basic.java Thu Dec 13 15:16:57 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -73,14 +73,18 @@
private PathMatcher matcher =
dir.getFileSystem().getPathMatcher("glob:f*");
public boolean accept(Path file) {
- return matcher.matches(file);
+ return matcher.matches(file.getFileName());
}
};
+
+ found = false;
try (DirectoryStream<Path> ds = newDirectoryStream(dir, filter)) {
for (Path entry: ds) {
- if (!entry.getFileName().equals(foo))
- throw new RuntimeException("entry not expected");
+ if (entry.getFileName().equals(foo))
+ found = true;
}
+ if (!found)
+ throw new RuntimeException(String.format("Error: entry: %s was not found", foo));
}
// check filtering: z* should not match any files
@@ -88,7 +92,7 @@
private PathMatcher matcher =
dir.getFileSystem().getPathMatcher("glob:z*");
public boolean accept(Path file) {
- return matcher.matches(file);
+ return matcher.matches(file.getFileName());
}
};
try (DirectoryStream<Path> ds = newDirectoryStream(dir, filter)) {
ljanders-mac:open ljanders
$ hg diff test/jdk/java/nio/file/DirectoryStream/Basic.java
diff -r 413c28945e0f test/jdk/java/nio/file/DirectoryStream/Basic.java
--- a/test/jdk/java/nio/file/DirectoryStream/Basic.java Wed Dec 05 19:17:22 2018 +0100
+++ b/test/jdk/java/nio/file/DirectoryStream/Basic.java Thu Dec 13 15:16:57 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -73,14 +73,18 @@
private PathMatcher matcher =
dir.getFileSystem().getPathMatcher("glob:f*");
public boolean accept(Path file) {
- return matcher.matches(file);
+ return matcher.matches(file.getFileName());
}
};
+
+ found = false;
try (DirectoryStream<Path> ds = newDirectoryStream(dir, filter)) {
for (Path entry: ds) {
- if (!entry.getFileName().equals(foo))
- throw new RuntimeException("entry not expected");
+ if (entry.getFileName().equals(foo))
+ found = true;
}
+ if (!found)
+ throw new RuntimeException(String.format("Error: entry: %s was not found", foo));
}
// check filtering: z* should not match any files
@@ -88,7 +92,7 @@
private PathMatcher matcher =
dir.getFileSystem().getPathMatcher("glob:z*");
public boolean accept(Path file) {
- return matcher.matches(file);
+ return matcher.matches(file.getFileName());
}
};
try (DirectoryStream<Path> ds = newDirectoryStream(dir, filter)) {
ljanders-mac:open ljanders
- backported by
-
JDK-8299176 test/jdk/java/nio/file/DirectoryStream/Basic.java not correct when using a glob
-
- Resolved
-
-
JDK-8299694 test/jdk/java/nio/file/DirectoryStream/Basic.java not correct when using a glob
-
- Resolved
-