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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/src/main/java/com/typesafe/config/impl/Parseable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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

return SimpleConfigObject.emptyMissing(origin);
} else {
trace("exception loading " + origin.description() + ": " + e.getClass().getName()
Expand Down