Skip to content

Commit

Permalink
Fix leftover usages of Gson()
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalmaceda committed Jan 14, 2021
1 parent 0488369 commit 0108b7e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
private const val WELL_KNOWN_PATH = ".well-known"
private const val JWKS_FILE_PATH = "jwks.json"
private fun createErrorAdapter(): ErrorAdapter<AuthenticationException> {
val mapAdapter = forMap(Gson())
val mapAdapter = forMap(GsonProvider.gson)
return object : ErrorAdapter<AuthenticationException> {
override fun fromRawResponse(
statusCode: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public class UsersAPIClient @VisibleForTesting(otherwise = VisibleForTesting.PRI
private const val USER_METADATA_KEY = "user_metadata"

private fun createErrorAdapter(): ErrorAdapter<ManagementException> {
val mapAdapter = forMap(Gson())
val mapAdapter = forMap(GsonProvider.gson)
return object : ErrorAdapter<ManagementException> {
override fun fromRawResponse(
statusCode: Int,
Expand Down
4 changes: 2 additions & 2 deletions auth0/src/main/java/com/auth0/android/util/Auth0UserAgent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.text.TextUtils
import android.util.Base64
import androidx.annotation.VisibleForTesting
import com.auth0.android.auth0.BuildConfig
import com.google.gson.Gson
import com.auth0.android.request.internal.GsonProvider
import java.nio.charset.StandardCharsets
import java.util.*

Expand Down Expand Up @@ -54,7 +54,7 @@ public class Auth0UserAgent public constructor(
values[NAME_KEY] = name
values[VERSION_KEY] = version
values[ENV_KEY] = environment
val json = Gson().toJson(values)
val json = GsonProvider.gson.toJson(values)
val bytes = json.toByteArray(StandardCharsets.UTF_8)
value = String(
Base64.encode(bytes, Base64.URL_SAFE or Base64.NO_WRAP),
Expand Down

0 comments on commit 0108b7e

Please sign in to comment.