Skip to content

Commit da76755

Browse files
committed
Call onFailure() when response is not valid JSON
1 parent 253edc9 commit da76755

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/com/loopj/android/http/JsonHttpResponseHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ protected void handleSuccessMessage(String responseBody) {
6969
onSuccess((JSONObject)jsonResponse);
7070
} else if(jsonResponse instanceof JSONArray) {
7171
onSuccess((JSONArray)jsonResponse);
72+
} else {
73+
throw new JSONException("Unexpected type " + jsonResponse.getClass().getName());
7274
}
7375
} catch(JSONException e) {
7476
onFailure(e, responseBody);

0 commit comments

Comments
 (0)