-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IoException: Stream closed #4
Comments
@zkvarz Hi! I can't reproduce this without any details! |
I debugged on this. As I understand It cannot parse JSON. I see such stacktrace: 0 = {StackTraceElement@6082} "com.google.gson.Gson.fromJson(Gson.java:825)" |
It is related to this issue: |
object ReposRemoteDataSource : ReposDataSource {
init {
FuelManager.instance.basePath = "https://api.github.com"
// FuelManager.instance.addResponseInterceptor { loggingResponseInterceptor() }
}
internal val typeToken = object: TypeToken<Any>() {}
internal class Deserializer : ResponseDeserializable<List<Repo>> {
override fun deserialize(reader: Reader): List<Repo>? {
val result = Gson().fromJson<List<Any>>(reader, typeToken.type)
return result.filter { it is Map<*,*> }.map {
it as Map<*,*>
Repo((it["id"] as? Number)?.toLong(), it["name"] as? String, it["full_name"] as? String, it["description"] as? String, "")
}
}
}
override fun getRepositories(organization: String): Single<List<Repo>> =
"/orgs/$organization/repos"
.httpGet()
// .rx_object(GsonDeserializer<List<Repo>>())
.rx_object(Deserializer())
.map {
it?.component1() ?: throw it?.component2() ?: throw Exception()
}
.doOnSuccess { it.onEach { it.organization = organization } }
} |
@userquin. Can you please explain why? |
There was a toast error message. Sorry, I didn't see anything in logs. Had no time to look into it in details.
The text was updated successfully, but these errors were encountered: