Fix NPE and NumberFormatException in some cases#11114
Merged
garagatyi merged 1 commit intoeclipse-che:masterfrom Sep 10, 2018
Merged
Fix NPE and NumberFormatException in some cases#11114garagatyi merged 1 commit intoeclipse-che:masterfrom
garagatyi merged 1 commit intoeclipse-che:masterfrom
Conversation
Fix NPE on start of a workspace created from the Theia stack. Fix NumberFormatException when machine doesn't have memory property. Signed-off-by: Oleksandr Garagatyi <ogaragat@redhat.com>
sleshchenko
reviewed
Sep 7, 2018
| Containers.addRamLimit(container, Long.parseLong(attributes.get(MEMORY_LIMIT_ATTRIBUTE))); | ||
| String memoryLimitAttribute = attributes.get(MEMORY_LIMIT_ATTRIBUTE); | ||
| if (memoryLimitAttribute != null) { | ||
| Containers.addRamLimit(container, Long.parseLong(memoryLimitAttribute)); |
Member
There was a problem hiding this comment.
It's like an unusual case since we have configuration properties for configuring default values for machines memory if they are not specified explicitly. Should it be logged as a warning?
Author
There was a problem hiding this comment.
I believe that a method shouldn't throw an NPE if it doesn't declare it. And in any case, a logic of a class depending on the logic of some other classes (or system overall) might be treated as an encapsulation violation. One might argue that it is called architecture, but in this particular case, I don't see this situation as an architectural decision.
Member
There was a problem hiding this comment.
Makes sense. Ok to me leave it as it is
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix NPE on the start of a workspace created from the Theia stack.
Fix NumberFormatException when a machine doesn't have memory
property.
What issues does this PR fix or reference?
Fixes #11134
Release Notes
Docs PR