mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
[MSA] (2/?) Bug fix: ClassCastException
This commit is contained in:
parent
4bd35a10be
commit
9a8e961795
@ -25,8 +25,14 @@ public class HttpResponse<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public T body() throws IOException {
|
public T body() throws IOException {
|
||||||
Class<T> type = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
if (statusCode() >= 200 && statusCode() < 300) {
|
||||||
if (type.isAssignableFrom(String.class)) {
|
return (T) Tools.read(mRequest.mBuilder.getBase().getInputStream());
|
||||||
|
} else {
|
||||||
|
return (T) Tools.read(mRequest.mBuilder.getBase().getErrorStream());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (T instanceof String) {
|
||||||
if (statusCode() >= 200 && statusCode() < 300) {
|
if (statusCode() >= 200 && statusCode() < 300) {
|
||||||
return (T) Tools.read(mRequest.mBuilder.getBase().getInputStream());
|
return (T) Tools.read(mRequest.mBuilder.getBase().getInputStream());
|
||||||
} else {
|
} else {
|
||||||
@ -35,5 +41,6 @@ public class HttpResponse<T>
|
|||||||
} else {
|
} else {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user