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

NullPointerException in YamlFileRepositoryLoader #494

Open
Inithron opened this issue Mar 14, 2024 · 1 comment
Open

NullPointerException in YamlFileRepositoryLoader #494

Inithron opened this issue Mar 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Inithron
Copy link

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
Copy link
Member

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

@christophd christophd added the bug Something isn't working label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants