Why and where is my array being thrown out of bounds?
public class DownloadRawData extends AsyncTask<String, Void, String>
{
@Override
public void onPostExecute(String webData) {
mData =webData;
Log.v(LOG_TAG, "Data returned was: "+mData);
if(mData ==null) {
if (mRawURL ==null) {
mDownloadStatus = DownloadStatus.NOT_INITIALIZED;
} else {
mDownloadStatus =DownloadStatus.FAILED_OR_EMPTY;
}
} else {
mDownloadStatus =DownloadStatus.OK;
}
}
protected String doInBackground(String...params){
HttpURLConnection urlConnection =null;
BufferedReader reader = null;
if(params ==null)
return null;
try{
URL url = new URL(params[0]);
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.connect();
InputStream inputStream = urlConnection.getInputStream();
if (inputStream ==null){
return null;
}
StringBuilder buffer= new StringBuilder();
reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while((line =reader.readLine()) !=null) {
buffer.append(line + "\n");
}
return buffer.toString();
} catch (IOException e) {
Log.e(LOG_TAG,"Error",e);
return null;
} finally {
if(urlConnection !=null) {
urlConnection.disconnect();
}
if(reader !=null) {
try {
reader.close();
}
catch (final IOException e) {
Log.e(LOG_TAG,"ERROR closing stream",e);
}
}
}
heres my errors
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at com.google.android.gms.samples.vision.face.multitracker.GetRawData$DownloadRawData.doInBackground(GetRawData.java:84)
at com.google.android.gms.samples.vision.face.multitracker.GetRawData$DownloadRawData.doInBackground(GetRawData.java:55)
Java line 55 is
public class DownloadRawData extends AsyncTask<String, Void, String>
And Java line 84 is
URL url = new URL(params[0]);