Skip to content
Permalink
Browse files
[FIX JENKINS-27499] Don't break tool config page if version metadata …
…is missing.
  • Loading branch information
orrc committed Feb 25, 2017
1 parent 2fe68cc commit 207027e5164d90c2cce988faeaa566db37eab321
@@ -104,7 +104,12 @@ static GolangInstallable getInstallCandidate(GolangRelease release, String osNam
}

private GolangRelease getConfiguredRelease() {
for (GolangRelease r : ((DescriptorImpl) getDescriptor()).getInstallableReleases()) {
List<GolangRelease> releases = ((DescriptorImpl) getDescriptor()).getInstallableReleases();
if (releases == null) {
return null;
}

for (GolangRelease r : releases) {
if (r.id.equals(id)) {
return r;
}
@@ -144,7 +149,12 @@ public List<GolangRelease> toList() {
JSONObject root;
try {
root = getData();
if (root == null) {
// JSON file has not yet been downloaded by Jenkins
return null;
}
} catch (IOException e) {
// JSON parsing exception occurred
return null;
}

@@ -2,17 +2,18 @@ package org.jenkinsci.plugins.golang

def f = namespace(lib.FormTagLib)

f.entry(title: _("Version"), field: "id") {

def releases = descriptor.installableReleases
if (releases.isEmpty()) {
f.textbox()
} else {
def releases = descriptor.installableReleases
if (releases == null || releases.isEmpty()) {
f.block {
text(_('Go version information has not been downloaded. ' +
'To do so, press "Check now" in the Plugin Manager, or restart Jenkins.'))
}
} else {
f.entry(title: _("Version"), field: "id") {
select(name: ".id") {
releases.each { release ->
f.option(value: release.id, selected: release.id == instance?.id, release.name)
}
}
}

}

0 comments on commit 207027e

Please sign in to comment.