From 6ca4484ed9a92ab1f5578dc7f0fa676069effb23 Mon Sep 17 00:00:00 2001 From: Luke Hutchison Date: Thu, 9 Sep 2021 02:55:42 -0600 Subject: [PATCH] Ignore JrtFileSystem (#553) --- src/main/java/io/github/classgraph/Scanner.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/io/github/classgraph/Scanner.java b/src/main/java/io/github/classgraph/Scanner.java index ec60ffd22..bdc74ab75 100644 --- a/src/main/java/io/github/classgraph/Scanner.java +++ b/src/main/java/io/github/classgraph/Scanner.java @@ -482,6 +482,13 @@ public ClasspathElement newInstance(final ClasspathElementAndClassLoader classpa return new ClasspathElementZip(classpathEntryPath, classpathEntry.classLoader, nestedJarHandler, scanSpec); } else if (FileUtils.canReadAndIsDir(packageRootPath)) { + if ("JrtFileSystem" + .equals(packageRootPath.getFileSystem().getClass().getSimpleName())) { + // Ignore JrtFileSystem (#553) -- paths are of form: + // /modules/java.base/module-info.class + throw new IOException("Ignoring JrtFS filesystem path " + packageRootPath + + " (modules are scanned using the JPMS API)"); + } // classpathEntryObj is a Path which points to a dir -- need to scan it recursively return new ClasspathElementPathDir(classpathEntryPath, dirOrPathPackageRoot, classpathEntry.classLoader, nestedJarHandler, scanSpec);