Here I am trying to POST some data from mobile to server. To do this, I first need to log in to authenticate with the server. then after sending the data via a POST request, I checked this related stack question. HttpClient 4.0.1 - how to free a connection?
I tried all these methods one by one.
1.EntityUtils.consume (legal entity);
2.is.close ();
- .
response.getEntity () consumeContent (); // that consumeContent () is displayed as deprecated
post.abort ();
Here is my detailed code in pastebin links, please check this.
Here is the program stream.
The first login is called Check HERE MY REQUEST REQUEST
After logging in and before posting ideas, this method is called.
Finally, the post idea method is called.
but logcat shows me an error:
java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection is still highlighted.
Be sure to release the connection before highlighting another
W/System.err( 2217): java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated. W/System.err( 2217): Make sure to release the connection before allocating another one. W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.conn.BasicClientConnectionManager.getConnection(BasicClientConnectionManager.java:161) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.conn.BasicClientConnectionManager$1.getConnection(BasicClientConnectionManager.java:138) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:455) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:902) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:801) W/System.err( 2217): at ch.boye.httpclientandroidlib.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:780) W/System.err( 2217): at com.rahul.cheerfoolz.api.util.postData(util.java:436) W/System.err( 2217): at com.rahul.cheerfoolz.postidea.idea.post_myidea_edit$Post_Idea.doInBackground(post_myidea_edit.java:354) W/System.err( 2217): at com.rahul.cheerfoolz.postidea.idea.post_myidea_edit$Post_Idea.doInBackground(post_myidea_edit.java:1) W/System.err( 2217): at android.os.AsyncTask$2.call(AsyncTask.java:185) W/System.err( 2217): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) W/System.err( 2217): at java.util.concurrent.FutureTask.run(FutureTask.java:138) W/System.err( 2217): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) W/System.err( 2217): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) W/System.err( 2217): at java.lang.Thread.run(Thread.java:1019)
source share