You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Should config.getValue("int.missing.key", OptionalInt.class) throw a NoSuchElementException according to this bit of spec? (where int.missing.key is not defined in a config source)
* if the property is not defined or is defined as an empty string or the converter returns {@code null}
If yes, It seems like this could be a relatively common mistake, which suggests to me it may be worth having a TCK for (If there isn't one already- I couldn't find one)
The text was updated successfully, but these errors were encountered:
Good observation! This was an oversight when adding OptionalInt, OptionalDouble, OptionalLong. Effectively, when the type is Optionalxxx, the getValue will return an Optionalxxx. If we throw NoSuchElementException, this defeats the purpose of Optionalxxx. With this, I suggest to update javadoc to not to throw this exception if the class type is Optionalxxx. What others think?
A related case that we may also want to clarify is when you call getOptionalValue("property", Optional*.class). Right now in SR Config, we just return a Optional<Optional*>, which I think it is ok. Some may expect this to be flattened.
Description
Should
config.getValue("int.missing.key", OptionalInt.class)
throw aNoSuchElementException
according to this bit of spec? (whereint.missing.key
is not defined in a config source)microprofile-config/api/src/main/java/org/eclipse/microprofile/config/Config.java
Lines 130 to 131 in 03c6f05
If yes, It seems like this could be a relatively common mistake, which suggests to me it may be worth having a TCK for (If there isn't one already- I couldn't find one)
The text was updated successfully, but these errors were encountered: