summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-02-18 15:37:25 +0100
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-02-18 15:37:25 +0100
commit11398d864a32451ef76cd03fcbb262273e644041 (patch)
treea894c3c6ed72233f538361f93d50f142db2807fe /pdf-over-gui/src/main/java
parentb8295c8f0cf1131888f65a03b30307cd27a34c14 (diff)
downloadpdf-over-11398d864a32451ef76cd03fcbb262273e644041.tar.gz
pdf-over-11398d864a32451ef76cd03fcbb262273e644041.tar.bz2
pdf-over-11398d864a32451ef76cd03fcbb262273e644041.zip
properly load configured default BKU when positioning state is skipped (due to a detected signature placeholder), cf. #46
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java3
2 files changed, 6 insertions, 5 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
index af9e9d15..bed41f4a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
@@ -68,10 +68,12 @@ public class BKUSelectionState extends State {
@Override
public void run() {
Status status = getStateMachine().getStatus();
- if (!(status.getPreviousState() instanceof BKUSelectionState) &&
- !(status.getPreviousState() instanceof PositioningState)) {
+ State previousState = status.getPreviousState();
+ if (!(previousState instanceof OpenState) &&
+ !(previousState instanceof PositioningState) &&
+ !(previousState instanceof BKUSelectionState)) {
status.setBKU(BKUs.NONE);
- } else if((status.getPreviousState() instanceof PositioningState)) {
+ } else if(!(status.getPreviousState() instanceof BKUSelectionState)) {
ConfigProvider config = getStateMachine().getConfigProvider();
status.setBKU(config.getDefaultBKU());
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java
index 86d93daa..1b734b32 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java
@@ -207,7 +207,6 @@ public class OpenState extends State {
* The selected placeholder is added to the configuration file
* @param selection
*/
- @SuppressWarnings("static-method")
private void addPlaceholderSelectionToConfig(String selection) {
try {
PropertiesConfiguration config = new PropertiesConfiguration();
@@ -218,7 +217,7 @@ public class OpenState extends State {
layout.save(new FileWriter(advancedConfig, false));
} catch (Exception e) {
- log.error(e.getMessage(), e.getStackTrace());
+ log.error("Failed to add placeholder selection to config", e);
}
}