Reputation: 21
I'm using Jsoup 1.11.1 on an android device . I need the html code of some web pages. For this I use the following code:
while (page < numberOfPages){
page++;
String currentURL=tree + String.format("subst_%03d.htm", page);
Document doc = null;
try {
doc = Jsoup
.connect(currentURL)
.header("Authorization", "Basic " + getBase64Login())
.get();
} catch (IOException e1) {
Log.i("GyWueInetSvc", "Exception while JSoup connect:" + currentURL +" cause:"+e1.getMessage());
e1.printStackTrace();
continue;
}
....
Very often I get this exception in LogCat:
11-09 16:01:08.127: I/GyWueInetSvc(4412): Exception while JSoup connect:--The url is deleted -- cause:Mark has been invalidated.
11-09 16:01:08.128: W/System.err(4412): java.io.IOException: Mark has been invalidated.
11-09 16:01:08.130: W/System.err(4412): at java.io.BufferedInputStream.reset(BufferedInputStream.java:336)
11-09 16:01:08.131: W/System.err(4412): at org.jsoup.internal.ConstrainableInputStream.reset(ConstrainableInputStream.java:103)
11-09 16:01:08.136: W/System.err(4412): at org.jsoup.helper.DataUtil.parseInputStream(DataUtil.java:105)
11-09 16:01:08.137: W/System.err(4412): at org.jsoup.helper.HttpConnection$Response.parse(HttpConnection.java:832)
11-09 16:01:08.137: W/System.err(4412): at org.jsoup.helper.HttpConnection.get(HttpConnection.java:289) ....
The relation between "run" and "fail" is about 70:30
What can I do to make it more stable ? Whenever I tested it the web pages are available from my Windows without any problems.
Upvotes: 0
Views: 1122
Reputation: 21
I got a hint and changed the version of Jsoup. A downgrade to Jsoup 1.8.1 solved the problem. There is no need to change any code,
Thankn
Upvotes: 2