package com.ubt.jimu.base.http.converter; import android.text.TextUtils; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.ubtech.utils.StringUtils; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Converter; /* loaded from: classes.dex */ public class GsonResponseBodyConverter implements Converter { private final TypeAdapter adapter; private final Gson gson; private final String JSON_KEY_MODELS = "models"; private final String JSON_KEY_LIST = "list_models"; GsonResponseBodyConverter(Gson gson, TypeAdapter typeAdapter) { this.gson = gson; this.adapter = typeAdapter; } @Override // retrofit2.Converter public T convert(ResponseBody responseBody) throws IOException { try { try { String string = responseBody.string(); if ((!TextUtils.isEmpty(string) && string.contains("accessKeyId") && string.contains("securityToken") && string.contains("accessKeySecret")) || string.contains("token")) { return this.adapter.fromJson(string); } return this.adapter.fromJson(StringUtils.a(string)); } catch (Exception e) { e.printStackTrace(); responseBody.close(); return null; } } finally { responseBody.close(); } } }