I am receiving this error code.
E/camera_classes.callHttpPostToSendFiles: exception message e java.io.IOException: Server returned non-OK status: 400 message: Bad Request error stream : com.android.okhttp.internal.http.HttpTransport$FixedLengthInputStream@42353798at camera_classes.postMultipartEntity.finish(postMultipartEntity.java:161) at camera_classes.callHttpPostToSendFiles.postData(callHttpPostToSendFiles.java:193) at camera_classes.callHttpPostToSendFiles$1.doInBackground(callHttpPostToSendFiles.java:109) at camera_classes.callHttpPostToSendFiles$1.doInBackground(callHttpPostToSendFiles.java:105) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)
The error is happening at
public List<String> finish() throws IOException {
List<String> response = new ArrayList<String>();
writer.append(LINE_FEED).flush();
writer.append("--" + boundary + "--").append(LINE_FEED);
writer.close();
// checks server's status code first
int status = httpConn.getResponseCode();
String server_message = httpConn.getResponseMessage();
if (status == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(
httpConn.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null) {
response.add(line);
}
reader.close();
httpConn.disconnect();
} else {
throw new IOException("Server returned non-OK status: " + status + " message: " + server_message + " error stream : " + httpConn.getErrorStream());
}
1) I am interested in getting more information on the error code (400 Bad Request) listed here, so I can understand what is causing the "400 Bad request" error. Can anyone help. I have tried all the available public methods - httpConn.getResponseMessage(), httpConn.getResponseCode() and httpConn.getErrorStream().
2) What does com.android.okhttp.internal.http.HttpTransport$FixedLengthInputStream@42353798 mean? This is the output of httpConn.getErrorStream().