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

Certain ConfigContexts cause NullPointerExceptions despite having documented defaults #247

Closed
tjcelaya opened this issue May 25, 2017 · 1 comment
Assignees
Labels

Comments

@tjcelaya
Copy link
Contributor

tjcelaya commented May 25, 2017

TL;DR: we aren't handling some configuration parameters in the execution path which have documented default values

Despite the defaults listed in README.md, certain implementations of ConfigContext result in NullPointerExceptions. Adding getters for disableNativeSignatures and noAuth to these classes would save some trouble for developers that choose to use these classes. One option is to implement getters in these classes if the behavior of null is best decided by the class itself. Most of these classes use MantaUtils.parseBooleanOrNull

Problematic Classes Classes that do what they say they do:

  • MapConfigContext: uses MantaUtils.parseBooleanOrNull which returns null when passed null
  • EnvVarConfigContext: uses MantaUtils.parseBooleanOrNull as well
  • StandardConfigContext: doesn't implement anything, which is probably as intended and implies the null-handling for default behavior belongs outside these classes
  • ChainedConfigContext: abstracts over arrays of multiple ConfigContexts and probably shouldn't be concerned with this kind of thing

Alternatively, we could modify the lines that cause the NullPointerExceptions codepath to check handle nulls explicitly, specifically the following two lines

Code used to verify which classes throw and which don't:

https://gist.github.com/tjcelaya/df63bfe932afff07de4f501d6daff241

@tjcelaya tjcelaya self-assigned this Aug 16, 2017
@tjcelaya tjcelaya added the bug label Aug 16, 2017
tjcelaya added a commit to tjcelaya/java-manta that referenced this issue Aug 17, 2017
…ration params that have documented defaults
@tjcelaya tjcelaya mentioned this issue Aug 17, 2017
@dekobon
Copy link
Contributor

dekobon commented Aug 17, 2017

The fundamental problem is that we don't have a stable value for UNSET. I could see us refactor to a wrapping object that would allow for that information to be stored, but that would be a fair bit of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants