-
-
Notifications
You must be signed in to change notification settings - Fork 759
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
fix: usage of Optional.orElseThrow after Map.put #2145
Conversation
@@ -19,6 +19,7 @@ | |||
import java.util.Collections; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import java.util.Optional; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need for this import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -83,8 +84,8 @@ public KeyEvent withFlag(KeyEventFlag keyEventFlag) { | |||
*/ | |||
public Map<String, Object> build() { | |||
var map = new HashMap<String, Object>(); | |||
ofNullable(this.keyCode).map(x -> map.put("keycode", x)).orElseThrow(() -> new IllegalStateException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valfirst Could there be other places in the source like this one? I assume the issue may have been added during the recent refactoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is a regression issue, I've found 2 more similar occurrences, I'll open PR soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. Lets address them all and publish a patch asap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mykola-mokhnach I believe I fixed them in my last commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already addressed AndroidGeoLocation
issues here: #2146
@artlomako checkstyle is failed |
Change list
KeyEvent
Types of changes
What types of changes are you proposing/introducing to Java client?
Put an
x
in the boxes that applyDetails
After the last change in
KeyEvent
class, it's impossible to use the key event, because the following code always throws an exception:since
map.put()
returns null for new key.