Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehutch committed Apr 27, 2020
1 parent be05dcf commit 209a976
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ private void scanDirRecursively(final File dir, final LogNode log) {
return;
}

final LogNode subLog = log == null ? null
// Log dirs after files (addWhitelistedResources() precedes log entry with "0:")
: log.log("1:" + canonicalPath, "Scanning directory: " + dir
+ (dir.getPath().equals(canonicalPath) ? "" : " ; canonical path: " + canonicalPath));

final File[] filesInDir = dir.listFiles();
if (filesInDir == null) {
if (log != null) {
Expand All @@ -386,10 +391,6 @@ private void scanDirRecursively(final File dir, final LogNode log) {
return;
}
Arrays.sort(filesInDir);
final LogNode subLog = log == null ? null
// Log dirs after files (addWhitelistedResources() precedes log entry with "0:")
: log.log("1:" + canonicalPath, "Scanning directory: " + dir
+ (dir.getPath().equals(canonicalPath) ? "" : " ; canonical path: " + canonicalPath));

// Determine whether this is a modular jar running under JRE 9+
final boolean isModularJar = VersionFinder.JAVA_MAJOR_VERSION >= 9 && getModuleName() != null;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/github/classgraph/ClasspathElementPathDir.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,11 @@ private void scanPathRecursively(final Path path, final LogNode log) {
return;
}

final LogNode subLog = log == null ? null
// Log dirs after files (addWhitelistedResources() precedes log entry with "0:")
: log.log("1:" + canonicalPath, "Scanning Path: " + path
+ (path.equals(canonicalPath) ? "" : " ; canonical path: " + canonicalPath));

final List<Path> pathsInDir = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
for (final Path subPath : stream) {
Expand All @@ -405,11 +410,6 @@ private void scanPathRecursively(final Path path, final LogNode log) {
}
Collections.sort(pathsInDir);

final LogNode subLog = log == null ? null
// Log dirs after files (addWhitelistedResources() precedes log entry with "0:")
: log.log("1:" + canonicalPath, "Scanning Path: " + path
+ (path.equals(canonicalPath) ? "" : " ; canonical path: " + canonicalPath));

// Determine whether this is a modular jar running under JRE 9+
final boolean isModularJar = VersionFinder.JAVA_MAJOR_VERSION >= 9 && getModuleName() != null;

Expand Down

0 comments on commit 209a976

Please sign in to comment.