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

Adds trace while allowing missing file by returing empty parse value #550

Merged
merged 1 commit into from
Mar 2, 2018

Conversation

sathiyapk
Copy link
Contributor

People come from Java background would expect FileNotFoundException if there's any problem in reading a file. But for some reason, the default value of the ConfigParseOptions.allowMissing is set to true, so i think i would be helpful to log this info. I kept it under trace, so it would help people who wanted to debug what's going wrong.

@lightbend-cla-validator
Copy link
Collaborator

Hi @sathiyapk,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement:

http://www.lightbend.com/contribute/cla

@sathiyapk
Copy link
Contributor Author

I did sign the CLA.

Copy link
Collaborator

@havocp havocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Seems useful to me.

@@ -180,6 +180,8 @@ final private AbstractConfigValue parseValue(ConfigOrigin origin,
return rawParseValue(origin, finalOptions);
} catch (IOException e) {
if (finalOptions.getAllowMissing()) {
trace(e.getMessage() + ". Allowing Missing File, this can be turned off by setting" +
" ConfigParseOptions.allowMissing = false");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the filename end up in this message somehow? (not sure if it's in getMessage or added by trace or what)

Copy link
Contributor Author

@sathiyapk sathiyapk Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@havocp thanks for your comment!
This is one of the messages from trace:
resource not found on classpath: nothere.json. Allowing Missing File, this can be turned off by setting ConfigParseOptions.allowMissing = false

So i think it does.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! thanks again

@havocp havocp merged commit b991b3d into lightbend:master Mar 2, 2018
aalleexxeeii pushed a commit to aalleexxeeii/typesafe-config that referenced this pull request Jun 6, 2018
Adds trace while allowing missing file by returing empty parse value
@2m 2m added this to the 1.3.4 milestone Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants