I want throw (IOException) for this program. But I don’t know which of the subclasses of IOException are more likely to be thrown by this program. How should I identify?
import java.io.*; import java.net.*; import java.util.ArrayList; public class SimpleSpider { ArrayList<String> set = new ArrayList<String>(); public void search(String host) { try { URL u = new URL(host); set.add(host); ArrayList<String> tags = Util.extractTags(u); for (int i = 0; i < tags.size(); i++) { String nexthost = Util.extractURL(tags.get(i)); if (nexthost != null && !set.contains(nexthost)) { System.out.println(nexthost); search(nexthost); } } } catch (IOException e) {} } public static void main (String[] args) { SimpleSpider spider = new SimpleSpider(); spider.search("http://en.origami-club.com/"); } }