Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ protected void handleEvent(String event, JsonObject params) {
sendMessageAsync("sendToPage", messageParams);
}
} else if ("closePage".equals(event)) {
int code = params.get("code").getAsInt();
String reason = params.get("reason").getAsString();
boolean wasClean = params.get("wasClean").getAsBoolean();
Integer code = params.has("code") ? params.get("code").getAsInt() : null;
String reason = params.has("reason") ? params.get("reason").getAsString() : null;
boolean wasClean = params.has("wasClean") && params.get("wasClean").getAsBoolean();
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@nanne-rl nanne-rl Jan 29, 2026

Choose a reason for hiding this comment

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

Interesting. It could be nice to add @Nullable to the generated Java code and to run FindBugs to ensure null checks are done.

Copy link
Member

Choose a reason for hiding this comment

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

There is an open request for public api about this #473

if (onPageClose != null) {
onPageClose.accept(code, reason);
} else {
Expand All @@ -173,9 +173,9 @@ protected void handleEvent(String event, JsonObject params) {
sendMessageAsync("closeServer", closeParams);
}
} else if ("closeServer".equals(event)) {
int code = params.get("code").getAsInt();
String reason = params.get("reason").getAsString();
boolean wasClean = params.get("wasClean").getAsBoolean();
Integer code = params.has("code") ? params.get("code").getAsInt() : null;
String reason = params.has("reason") ? params.get("reason").getAsString() : null;
boolean wasClean = params.has("wasClean") && params.get("wasClean").getAsBoolean();
if (onServerClose != null) {
onServerClose.accept(code, reason);
} else {
Expand Down
Loading