Skip to content

Commit

Permalink
NPE when --module-source-path encounters an inaccessible directory
Browse files Browse the repository at this point in the history
null checks to account for I/O error

no test case as we can't easily trigger the I/O error during tests

Fixes eclipse-jdt#3658
  • Loading branch information
stephan-herrmann committed Feb 2, 2025
1 parent af8eae0 commit 8036b02
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2024 IBM Corporation.
* Copyright (c) 2016, 2025 IBM Corporation.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -70,8 +70,9 @@ protected static void scanForModules(String destinationPath, Parser parser, Map<
} else {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File f : files) {
scanForModules(destinationPath, parser, options, isModulepath, isModulepath, collector, f, release);
if (files != null) {
for (File f : files)
scanForModules(destinationPath, parser, options, isModulepath, isModulepath, collector, f, release);
}
}
}
Expand All @@ -90,7 +91,7 @@ public boolean accept(File dir, String name) {
return false;
}
});
if (list.length > 0) {
if (list != null && list.length > 0) { // null results from I/O errors (like missing permission)
String fileName = list[0];
switch (fileName) {
case IModule.MODULE_INFO_CLASS:
Expand Down

0 comments on commit 8036b02

Please sign in to comment.