File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/com/loopj/android/http Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 18
18
19
19
package com .loopj .android .http ;
20
20
21
- import java .io .IOException ;
22
-
23
21
import org .json .JSONArray ;
24
22
import org .json .JSONException ;
25
23
import org .json .JSONObject ;
@@ -31,7 +29,7 @@ public void handleSuccessMessage(String responseBody) {
31
29
super .handleSuccessMessage (responseBody );
32
30
33
31
try {
34
- Object jsonResponse = new JSONTokener (responseBody ). nextValue ( );
32
+ Object jsonResponse = parseResponse (responseBody );
35
33
if (jsonResponse instanceof JSONObject ) {
36
34
onSuccess ((JSONObject )jsonResponse );
37
35
} else if (jsonResponse instanceof JSONArray ) {
@@ -41,7 +39,11 @@ public void handleSuccessMessage(String responseBody) {
41
39
onFailure (e );
42
40
}
43
41
}
44
-
42
+
43
+ protected Object parseResponse (String responseBody ) throws JSONException {
44
+ return new JSONTokener (responseBody ).nextValue ();
45
+ }
46
+
45
47
// Public callbacks
46
48
public void onSuccess (JSONObject response ) {}
47
49
public void onSuccess (JSONArray response ) {}
You can’t perform that action at this time.
0 commit comments