From 554f1c0fa0299945fea8626e5df6dbfbf0afd8ff Mon Sep 17 00:00:00 2001 From: jglick Date: Wed, 12 May 2010 22:18:04 +0000 Subject: [PATCH] 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 --- core/src/main/java/hudson/tools/JDKInstaller.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/tools/JDKInstaller.java b/core/src/main/java/hudson/tools/JDKInstaller.java index 8945b11124..d8b5efc480 100644 --- a/core/src/main/java/hudson/tools/JDKInstaller.java +++ b/core/src/main/java/hudson/tools/JDKInstaller.java @@ -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(" 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)); }