Skip to content

Update the sendResponseMessage with a protected modifier and fix a spelling error. #83

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/com/loopj/android/http/AsyncHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void setUserAgent(String userAgent) {
}

/**
* Sets the connection time oout. By default, 10 seconds
* Set the connection timeout. By default, 10 seconds.
* @param timeout the connect/socket timeout in milliseconds
*/
public void setTimeout(int timeout){
Expand Down
4 changes: 2 additions & 2 deletions src/com/loopj/android/http/AsyncHttpResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected Message obtainMessage(int responseMessage, Object response) {


// Interface to AsyncHttpRequest
void sendResponseMessage(HttpResponse response) {
protected void sendResponseMessage(HttpResponse response) {
StatusLine status = response.getStatusLine();
String responseBody = null;
try {
Expand All @@ -227,4 +227,4 @@ void sendResponseMessage(HttpResponse response) {
sendSuccessMessage(responseBody);
}
}
}
}
2 changes: 1 addition & 1 deletion src/com/loopj/android/http/BinaryHttpResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected void handleMessage(Message msg) {
}

// Interface to AsyncHttpRequest
void sendResponseMessage(HttpResponse response) {
protected void sendResponseMessage(HttpResponse response) {
StatusLine status = response.getStatusLine();
Header[] contentTypeHeaders = response.getHeaders("Content-Type");
byte[] responseBody = null;
Expand Down
14 changes: 8 additions & 6 deletions src/com/loopj/android/http/JsonHttpResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ protected void handleSuccessJsonMessage(Object jsonResponse) {

protected Object parseResponse(String responseBody) throws JSONException {
Object result = null;
//trim the string to prevent start with blank, and test if the string is valid JSON, because the parser don't do this :(. If Json is not valid this will return null
responseBody = responseBody.trim();
if(responseBody.startsWith("{") || responseBody.startsWith("[")) {
result = new JSONTokener(responseBody).nextValue();
}
return result;
// trim the string to prevent start with blank, and test if the string
// is valid JSON, because the parser don't do this :(. If Json is not
// valid this will return null
responseBody = responseBody.trim();
if (responseBody.startsWith("{") || responseBody.startsWith("[")) {
result = new JSONTokener(responseBody).nextValue();
}
return result;
}

@Override
Expand Down