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

Config: Refactor usage of exceptions in optional sources #477

Closed
tomas-langer opened this issue Mar 7, 2019 · 1 comment
Closed

Config: Refactor usage of exceptions in optional sources #477

tomas-langer opened this issue Mar 7, 2019 · 1 comment
Assignees
Labels
bug Something isn't working config SE

Comments

@tomas-langer
Copy link
Member

When we start Helidon SE and have logging set to "FINE", config logs a number of exceptions that should not be thrown, related to optional config sources.
When a config source is optional, there should be no exception thrown, instead we should gracefully ignore it.

Reasons:

  1. Log is polluted with useless information
  2. Debugging using Exception breakpoints is more complicated, as it stops on "false" positives

Environment Details

  • Helidon Version: 1.0.0
  • Helidon SE

Log output:

Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource loadDataChangedSinceLastLoad
FINE: Source ClasspathConfig[meta-config.yaml]? has changed to Optional[1970-01-01T00:00:00Z] from Optional.empty.
Mar 06, 2019 7:22:19 PM io.helidon.config.internal.ClasspathConfigSource content
FINE: Error to get ClasspathConfig[meta-config.yaml]? using java.lang.ClassLoader@1043d64e8 CONTEXT ClassLoader.
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
CONFIG: Cannot load data from optional source ClasspathConfig[meta-config.yaml]?. Will not be used to load from. ClasspathConfig[meta-config.yaml]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
FINE: Load of 'ClasspathConfig[meta-config.yaml]?' source failed with an exception.
io.helidon.config.ConfigException: ClasspathConfig[meta-config.yaml]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
        at io.helidon.config.internal.ClasspathConfigSource.content(ClasspathConfigSource.java:115)
        at io.helidon.config.spi.AbstractParsableConfigSource.loadData(AbstractParsableConfigSource.java:58)
        at io.helidon.config.RetryPolicies$JustCallRetryPolicyHolder$1.execute(RetryPolicies.java:77)
        at io.helidon.config.spi.AbstractSource.loadDataChangedSinceLastLoad(AbstractSource.java:197)
        at io.helidon.config.spi.AbstractSource.load(AbstractSource.java:177)
        at io.helidon.config.UseFirstAvailableConfigSource.load(UseFirstAvailableConfigSource.java:58)
        at io.helidon.config.ProviderImpl.newConfig(ProviderImpl.java:103)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.ConfigSources.load(ConfigSources.java:345)
        at io.helidon.config.BuilderImpl.defaultConfigSource(BuilderImpl.java:348)
        at io.helidon.config.BuilderImpl.targetConfigSource(BuilderImpl.java:309)
        at io.helidon.config.BuilderImpl.buildProvider(BuilderImpl.java:278)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.Config.create(Config.java:358)
        at io.helidon.examples.graalvm.GraalVMNativeImageMain.main(GraalVMNativeImageMain.java:76)

Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource loadDataChangedSinceLastLoad
FINE: Source ClasspathConfig[meta-config.conf]? has changed to Optional[1970-01-01T00:00:00Z] from Optional.empty.
Mar 06, 2019 7:22:19 PM io.helidon.config.internal.ClasspathConfigSource content
FINE: Error to get ClasspathConfig[meta-config.conf]? using java.lang.ClassLoader@1043d64e8 CONTEXT ClassLoader.
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
CONFIG: Cannot load data from optional source ClasspathConfig[meta-config.conf]?. Will not be used to load from. ClasspathConfig[meta-config.conf]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
FINE: Load of 'ClasspathConfig[meta-config.conf]?' source failed with an exception.
io.helidon.config.ConfigException: ClasspathConfig[meta-config.conf]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
        at io.helidon.config.internal.ClasspathConfigSource.content(ClasspathConfigSource.java:115)
        at io.helidon.config.spi.AbstractParsableConfigSource.loadData(AbstractParsableConfigSource.java:58)
        at io.helidon.config.RetryPolicies$JustCallRetryPolicyHolder$1.execute(RetryPolicies.java:77)
        at io.helidon.config.spi.AbstractSource.loadDataChangedSinceLastLoad(AbstractSource.java:197)
        at io.helidon.config.spi.AbstractSource.load(AbstractSource.java:177)
        at io.helidon.config.UseFirstAvailableConfigSource.load(UseFirstAvailableConfigSource.java:58)
        at io.helidon.config.ProviderImpl.newConfig(ProviderImpl.java:103)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.ConfigSources.load(ConfigSources.java:345)
        at io.helidon.config.BuilderImpl.defaultConfigSource(BuilderImpl.java:348)
        at io.helidon.config.BuilderImpl.targetConfigSource(BuilderImpl.java:309)
        at io.helidon.config.BuilderImpl.buildProvider(BuilderImpl.java:278)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.Config.create(Config.java:358)
        at io.helidon.examples.graalvm.GraalVMNativeImageMain.main(GraalVMNativeImageMain.java:76)

Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource loadDataChangedSinceLastLoad
FINE: Source ClasspathConfig[meta-config.json]? has changed to Optional[1970-01-01T00:00:00Z] from Optional.empty.
Mar 06, 2019 7:22:19 PM io.helidon.config.internal.ClasspathConfigSource content
FINE: Error to get ClasspathConfig[meta-config.json]? using java.lang.ClassLoader@1043d64e8 CONTEXT ClassLoader.
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
CONFIG: Cannot load data from optional source ClasspathConfig[meta-config.json]?. Will not be used to load from. ClasspathConfig[meta-config.json]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
FINE: Load of 'ClasspathConfig[meta-config.json]?' source failed with an exception.
io.helidon.config.ConfigException: ClasspathConfig[meta-config.json]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
        at io.helidon.config.internal.ClasspathConfigSource.content(ClasspathConfigSource.java:115)
        at io.helidon.config.spi.AbstractParsableConfigSource.loadData(AbstractParsableConfigSource.java:58)
        at io.helidon.config.RetryPolicies$JustCallRetryPolicyHolder$1.execute(RetryPolicies.java:77)
        at io.helidon.config.spi.AbstractSource.loadDataChangedSinceLastLoad(AbstractSource.java:197)
        at io.helidon.config.spi.AbstractSource.load(AbstractSource.java:177)
        at io.helidon.config.UseFirstAvailableConfigSource.load(UseFirstAvailableConfigSource.java:58)
        at io.helidon.config.ProviderImpl.newConfig(ProviderImpl.java:103)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.ConfigSources.load(ConfigSources.java:345)
        at io.helidon.config.BuilderImpl.defaultConfigSource(BuilderImpl.java:348)
        at io.helidon.config.BuilderImpl.targetConfigSource(BuilderImpl.java:309)
        at io.helidon.config.BuilderImpl.buildProvider(BuilderImpl.java:278)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.Config.create(Config.java:358)
        at io.helidon.examples.graalvm.GraalVMNativeImageMain.main(GraalVMNativeImageMain.java:76)

Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource loadDataChangedSinceLastLoad
FINE: Source ClasspathConfig[meta-config.properties]? has changed to Optional[1970-01-01T00:00:00Z] from Optional.empty.
Mar 06, 2019 7:22:19 PM io.helidon.config.internal.ClasspathConfigSource content
FINE: Error to get ClasspathConfig[meta-config.properties]? using java.lang.ClassLoader@1043d64e8 CONTEXT ClassLoader.
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
CONFIG: Cannot load data from optional source ClasspathConfig[meta-config.properties]?. Will not be used to load from. ClasspathConfig[meta-config.properties]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
Mar 06, 2019 7:22:19 PM io.helidon.config.spi.AbstractSource processMissingData
FINE: Load of 'ClasspathConfig[meta-config.properties]?' source failed with an exception.
io.helidon.config.ConfigException: ClasspathConfig[meta-config.properties]? does not exist. Used ClassLoader: java.lang.ClassLoader@1043d64e8
        at io.helidon.config.internal.ClasspathConfigSource.content(ClasspathConfigSource.java:115)
        at io.helidon.config.spi.AbstractParsableConfigSource.loadData(AbstractParsableConfigSource.java:58)
        at io.helidon.config.RetryPolicies$JustCallRetryPolicyHolder$1.execute(RetryPolicies.java:77)
        at io.helidon.config.spi.AbstractSource.loadDataChangedSinceLastLoad(AbstractSource.java:197)
        at io.helidon.config.spi.AbstractSource.load(AbstractSource.java:177)
        at io.helidon.config.UseFirstAvailableConfigSource.load(UseFirstAvailableConfigSource.java:58)
        at io.helidon.config.ProviderImpl.newConfig(ProviderImpl.java:103)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.ConfigSources.load(ConfigSources.java:345)
        at io.helidon.config.BuilderImpl.defaultConfigSource(BuilderImpl.java:348)
        at io.helidon.config.BuilderImpl.targetConfigSource(BuilderImpl.java:309)
        at io.helidon.config.BuilderImpl.buildProvider(BuilderImpl.java:278)
        at io.helidon.config.BuilderImpl.build(BuilderImpl.java:245)
        at io.helidon.config.Config.create(Config.java:358)
        at io.helidon.examples.graalvm.GraalVMNativeImageMain.main(GraalVMNativeImageMain.java:76)

@tomas-langer tomas-langer added the bug Something isn't working label Mar 7, 2019
@tomas-langer
Copy link
Member Author

related to #294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working config SE
Projects
Archived in project
Development

No branches or pull requests

3 participants