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

Improve error reporting of missing default config values #891

Closed
starksm64 opened this issue Feb 14, 2019 · 3 comments
Closed

Improve error reporting of missing default config values #891

starksm64 opened this issue Feb 14, 2019 · 3 comments
Assignees
Milestone

Comments

@starksm64
Copy link
Contributor

I'm working on the test extension and trying to flesh out all supported types, and during initial testing of a config group like the following:

@ConfigGroup()
public class AllValuesConfig {
    /** a long primitive */
    @ConfigItem
    long longPrimitive;
    /** a long value */
    @ConfigItem
    Long longValue;
    /** an optional long value */
    @ConfigItem
    OptionalLong optLongValue;
}

I'm seeing the following exception even before the configuration is loaded:

Caused by: java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Long.parseLong(Long.java:601)
	at java.lang.Long.valueOf(Long.java:803)
	at io.smallrye.config.Converters.lambda$static$c244dc85$1(Converters.java:61)
	at io.smallrye.config.SmallRyeConfig.convert(SmallRyeConfig.java:133)
	at org.jboss.shamrock.deployment.configuration.ObjectConfigType.getDefaultValueIntoEnclosingGroup(ObjectConfigType.java:30)
	at org.jboss.shamrock.deployment.configuration.GroupConfigType.create(GroupConfigType.java:126)
	at org.jboss.shamrock.deployment.configuration.GroupConfigType.getDefaultValueIntoEnclosingGroup(GroupConfigType.java:231)
	at org.jboss.shamrock.deployment.configuration.GroupConfigType.create(GroupConfigType.java:126)
	at org.jboss.shamrock.deployment.configuration.GroupConfigType.getOrCreate(GroupConfigType.java:180)
	at org.jboss.shamrock.deployment.configuration.ConfigDefinition.initialize(ConfigDefinition.java:127)
	at org.jboss.shamrock.deployment.configuration.ConfigDefinition.loadConfiguration(ConfigDefinition.java:283)
	at org.jboss.shamrock.deployment.steps.ConfigurationSetup.initializeConfiguration(ConfigurationSetup.java:155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.shamrock.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:383)
	at org.jboss.builder.BuildContext.run(BuildContext.java:402)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1998)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1525)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1416)
	at java.lang.Thread.run(Thread.java:748)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

This is happening on the longValue field. I would not think that a Long type would require a default, but if it does we should be reporting what field is the problem.

@gsmet
Copy link
Member

gsmet commented Nov 8, 2019

We need to check first if it's still an issue and see if we still have to improve the error message to include the field name.

@gsmet
Copy link
Member

gsmet commented Nov 8, 2019

@dmlloyd I don't know if it's still a problem. I will refrain from launching a new contributor on it as you probably have a ton of changes in your config patch.

@dmlloyd
Copy link
Member

dmlloyd commented Nov 11, 2019

This is fixed for run time configuration in the upcoming patch. It is not fixed for build time configuration which will still just produce an exception for the first problem found, but it may be fixable by a new contributor with some small amount of guidance once that patch is in.

@gsmet gsmet added this to the 1.1.0 milestone Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants