From 4b831e56c09e673cbb8df2b782d42a951dc8a738 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Tue, 23 Oct 2007 01:19:07 +0000 Subject: [PATCH] eliminate the JDK configuration option altogether if there's only one JDK configured in the system, since the intention is obviously to use that JDK (#659) git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5409 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Hudson.java | 7 ++++++- .../hudson/model/AbstractItem/configure-common.jelly | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 49d2dacdbb..5739df7013 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -667,7 +667,12 @@ public final class Hudson extends View implements ItemGroup, Node * Gets the JDK installation of the given name, or returns null. */ public JDK getJDK(String name) { - if(name==null) return null; + if(name==null) { + // if only one JDK is configured, "default JDK" should mean that JDK. + List jdks = getJDKs(); + if(jdks.size()==1) return jdks.get(0); + return null; + } for (JDK j : getJDKs()) { if(j.getName().equals(name)) return j; diff --git a/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly b/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly index dc79749d0d..7cb2772019 100644 --- a/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly +++ b/core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly @@ -5,7 +5,8 @@ - + +