-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Value-getter return default value if the actual value is explicitly set to 0 #206
Comments
The same seems to happen using the |
I tracked this issue down to be probably caused by this method returning Replacing: if (!Double.isFinite(test)) { // NaN, ±inf with something like: if (test == 0.0 || !Double.isFinite(test)) { // zero, NaN, ±inf should fix this :) If you want, i can create a pull-request with this fix, but you'll be probably faster if you do it yourself :) |
Might want to stick a check in there for |
When that issue is fixed, this commit can be reverted.
@amaranth |
I'm sorry it's taken a while to get to this issue, but it will be fixed in the release of |
Version
Description
Given:
A (hocon) configuration-file node has its value explicitly set to
0
.It got loaded using a
HoconConfigurationLoader
.The value is retrieved as a float using a getter with a default-fallback argument (e.g.
node.getFloat(1f)
)Then:
That getter returns the default/fallback-value. (e.g.
1f
)Expected result:
That getter returns the explicitly set value:
0f
Extra info:
This only happens with
float
values.This only happens if the node got loaded from a config-file.
I only tested the HOCON-loader.
Code Example
The console output of the above code:
The contents of the
testFile.conf
(after execution):The text was updated successfully, but these errors were encountered: