瀏覽代碼

Pull most recent Structure101 version

Closes gh-10696
Josh Cummings 3 年之前
父節點
當前提交
6706512b3a
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. 9 5
      buildSrc/src/main/java/s101/S101Configurer.java

+ 9 - 5
buildSrc/src/main/java/s101/S101Configurer.java

@@ -164,14 +164,18 @@ public class S101Configurer {
 		String source = "https://structure101.com/binaries/19159";
 		try (final WebClient webClient = new WebClient()) {
 			HtmlPage page = webClient.getPage(source);
+			Matcher matcher = null;
 			for (HtmlAnchor anchor : page.getAnchors()) {
-				Matcher matcher = Pattern.compile("(structure101-build-java-all-)(.*).zip").matcher(anchor.getHrefAttribute());
-				if (matcher.find()) {
-					copyZipToFilesystem(source, installationDirectory, matcher.group(1) + matcher.group(2));
-					return matcher.group(2);
+				Matcher candidate = Pattern.compile("(structure101-build-java-all-)(.*).zip").matcher(anchor.getHrefAttribute());
+				if (candidate.find()) {
+					matcher = candidate;
 				}
 			}
-			return null;
+			if (matcher == null) {
+				return null;
+			}
+			copyZipToFilesystem(source, installationDirectory, matcher.group(1) + matcher.group(2));
+			return matcher.group(2);
 		} catch (Exception ex) {
 			throw new RuntimeException(ex);
 		}