Skip to content

Commit

Permalink
throw exception on empty json value
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalmaceda committed Dec 28, 2016
1 parent aeda5b1 commit fe852aa
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class UserProfileDeserializer implements JsonDeserializer<UserProfile> {
@Override
public UserProfile deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
if (!json.isJsonObject() || json.isJsonNull()) {
if (!json.isJsonObject() || json.isJsonNull() || json.getAsJsonObject().entrySet().isEmpty()) {
throw new JsonParseException("user profile json is not a valid json object");
}

Expand Down

0 comments on commit fe852aa

Please sign in to comment.