summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-06 13:26:53 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-06 13:26:53 +0200
commit7b2231cb46f1b43e5d92a15e16294b58985fef9d (patch)
tree86353753d1a45a98eb22b61e7e9d41ca202a01bb /pdf-over-gui
parent023e5398387cbe0869c1c47cb3f2914dfab623d3 (diff)
downloadpdf-over-7b2231cb46f1b43e5d92a15e16294b58985fef9d.tar.gz
pdf-over-7b2231cb46f1b43e5d92a15e16294b58985fef9d.tar.bz2
pdf-over-7b2231cb46f1b43e5d92a15e16294b58985fef9d.zip
more misc cleanup
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java16
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java26
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java2
4 files changed, 14 insertions, 34 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
index 6fb36488..3d0a199a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
@@ -80,8 +80,7 @@ public class MobileBKUConnector implements BkuSlConnector {
// Check if credentials are available, get them from user if not
this.state.checkCredentials();
- if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel"))
+ if ("cancel".equals(this.state.status.errorMessage))
throw new SignatureException(new IllegalStateException());
// Post credentials
@@ -129,8 +128,7 @@ public class MobileBKUConnector implements BkuSlConnector {
ATrustHandler aHandler = (ATrustHandler) handler;
if (aStatus.qrCodeURL != null) {
this.state.showQR();
- if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel"))
+ if ("cancel".equals(this.state.status.errorMessage))
throw new SignatureException(new IllegalStateException());
if (aStatus.qrCodeURL == null) {
try {
@@ -150,8 +148,7 @@ public class MobileBKUConnector implements BkuSlConnector {
try {
this.state.showFingerPrintInformation();
- if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel"))
+ if ("cancel".equals(this.state.status.errorMessage))
throw new SignatureException(new IllegalStateException());
} catch (Exception ex) {
log.error("Error in PostCredentialsThread", ex);
@@ -182,9 +179,7 @@ public class MobileBKUConnector implements BkuSlConnector {
// Get TAN
this.state.checkTAN();
-
- if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel"))
+ if ("cancel".equals(this.state.status.errorMessage))
throw new SignatureException(new IllegalStateException());
// Post TAN
@@ -212,8 +207,7 @@ public class MobileBKUConnector implements BkuSlConnector {
private boolean consumeCancelError() {
if (this.state.status instanceof ATrustStatus) {
- if (this.state.status.errorMessage != null &&
- this.state.status.errorMessage.equals("cancel")) {
+ if ("cancel".equals(this.state.status.errorMessage)) {
this.state.status.errorMessage = null;
return true;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java
index df64edf5..7fe71f1a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StatusImpl.java
@@ -75,10 +75,10 @@ public class StatusImpl implements Status {
//if (this.previousState == this.currentState)
// log.error("Changing to same state? " + this.currentState);
- if (this.previousState != null && !this.previousState.equals(currentState))
+ if (this.previousState != this.currentState)
{
//Reference to previous state will be lost - perform cleanup
- log.debug("Changing from " + this.currentState + " to " + currentState);
+ log.debug("Changing from " + this.currentState + " to " + currentState); //
log.debug("Cleaning up " + this.previousState);
this.previousState.cleanUp();
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
index f130c0e6..6ec4302d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
@@ -246,7 +246,7 @@ public class MobileBKUState extends State {
mobileStatus.mobilePassword = ui.getMobilePassword();
// show waiting composite
- getStateMachine().getGUIProvider().display(MobileBKUState.this.getWaitingComposite());
+ getStateMachine().getGUIProvider().display(this.getWaitingComposite());
});
}
@@ -335,8 +335,7 @@ public class MobileBKUState extends State {
qr.setErrorMessage(status.errorMessage);
InputStream qrcode = handler.getQRCode();
if (qrcode == null) {
- MobileBKUState.this.threadException = new Exception(
- Messages.getString("error.FailedToLoadQRCode"));
+ this.threadException = new Exception(Messages.getString("error.FailedToLoadQRCode"));
}
qr.setQR(qrcode);
getStateMachine().getGUIProvider().display(qr);
@@ -365,22 +364,10 @@ public class MobileBKUState extends State {
qr.setDone(false);
// show waiting composite
- getStateMachine().getGUIProvider().display(
- MobileBKUState.this.getWaitingComposite());
+ getStateMachine().getGUIProvider().display(this.getWaitingComposite());
});
}
-
- /**
- * This composite notifies the user to open the signature-app
- */
- public void showOpenAppMessage() {
- Display.getDefault().syncExec(() -> {
- getStateMachine().getGUIProvider().display(this.getWaitingForAppComposite());
- });
-
- }
-
/**
* This composite notifies the user to open the signature-app
*/
@@ -389,7 +376,7 @@ public class MobileBKUState extends State {
final ATrustStatus status = (ATrustStatus) this.status;
Display.getDefault().syncExec(() -> {
- WaitingForAppComposite waitingForAppcomposite = MobileBKUState.this.getWaitingForAppComposite();
+ WaitingForAppComposite waitingForAppcomposite = this.getWaitingForAppComposite();
getStateMachine().getGUIProvider().display(waitingForAppcomposite);
Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
@@ -415,7 +402,7 @@ public class MobileBKUState extends State {
status.errorMessage = "sms";
status.isSMSTan = true;
// show waiting composite
- getStateMachine().getGUIProvider().display(MobileBKUState.this.getWaitingComposite());
+ getStateMachine().getGUIProvider().display(this.getWaitingComposite());
return;
}
@@ -513,8 +500,7 @@ public class MobileBKUState extends State {
fingerprintComposite.setDone(false);
// show waiting composite
- getStateMachine().getGUIProvider().display(
- MobileBKUState.this.getWaitingComposite());
+ getStateMachine().getGUIProvider().display(this.getWaitingComposite());
});
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
index 3bc67d65..afb12333 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
@@ -98,7 +98,7 @@ public class SigningState extends State {
if (status.getPreviousState() instanceof MobileBKUState)
{
String mobileBkuError = ((MobileBKUState)status.getPreviousState()).status.errorMessage;
- if ((mobileBkuError != null) && mobileBkuError.equals("cancel"))
+ if ("cancel".equals(mobileBkuError))
this.threadException = new SignatureException(new IllegalStateException());
}