-
Notifications
You must be signed in to change notification settings - Fork 2k
optimize: fix listfiles NPE #726
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,13 @@ public void runE2ETests() { | |
| File e2eDir = new File(this.e2eDir); | ||
| List<String> passedProjects = new ArrayList<>(); | ||
| File[] files = e2eDir.listFiles(); | ||
| if (files == null) { | ||
| LOGGER.error("Failed to list files in directory: " + this.e2eDir); | ||
| LOGGER.error("Please check if the directory exists and is accessible."); | ||
|
Comment on lines
+61
to
+62
|
||
| System.exit(1); | ||
| return; | ||
| } | ||
|
|
||
| // use this order to run saga test first, because saga test is easy to fail | ||
| List<File> filterFiles = Arrays.stream(files).sorted((a, b) -> { | ||
| int scoreA = caseOrder.getOrDefault(a.getName().charAt(0), 0); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The local variable
File e2eDir = new File(this.e2eDir);shadows thee2eDirfield name; with the added error handling it’s now easy to confusethis.e2eDir(String) vse2eDir(File). Renaming the local variable (e.g.,e2eDirFile) would make this block clearer.