-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Maps with null values cause an unclear exception #184
Comments
Of course, another option (rather than throwing an |
Hi @StFS
I'll look in your change and I'll make sure that next release will just ignore the Thank you. |
Fix for #184 - have ConfigFactory throw exeption on illegal import maps
I released today, I think that some documentation for this feature may help users. 👍 |
great to hear! Can you refresh my memory... I've added a small clause about this in the documentation but I'm trying to generate the website but |
nevermind... figured it out. |
We have a rather complex application that is getting its configuration from all over the place.
We're in the process of cleaning all of that up and OWNER is a big part of that effort. However, we do have to ease into this and so we have configuration coming from many different sources and we're funneling that into OWNER.
Working on this I just stumbled upon a "problem" where one of the maps that I was passing into OWNER when creating a configuration interface via the ConfigFactory contained a null value.
This resulted in a very cryptic NullPointerException where I had no idea what was causing the problem. It took me quite a while to track down the problem.
I've created a unit test that demonstrates the problem in its simplest form and it's at the bottom of this issue.
I'm wondering whether doing a sanity check to make sure that the maps passed into ConfigFactory.create() do not contain null values would be a good idea? If such a property is encountered, an IllegalArgumentException could be thrown with the key name in the message.
The above code will throw the following exception:
The text was updated successfully, but these errors were encountered: