Skip to content
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

FileSystemNotFoundException in detekt 1.7.0 when using --config-resource #2503

Closed
josephlbarnett opened this issue Mar 24, 2020 · 1 comment · Fixed by #2504
Closed

FileSystemNotFoundException in detekt 1.7.0 when using --config-resource #2503

josephlbarnett opened this issue Mar 24, 2020 · 1 comment · Fixed by #2504
Milestone

Comments

@josephlbarnett
Copy link
Contributor

josephlbarnett commented Mar 24, 2020

Expected Behavior

the config from a jar in the classpath should be used

Observed Behavior

java.nio.file.FileSystemNotFoundException
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:169)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:155)
	at java.base/java.nio.file.Path.of(Path.java:208)
	at java.base/java.nio.file.Paths.get(Paths.java:97)
	at io.gitlab.arturbosch.detekt.rules.documentation.LicenceHeaderLoaderExtension.init(LicenceHeaderLoaderExtension.kt:27)
	at io.gitlab.arturbosch.detekt.core.FileProcessorLocator.load(FileProcessorLocator.kt:18)
	at io.gitlab.arturbosch.detekt.core.DetektFacade$Companion.create(DetektFacade.kt:90)
	at io.gitlab.arturbosch.detekt.cli.runners.Runner.execute(Runner.kt:33)
	at io.gitlab.arturbosch.detekt.cli.Main.main(Main.kt:20)

Steps to Reproduce

  • include a detekt-config.yml in a jar that you put in the -classpath of the detekt cli
  • run java -classpath .... io.gitlab.arturbosch.detekt.cli.Main --input /path/to/src/main/kotlin --config-resource detekt-config.yml

Context

We include our detekt-config in a jar that we pull in via maven and run detekt via antrun plugin,b ut the above cli invokation shows the same issue. Works fine in 1.6.0 but not in 1.7.0.

Your Environment

josephlbarnett added a commit to josephlbarnett/detekt that referenced this issue Mar 24, 2020
When getting resources from the classpath, the ZipFileSystem
needs to be initialized manually.

Fixes detekt#2503
@josephlbarnett
Copy link
Contributor Author

josephlbarnett commented Mar 24, 2020

https://stackoverflow.com/questions/25032716/getting-filesystemnotfoundexception-from-zipfilesystemprovider-when-creating-a-p appears to show a solution to this, created a PR for a potential fix

josephlbarnett added a commit to josephlbarnett/detekt that referenced this issue Mar 24, 2020
When getting resources from the classpath, the ZipFileSystem
needs to be initialized manually.

Fixes detekt#2503
josephlbarnett added a commit to josephlbarnett/detekt that referenced this issue Mar 24, 2020
When getting resources from the classpath, the ZipFileSystem
needs to be initialized manually.

Fixes detekt#2503
josephlbarnett added a commit to josephlbarnett/detekt that referenced this issue Mar 24, 2020
When getting resources from the classpath, the ZipFileSystem
needs to be initialized manually.

Fixes detekt#2503
@arturbosch arturbosch added this to the 1.7.1 milestone Mar 24, 2020
josephlbarnett added a commit to josephlbarnett/detekt that referenced this issue Mar 24, 2020
When getting resources from the classpath, the ZipFileSystem
needs to be initialized manually.

Fixes detekt#2503
arturbosch pushed a commit that referenced this issue Mar 24, 2020
When getting resources from the classpath, the ZipFileSystem
needs to be initialized manually.

Fixes #2503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants