diff --git a/auth0/src/main/java/com/auth0/android/request/internal/UserProfileDeserializer.java b/auth0/src/main/java/com/auth0/android/request/internal/UserProfileDeserializer.java index f84c2b5d..611aadd9 100755 --- a/auth0/src/main/java/com/auth0/android/request/internal/UserProfileDeserializer.java +++ b/auth0/src/main/java/com/auth0/android/request/internal/UserProfileDeserializer.java @@ -30,7 +30,7 @@ public UserProfile deserialize(JsonElement json, Type typeOfT, JsonDeserializati final String email = context.deserialize(object.remove("email"), String.class); final String givenName = context.deserialize(object.remove("given_name"), String.class); final String familyName = context.deserialize(object.remove("family_name"), String.class); - final boolean emailVerified = object.has("email_verified") ? context.deserialize(object.remove("email_verified"), Boolean.class) : false; + final Boolean emailVerified = object.has("email_verified") ? context.deserialize(object.remove("email_verified"), Boolean.class) : false; final Date createdAt = context.deserialize(object.remove("created_at"), Date.class); final Type identitiesType = new TypeToken>() {}.getType(); diff --git a/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt b/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt index 1f5fe3ca..dad5aeed 100644 --- a/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt +++ b/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt @@ -304,8 +304,8 @@ public class AuthenticationExceptionTest { @Throws(Exception::class) public fun shouldHaveNotStrongPasswordWithDetailedDescription() { val fr = FileReader(PASSWORD_STRENGTH_ERROR_RESPONSE) - val mapType = object : TypeToken?>() {}.type - val mapPayload = GsonProvider.gson.fromJson>(fr, mapType) + val mapType = object : TypeToken>() {} + val mapPayload: Map = GsonProvider.gson.getAdapter(mapType).fromJson(fr) val ex = AuthenticationException(mapPayload) MatcherAssert.assertThat(ex.isPasswordNotStrongEnough, CoreMatchers.`is`(true)) val expectedDescription = diff --git a/auth0/src/test/java/com/auth0/android/request/internal/UserProfileGsonTest.kt b/auth0/src/test/java/com/auth0/android/request/internal/UserProfileGsonTest.kt index 98bbd457..bfe1e59b 100755 --- a/auth0/src/test/java/com/auth0/android/request/internal/UserProfileGsonTest.kt +++ b/auth0/src/test/java/com/auth0/android/request/internal/UserProfileGsonTest.kt @@ -38,6 +38,17 @@ public class UserProfileGsonTest : GsonBaseTest() { } } + @Test + @Throws(Exception::class) + public fun shouldHandleNullBooleans() { + val userProfile = pojoFrom( + StringReader( + """{"email_verified": null}""" + ), UserProfile::class.java + ) + assertThat(userProfile, `is`(notNullValue())) + } + @Test @Throws(Exception::class) public fun shouldNotRequireUserId() {