KengoTODA / spotbugs-cli

An experimental CLI for SpotBugs based on picocli
GNU Affero General Public License v3.0
1 stars 0 forks source link

native image cannot load the core plugin #44

Closed KengoTODA closed 3 years ago

KengoTODA commented 3 years ago
$ ./gradlew build nativeImage
$ build/executable/spotbugs build/libs/spotbugs-cli-1.0.0-SNAPSHOT.jar                                                                            git:graalvm*
Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315)
        at edu.umd.cs.findbugs.DetectorFactoryCollection.getCoreResource(DetectorFactoryCollection.java:353)
        at edu.umd.cs.findbugs.SystemProperties.loadPropertiesFromConfigFile(SystemProperties.java:84)
        at edu.umd.cs.findbugs.SystemProperties.<clinit>(SystemProperties.java:67)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
        at edu.umd.cs.findbugs.FindBugs2.<clinit>(FindBugs2.java:98)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
        at jp.skypencil.spotbugs.cli.App.call(App.kt:64)
        at jp.skypencil.spotbugs.cli.App.call(App.kt:23)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at jp.skypencil.spotbugs.cli.App$Companion.main(App.kt:122)
        at jp.skypencil.spotbugs.cli.App.main(App.kt)
Caused by: java.lang.IllegalArgumentException: Failed to parse uri: resource:
        at edu.umd.cs.findbugs.PluginLoader.<init>(PluginLoader.java:392)
        at edu.umd.cs.findbugs.PluginLoader.loadCorePlugin(PluginLoader.java:1442)
        at edu.umd.cs.findbugs.PluginLoader.loadInitialPlugins(PluginLoader.java:1396)
        at edu.umd.cs.findbugs.PluginLoader.<clinit>(PluginLoader.java:149)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
        ... 20 more
KengoTODA commented 3 years ago

memo: Accessing Resources in Native Images

KengoTODA commented 3 years ago

new URL("resource:").toURI() throws this exception, because of the error "Expected scheme-specific part". To avoid this error, we need to replace resource: with resource:. on the spotbugs side.