Skip to content

Commit e1eb14d

Browse files
committed
Add overrides and null pointer checks
1 parent 94eae7f commit e1eb14d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/core/FileOperations.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public static Set<Path> listFiles(Path dir, FileExtension extension) throws IOEx
9191
}
9292
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
9393
for (Path path : stream) {
94+
if (path == null || path.getFileName() == null) {
95+
continue; // Skip null paths
96+
}
9497
String fileName = path.getFileName().toString();
9598
if (!Files.isDirectory(path) && !FilePaths.IGNORED_FILES.contains(fileName)
9699
&& fileName.endsWith(extension.getExtension())) {
@@ -99,7 +102,7 @@ public static Set<Path> listFiles(Path dir, FileExtension extension) throws IOEx
99102
}
100103
return pathSet;
101104
} catch (IOException e) {
102-
System.out.println("Error accessing directory: " + dir);
105+
System.err.println("Error accessing directory: " + dir + " - " + e.getMessage());
103106
throw e;
104107
}
105108
}

src/main/java/core/JSONObject.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ public int hashCode() {
471471
*
472472
* @see JSONObject#toString()
473473
*/
474+
@Override
474475
public boolean equals(JSONObject other) {
475476
return this.toString().equals(other.toString());
476477
}

0 commit comments

Comments
 (0)