testLocate failed in continuous build; at least make it fail with a meaningful message.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30976 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
jglick committed 2010-05-12 22:18:04 +00:00
1 parent da236bad5e
commit 554f1c0fa0
1 file changed
+5 -2
@@ -57,7 +57,6 @@ import java.io.InputStream;
import java.net.URL;
import java.net.HttpURLConnection;
import java.net.URLEncoder;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -361,7 +360,7 @@ public class JDKInstaller extends ToolInstaller {
}
}
private URL locateStage2(TaskListener log, String page) throws MalformedURLException {
private URL locateStage2(TaskListener log, String page) throws IOException {
Pattern HREF = Pattern.compile("<a href=\"(http://cds.sun.com/[^\"]+/VerifyItem-Start[^\"]+)\"");
Matcher m = HREF.matcher(page);
// this page contains a missing --> that confuses dom4j/jtidy
@@ -384,6 +383,10 @@ public class JDKInstaller extends ToolInstaller {
LOGGER.fine("Found a download candidate: "+ url);
}
if (urls.isEmpty()) {
throw new IOException("found no matches in: " + page);
}
// prefer the first match because sometimes "optional downloads" follow the main bundle
return new URL(urls.get(0));
}