3

I have a swing application that read HTML pages using the following command

String urlzip = null; try { Document doc = Jsoup.connect(url).get(); Elements links = doc.select("a[href]"); for (Element link : links) { if (link.attr("abs:href").contains("BcfiHtm.zip")) { urlzip = link.attr("abs:href").toString(); } } } catch (IOException e) { textAreaStatus.append("Failed to get new file from internet:"+e.getMessage()+"\n"); e.printStackTrace(); } return urlzip; 

then my swing application will return a string, It works fine and it reads any HTML page that I give to it. However, some times the application gave me the following error type Exception report. How can i increase timeOut?

0

2 Answers 2

6

There's an example on this page.

Jsoup.connect("http://example.com").timeout(3000) 
Sign up to request clarification or add additional context in comments.

Comments

3

This error occurs while you are trying to read data and because of large data or connection problem it can not complete the task. I would suggest you to increase your Timeout using above code atleast for 1 minute. so it will be like below code,

Jsoup.connect("http://example.com").timeout(60000); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.