Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

NPE for included config with combined origins #13

Open
radist-nt opened this issue Mar 16, 2021 · 1 comment
Open

NPE for included config with combined origins #13

radist-nt opened this issue Mar 16, 2021 · 1 comment

Comments

@radist-nt
Copy link
Contributor

radist-nt commented Mar 16, 2021

  1. Append file includedConfig.conf with the following content to the src/test/resources:
include "./asyncAppender.conf"
test.logback {
}
  1. Modify file name in the first line of org.gnieh.logback.config.ConfigConfiguratorTest.testConfigureAsyncAppender() to includedConfig.conf
  2. Run tests.

Expected results: passing tests
Actual results:

java.lang.NullPointerException
	at ch.qos.logback.core.joran.spi.ConfigurationWatchList.convertToFile(ConfigurationWatchList.java:93)
	at ch.qos.logback.core.joran.spi.ConfigurationWatchList.addAsFileToWatch(ConfigurationWatchList.java:59)
	at ch.qos.logback.core.joran.spi.ConfigurationWatchList.addToWatchList(ConfigurationWatchList.java:67)
	at ch.qos.logback.core.joran.util.ConfigurationWatchListUtil.addToWatchList(ConfigurationWatchListUtil.java:68)
	at org.gnieh.logback.config.ConfigConfigurator.lambda$2(ConfigConfigurator.java:342)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)
	at org.gnieh.logback.config.ConfigConfigurator.registerFileWatchers(ConfigConfigurator.java:342)
	at org.gnieh.logback.config.ConfigConfigurator.configure(ConfigConfigurator.java:163)
	at org.gnieh.logback.config.ConfigConfiguratorTest.testConfigureAsyncAppender(ConfigConfiguratorTest.java:139)
...............

The problem is org.gnieh.logback.config.ConfigConfigurator.getSourceFiles(ConfigValue, Set<URL>). It's to naive to work as expected. The only valid way to gather files in current config library implementation is to provide the ConfigIncluder implementation to ConfigParseOptions.prependIncluder and pass the result to the one of ConfigFactory static methods.

radist-nt added a commit to radist-nt/logback-config that referenced this issue Mar 16, 2021
This commit only prevents NPE during logger configuration.
It does not fixes the files discovery problem mentioned in issue.
satabin added a commit that referenced this issue Mar 18, 2021
@radist-nt
Copy link
Contributor Author

radist-nt commented Apr 27, 2021

Do you plan to publish a minor release with pull request #14 ?

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

No branches or pull requests

1 participant