From cae208a8f2509c7f701e1159893ac3e9b2644643 Mon Sep 17 00:00:00 2001
From: Mark Waite
Date: Fri, 16 Nov 2018 14:48:04 -0700
Subject: [PATCH 1/2] [JENKINS-52282] Add isJavaWebStartSupported to
JNLPLauncher
Seems cleaner to use JNLPLauncher than to use Functions. Narrows the
scope of the method so that callers know it is specific to
JNLPLauncher.
---
.../main/java/hudson/slaves/JNLPLauncher.java | 15 +++++++++++++++
.../hudson/slaves/JNLPLauncher/main.jelly | 18 ++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/core/src/main/java/hudson/slaves/JNLPLauncher.java b/core/src/main/java/hudson/slaves/JNLPLauncher.java
index bed08613d814..808fdef1311c 100644
--- a/core/src/main/java/hudson/slaves/JNLPLauncher.java
+++ b/core/src/main/java/hudson/slaves/JNLPLauncher.java
@@ -221,4 +221,19 @@ public boolean filterType(@Nonnull Class> contextClass, @Nonnull Descriptor de
}
}
+ /**
+ * Returns true if Java Web Start button should be displayed.
+ * Java Web Start is only supported when the Jenkins server is
+ * running with Java 8. Earlier Java versions are not supported by Jenkins.
+ * Later Java versions do not support Java Web Start.
+ *
+ * This flag is checked in {@code config.jelly} before displaying the
+ * Java Web Start button.
+ * @return {@code true} if Java Web Start button should be displayed.
+ * @since FIXME
+ */
+ @Restricted(NoExternalUse.class) // Jelly use
+ public boolean isJavaWebStartSupported() {
+ return System.getProperty("java.version", "1.8").startsWith("1.8");
+ }
}
diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly b/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
index 606a52e932fe..8409784e851c 100644
--- a/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
+++ b/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
@@ -37,14 +37,16 @@ THE SOFTWARE.
${%Connect agent to Jenkins one of these ways:}