Committed by
Gerrit Code Review
Fix NPE when a criterion does not specify a type
Change-Id: I79a115308d703ccec9e9c147df42a6a0a5b8d6dd
Showing
1 changed file
with
3 additions
and
1 deletions
... | @@ -500,7 +500,9 @@ public final class DecodeCriterionCodecHelper { | ... | @@ -500,7 +500,9 @@ public final class DecodeCriterionCodecHelper { |
500 | * @throws IllegalArgumentException if the JSON is invalid | 500 | * @throws IllegalArgumentException if the JSON is invalid |
501 | */ | 501 | */ |
502 | public Criterion decode() { | 502 | public Criterion decode() { |
503 | - String type = json.get(CriterionCodec.TYPE).asText(); | 503 | + String type = |
504 | + nullIsIllegal(json.get(CriterionCodec.TYPE), "Type not specified") | ||
505 | + .asText(); | ||
504 | 506 | ||
505 | CriterionDecoder decoder = decoderMap.get(type); | 507 | CriterionDecoder decoder = decoderMap.get(type); |
506 | if (decoder != null) { | 508 | if (decoder != null) { | ... | ... |
-
Please register or login to post a comment