I have an Asynch server call that is being made and every once in a while it generates this exception:
End of input at character 0 of
which I get here:
@Override
protected String doInBackground(String... theParams)
{
String myUrl = theParams[0];
final String user_id = theParams[1];
String charset = "UTF-8";
String response = null;
try
{
String query = String.format("user_id=%s",
URLEncoder.encode( user_id, charset) );
final URL url = new URL( myUrl + "?" + query );
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.connect();
final InputStream is = conn.getInputStream();
final byte[] buffer = new byte[8196];
int readCount;
final StringBuilder builder = new StringBuilder();
while ((readCount = is.read(buffer)) > -1)
{
builder.append(new String(buffer, 0, readCount));
}
response = builder.toString();
}
catch (Exception e)
{
e.getMessage());
}}
Would anyone know why that gets generated? Is it just the server being unresponsive? Or something else?
Thanks!