Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8343802: Prevent NULL usage backsliding #23466

Closed
11 changes: 5 additions & 6 deletions test/hotspot/jtreg/sources/TestNoNULL.java
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TestNoNULL {
@@ -90,11 +89,11 @@ private static void initializeExcludedPaths(Path rootDir) {
excludedTestFiles.add(rootDir.resolve(relativePath).normalize().toString()));
}

private static void processFiles(Path directory, Set<String> excludedFiles, Set<String> excludeExtensions) throws IOException {
private static void processFiles(Path directory, Set<String> excludedFiles, Set<String> excludedExtensions) throws IOException {
Files.walkFileTree(directory, new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (isIncluded(file, excludedFiles, excludeExtensions)) {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
if (isIncluded(file, excludedFiles, excludedExtensions)) {
checkForNull(file);
}
return FileVisitResult.CONTINUE;
@@ -107,14 +106,14 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
});
}

private static boolean isIncluded(Path file, Set<String> excludedFiles, Set<String> excludeExtensions) {
private static boolean isIncluded(Path file, Set<String> excludedFiles, Set<String> excludedExtensions) {
String filePath = file.normalize().toString();

if (excludedFiles.contains(filePath)) {
return false;
}

for (String ext : excludeExtensions) {
for (String ext : excludedExtensions) {
if (filePath.endsWith(ext)) {
return false;
}