java - HttpEntity content already consumed -
i searched error , found happen when try getcontent twice or more times, thing is, not, have 2 identical methods, 1 works, other don't..
method parsehor() -doesn't work
public arraylist<hor> parsehor() throws exception{ arraylist<horario> listhorario = new arraylist<horario>(); httpget = new httpget( url1); httpresponse response = httpclient.execute(get); httpentity entity = response.getentity(); inputstream = entity.getcontent(); // create inputstream bufferedreader reader = new bufferedreader(new inputstreamreader(is, "iso-8859-1")); stringbuilder sb = new stringbuilder(); ... } parsegrades() - works
public arraylist<grade> parsegrades() throws exception { httpget = new httpget( url2); httpresponse response = httpclient.execute(get); httpentity entity = response.getentity(); inputstream = entity.getcontent(); // create inputstream bufferedreader reader = new bufferedreader(new inputstreamreader(is, "iso-8859-1")); stringbuilder sb = new stringbuilder(); ... } i tried call parsehor(), when gets on inputstream line, exception rises illegalstate - content consumed
found it, problem name of variables same, changed , worked.
Comments
Post a Comment