Fix AndroidHttpClient leaks.
This commit is contained in:
parent
c13dd67f43
commit
299682bb6d
@ -132,10 +132,12 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
m_lastError = ApiError.INVALID_URL;
|
m_lastError = ApiError.INVALID_URL;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
client.close();
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
m_lastError = ApiError.OTHER_ERROR;
|
m_lastError = ApiError.OTHER_ERROR;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
client.close();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +155,7 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
m_lastError = ApiError.INVALID_URL;
|
m_lastError = ApiError.INVALID_URL;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
client.close();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,8 +221,6 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.close();
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
case 401:
|
case 401:
|
||||||
m_lastError = ApiError.HTTP_UNAUTHORIZED;
|
m_lastError = ApiError.HTTP_UNAUTHORIZED;
|
||||||
@ -238,6 +239,7 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.close();
|
||||||
return null;
|
return null;
|
||||||
} catch (javax.net.ssl.SSLPeerUnverifiedException e) {
|
} catch (javax.net.ssl.SSLPeerUnverifiedException e) {
|
||||||
m_lastError = ApiError.SSL_REJECTED;
|
m_lastError = ApiError.SSL_REJECTED;
|
||||||
@ -253,6 +255,7 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.close();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -512,6 +512,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
targetUrl = new URL(fetchUrl);
|
targetUrl = new URL(fetchUrl);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
client.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,12 +544,12 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
|
|
||||||
fos.close();
|
fos.close();
|
||||||
is.close();
|
is.close();
|
||||||
|
|
||||||
client.close();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPostExecute(Integer result) {
|
protected void onPostExecute(Integer result) {
|
||||||
|
Loading…
Reference in New Issue
Block a user