citrusframework / yaks

YAKS is a platform to enable Cloud Native BDD testing on Kubernetes
Apache License 2.0
82 stars 27 forks source link

NullPointerException in YamlFileRepositoryLoader #494

Open Inithron opened 3 months ago

Inithron commented 3 months ago

If the yaks-config.yaml contains only one repository:

repositories:
  - id: "anyId"
    url: "https://path-to-the-repository"

Then the following exception is thrown:

14:12:02  + yaks run TollDeclaration.feature --settings yaks-config.yaml
14:12:02  Test 'toll-declaration' updated
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] Monitoring pod test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] [ERROR] Internal error: java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because the return value of "java.util.HashMap.get(Object)" is null -> [Help 1]
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because the return value of "java.util.HashMap.get(Object)" is null
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:109)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at java.lang.reflect.Method.invoke (Method.java:568)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] Caused by: java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because the return value of "java.util.HashMap.get(Object)" is null
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.citrusframework.yaks.maven.extension.configuration.yaml.YamlFileRepositoryLoader.load (YamlFileRepositoryLoader.java:68)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.citrusframework.yaks.maven.extension.configuration.FileBasedRepositoryLoader.load (FileBasedRepositoryLoader.java:68)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.citrusframework.yaks.maven.extension.ProjectModelReader.loadDynamicPluginRepositories (ProjectModelReader.java:94)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.citrusframework.yaks.maven.extension.ProjectModelReader.read (ProjectModelReader.java:59)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.model.building.DefaultModelProcessor.read (DefaultModelProcessor.java:99)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.model.building.DefaultModelBuilder.readModel (DefaultModelBuilder.java:552)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:257)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:243)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:447)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:410)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:367)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.graph.DefaultGraphBuilder.collectProjects (DefaultGraphBuilder.java:349)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor (DefaultGraphBuilder.java:340)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.graph.DefaultGraphBuilder.build (DefaultGraphBuilder.java:76)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.DefaultMaven.buildGraph (DefaultMaven.java:448)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:197)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at java.lang.reflect.Method.invoke (Method.java:568)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] [ERROR] 
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] [ERROR] 
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] [ERROR] For more information about the errors and possible solutions, please read the following articles:
14:12:05  [test-toll-declaration-cnpgbcjf9prc73bef9kg-scmd8 test-1] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException

But if an additional pluginRepository is added, the NullPointerException is no more thrown:

repositories:
  - id: "anyId"
    url: "https://path-to-the-repository"
pluginRepositories:
  - id: "anyId"
    url: "https://path-to-the-repository"

My question now: Is this a bug or is it mandatory to always define a repository and a plugin repository?

christophd commented 3 months ago

NPE is always bad. So I would consider this as a bug