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

Exceptions related to empty configuration files #117

Closed
swltr opened this issue Oct 13, 2023 · 3 comments
Closed

Exceptions related to empty configuration files #117

swltr opened this issue Oct 13, 2023 · 3 comments
Assignees

Comments

@swltr
Copy link

swltr commented Oct 13, 2023

It seems there is an issue when an empty file is encountered. This is with 0.23.2:

[20231010-13:37:48-679] SEVERE  main                 o.o.kernel.RunKernel.main()                            : Error creating the configuration provider: 
org.github.gestalt.config.exceptions.GestaltConfigurationException: Failed to load configs from source: File source: C:\Repos\opentcs\openTCS-Kernel\build\install\openTCS-Kernel\.\config\opentcs-kernel.properties
 - level: ERROR, message: Empty or null token provided while building the config node
	at org.github.gestalt.config.GestaltCore.validateLoadResultsForErrors(GestaltCore.java:210)
	at org.github.gestalt.config.GestaltCore.loadConfigs(GestaltCore.java:126)
	at org.github.gestalt.config.GestaltCache.loadConfigs(GestaltCache.java:38)
	at org.opentcs.configuration.gestalt.GestaltConfigurationBindingProvider.<init>(GestaltConfigurationBindingProvider.java:74)
	at org.opentcs.kernel.RunKernel.configurationBindingProvider(RunKernel.java:127)
	at org.opentcs.kernel.RunKernel.customConfigurationModule(RunKernel.java:86)
	at org.opentcs.kernel.RunKernel.main(RunKernel.java:63)

and, when reloading:

[20231010-13:42:36-343] SEVERE  Timer-1              o.g.g.c.reload.TimedConfigReloadStrategy$1.run()       : Exception reloading source File source: C:\Repos\opentcs\openTCS-Kernel\build\install\openTCS-Kernel\.\config\opentcs-kernel.properties, exception org.github.gestalt.config.exceptions.GestaltException
org.github.gestalt.config.exceptions.GestaltException
	at org.github.gestalt.config.reload.ConfigReloadStrategy.reload(ConfigReloadStrategy.java:71)
	at org.github.gestalt.config.reload.TimedConfigReloadStrategy$1.run(TimedConfigReloadStrategy.java:38)
	at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
	at java.base/java.util.TimerThread.run(Timer.java:506)

In this case, the file opentcs-kernel.properties is empty. (It is supposed to only contain overrides for defaults set in other files.)

@credmond-git credmond-git self-assigned this Oct 13, 2023
@credmond-git
Copy link
Collaborator

Thanks i never considered an empty source file, i am sure i can add some special case handling of empty sources.

credmond-git added a commit that referenced this issue Oct 15, 2023
* feat: all loaders support empty configs. Will return an empty map. #117

* test: Integration tests for empty sources.
@credmond-git
Copy link
Collaborator

@swltr
Copy link
Author

swltr commented Oct 22, 2023

@credmond-git That seems to have fixed it, thank you! 👍

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

No branches or pull requests

2 participants