icedtea-web/SOURCES/headlessCheckSoftening_rhbz...

92 lines
4.5 KiB
Diff

diff -r b64b383a4561 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Mon May 14 17:11:41 2018 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Wed May 23 10:35:17 2018 +0200
@@ -19,6 +19,9 @@
import static net.sourceforge.jnlp.runtime.Translator.R;
import java.awt.EventQueue;
+import java.awt.GraphicsEnvironment;
+import static java.awt.GraphicsEnvironment.isHeadless;
+import java.awt.HeadlessException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -741,8 +744,10 @@
}
if (!headless) {
try {
- new JWindow().getOwner();
- } catch (Exception ex) {
+ if (GraphicsEnvironment.isHeadless()) {
+ throw new HeadlessException();
+ }
+ } catch (HeadlessException ex) {
headless = true;
OutputController.getLogger().log(ex);
OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, Translator.R("HEADLESS_MISSCONFIGURED"));
diff -r 0b0da6841278 -r 348532e210c0 netx/net/sourceforge/jnlp/config/Defaults.java
--- a/netx/net/sourceforge/jnlp/config/Defaults.java Mon May 28 12:01:56 2018 +0200
+++ b/netx/net/sourceforge/jnlp/config/Defaults.java Mon May 28 12:29:35 2018 +0200
@@ -412,6 +412,11 @@
BasicValueValidators.getRangedIntegerValidator(0, 10000),
String.valueOf(500)
},
+ {
+ DeploymentConfiguration.IGNORE_HEADLESS_CHECK,
+ BasicValueValidators.getBooleanValidator(),
+ String.valueOf(false)
+ },
//JVM arguments for plugin
{
DeploymentConfiguration.KEY_PLUGIN_JVM_ARGUMENTS,
diff -r 0b0da6841278 -r 348532e210c0 netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Mon May 28 12:01:56 2018 +0200
+++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Mon May 28 12:29:35 2018 +0200
@@ -222,6 +222,8 @@
public static final String KEY_BROWSER_PATH = "deployment.browser.path";
public static final String KEY_UPDATE_TIMEOUT = "deployment.javaws.update.timeout";
+
+ public static final String IGNORE_HEADLESS_CHECK = "deployment.headless.ignore";
/*
* JVM arguments for plugin
diff -r 0b0da6841278 -r 348532e210c0 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Mon May 28 12:01:56 2018 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Mon May 28 12:29:35 2018 +0200
@@ -739,18 +739,24 @@
//if (GraphicsEnvironment.isHeadless()) // jdk1.4+ only
// headless = true;
try {
- if ("true".equalsIgnoreCase(System.getProperty("java.awt.headless"))){
+ if ("true".equalsIgnoreCase(System.getProperty("java.awt.headless"))) {
headless = true;
}
if (!headless) {
- try {
- if (GraphicsEnvironment.isHeadless()) {
- throw new HeadlessException();
+ boolean noCheck = Boolean.valueOf(JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.IGNORE_HEADLESS_CHECK));
+ if (noCheck) {
+ headless = false;
+ OutputController.getLogger().log(DeploymentConfiguration.IGNORE_HEADLESS_CHECK + " set to " + noCheck + ". Avoding headless check.");
+ } else {
+ try {
+ if (GraphicsEnvironment.isHeadless()) {
+ throw new HeadlessException();
+ }
+ } catch (HeadlessException ex) {
+ headless = true;
+ OutputController.getLogger().log(ex);
+ OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, Translator.R("HEADLESS_MISSCONFIGURED"));
}
- } catch (HeadlessException ex) {
- headless = true;
- OutputController.getLogger().log(ex);
- OutputController.getLogger().log(OutputController.Level.MESSAGE_ALL, Translator.R("HEADLESS_MISSCONFIGURED"));
}
}
} catch (SecurityException ex) {