我试图检查我想要连接的 URL 是否存在。这是我的尝试:
try {
// Connect to the url
document = Jsoup.connect("http://www.malformedurl.com").get();
tags = document.select(".tags .tag a");
num = document.select(".tag .count");
// Take the wanted data
UrlFunctions.UrlParse(tags, num);
} catch (java.net.MalformedURLException e) {
System.out.println("URL DOESNT EXIST");
}
运行之后,我没有收到消息URL DOESNT EXIST
。我应该使用什么例外或我还应该做什么?