我搜索了这个错误,我发现它通常发生在你尝试GetContent两次或更多次,但问题是,我不是,我有两个几乎相同的方法,一个工作,另一个不..
方法ParseHor() - 不起作用
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() - 作品
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();
...
}
我试图只调用ParseHor(),但是当它进入InputStream行时,异常会因IllegalState而上升 - 内容已经消耗
答案 0 :(得分:0)
找到它,问题是变量的名称是相同的,我改变了它并且工作了。