i'm getting this exception, but i don't understand why, my application have run very well until today, and i don't insert any changes on the http request for the server.
this is my code:
protected ArrayList<String> doInBackground(Void... params) {
result = null;
inputStream = null;
ArrayList<String> person = new ArrayList<String>();
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url[0]);
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("userName", LoginFragment.getUserName()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
inputStream = entity.getContent();
} catch (Exception exception) {
Log.e("retrieve persons", "Error in http connection " + exception.toString());
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream), 8192);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
inputStream.close();
reader.close();
result = sb.toString();
} catch (Exception e) {
Log.e("Error", "Error converting result " + e.toString());
}
if (!result.contains("null")) {
try {
JSONArray jArray = new JSONArray(result);
for (int i = 0; i < jArray.length(); i++) {
JSONObject tuple = jArray.getJSONObject(i);
person.add(tuple.getString("name"));
}
} catch (JSONException e) {
Log.e("Parser Problem", e.toString());
}
}
return person;
}
my logcat:
E/Parser Problem(7078): org.json.JSONException: End of input at character 0 of
i repeat, this function worked until yesterday,is it possible a side-server problem?
thanks in advance.