Skip to content

Commit

Permalink
Fix boolean parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlougach committed Sep 9, 2024
1 parent 0fb53bb commit cebc9aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions katalyze/src/main/java/jsonfeed/JsonEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static JsonEvent from(JsonObject src) throws InvalidObjectException {

target.data =src.getAsJsonObject("data");

if (target.id == null && target.type != "state") {
if (target.id == null && !target.type.equals("state")) {
throw new InvalidObjectException(String.format("Events of type %s must contain an ID field", target.type));
}

Expand Down Expand Up @@ -100,7 +100,7 @@ public int getInt(String key) {
}

public boolean getBoolean(String key) {
return data.getAsJsonPrimitive(key).isBoolean();
return data.getAsJsonPrimitive(key).getAsBoolean();
}

public boolean tryGetBoolean(String key, boolean defaultValue) {
Expand Down

0 comments on commit cebc9aa

Please sign in to comment.