I searched about this error and i found it usually happen when you try to GetContent twice or more times, but the thing is, i am not, i have two almost identical methods, one works, the other don't..
Method ParseHor() -Doesn't work
public ArrayList<Hor> ParseHor() throws Exception{
ArrayList<Horario> listHorario = new ArrayList<Horario>();
HttpGet get = new HttpGet(
URL1);
HttpResponse response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent(); // Create an InputStream with the
BufferedReader reader = new BufferedReader(new InputStreamReader(is,
"iso-8859-1"));
StringBuilder sb = new StringBuilder();
...
}
ParseGrades() - Works
public ArrayList<Grade> ParseGrades() throws Exception {
HttpGet get = new HttpGet(
URL2);
HttpResponse response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent(); // Create an InputStream with the
BufferedReader reader = new BufferedReader(new InputStreamReader(is,
"iso-8859-1"));
StringBuilder sb = new StringBuilder();
...
}
I tried to call just ParseHor(), but when it gets on the InputStream line, the exception rises with IllegalState - Content already consumed
找到它,问题在于变量的名称是相同的,我对此进行了更改并开始工作。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.