summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-10 11:04:50 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-10 11:04:50 +0200
commit1fe888810f558c13752b043e4721c838404a0f7f (patch)
tree4f606cace14ae3997a90e24bdd6f92a27f61683d /pdf-over-gui/src/main/java/at
parent362ef2282c3efa0a2a8b807218f61c77697c6367 (diff)
downloadpdf-over-1fe888810f558c13752b043e4721c838404a0f7f.tar.gz
pdf-over-1fe888810f558c13752b043e4721c838404a0f7f.tar.bz2
pdf-over-1fe888810f558c13752b043e4721c838404a0f7f.zip
add debug options for deliberately crashing
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java13
2 files changed, 16 insertions, 0 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
index 1f676951..703a9fad 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
@@ -279,6 +279,9 @@ public class ConfigurationComposite extends StateComposite {
* @param provider
*/
public void setConfigProvider(ConfigurationManager provider) {
+ if (provider.crashOnConfig) /* for testing initialization error handlers */
+ throw new RuntimeException("A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.\n(CRASH=config is set.)");
+
this.configProvider = provider;
if (this.configProvider != null) {
for (ConfigurationCompositeBase c : composites())
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
index eda1e59f..d8c8320c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java
@@ -69,6 +69,9 @@ public class ConfigurationManager {
// The configuration overlay built from the cmd line args
private ConfigurationDataInMemory configurationOverlay;
+ // whether the configuration screen should crash on startup (for debugging purposes)
+ public boolean crashOnConfig = false;
+
/**
* Constructor
*/
@@ -124,6 +127,16 @@ public class ConfigurationManager {
diskConfig.load(new FileInputStream(Constants.CONFIG_DIRECTORY + File.separator + getConfigurationFileName()));
+ { /* for testing of error handlers */
+ String crashProperty = diskConfig.getProperty("CRASH");
+ if ("startup".equalsIgnoreCase(crashProperty))
+ throw new RuntimeException("A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.\n(CRASH=startup is set.)");
+ else if ("config".equalsIgnoreCase(crashProperty))
+ this.crashOnConfig = true;
+ else if (crashProperty != null)
+ log.warn("Unknown value '{}' for CRASH property -- you want 'startup' or 'config'.", crashProperty);
+ }
+
setDefaultEmblemPersistent(diskConfig.getProperty(Constants.CFG_EMBLEM));
try {
String strProp = diskConfig.getProperty(Constants.CFG_LOGO_ONLY_SIZE);