Problem
When MDClasses.findFiles() (or MDClasses.createSolution()) is called with a path that is the filesystem root (/) or contains protected directories (e.g. /sys/kernel/tracing/), it throws an unhandled AccessDeniedException wrapped in UncheckedIOException:
java.io.UncheckedIOException: java.nio.file.AccessDeniedException: /sys/kernel/tracing/osnoise
at com.github._1c_syntax.bsl.languageserver.context.ServerContext.computeConfigurationMetadata(ServerContext.java:435)
...
Root cause
Files.walk() propagates AccessDeniedException as an UncheckedIOException. The caller has no reasonable way to predict which paths will be inaccessible on a given OS/environment (e.g. Linux /sys, /proc, container-mounted filesystems).
Expected behavior
findFiles() / createSolution() should silently skip directories that cannot be accessed, similar to how find command behaves with -maxdepth or permission errors. This can be done by replacing Files.walk() with Files.walkFileTree() and returning FileVisitResult.CONTINUE from visitFileFailed() when the exception is an AccessDeniedException.
Suggested fix
Files.walkFileTree(root, new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) {
if (exc instanceof AccessDeniedException) {
return FileVisitResult.CONTINUE; // skip inaccessible paths
}
throw new UncheckedIOException(exc);
}
// ... visitFile as before
});
Reproducer
Call MDClasses.createSolution(Path.of("/"), settings) on Linux — it will eventually hit /sys/kernel/tracing/osnoise and throw.
Observed in BSL Language Server CI on Ubuntu runners: https://github.com/1c-syntax/bsl-language-server/actions/runs/25785327480/job/75737261066
Problem
When
MDClasses.findFiles()(orMDClasses.createSolution()) is called with a path that is the filesystem root (/) or contains protected directories (e.g./sys/kernel/tracing/), it throws an unhandledAccessDeniedExceptionwrapped inUncheckedIOException:Root cause
Files.walk()propagatesAccessDeniedExceptionas anUncheckedIOException. The caller has no reasonable way to predict which paths will be inaccessible on a given OS/environment (e.g. Linux/sys,/proc, container-mounted filesystems).Expected behavior
findFiles()/createSolution()should silently skip directories that cannot be accessed, similar to howfindcommand behaves with-maxdepthor permission errors. This can be done by replacingFiles.walk()withFiles.walkFileTree()and returningFileVisitResult.CONTINUEfromvisitFileFailed()when the exception is anAccessDeniedException.Suggested fix
Reproducer
Call
MDClasses.createSolution(Path.of("/"), settings)on Linux — it will eventually hit/sys/kernel/tracing/osnoiseand throw.Observed in BSL Language Server CI on Ubuntu runners: https://github.com/1c-syntax/bsl-language-server/actions/runs/25785327480/job/75737261066