diff options
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states')
12 files changed, 199 insertions, 199 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 8cca67a0..006b1ed9 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 @@ -47,7 +47,7 @@ public class BKUSelectionState extends State { **/ @SuppressWarnings("unused") private static final Logger log = LoggerFactory.getLogger(BKUSelectionState.class); - + private BKUSelectionComposite selectionComposite = null; private BKUSelectionComposite getSelectionComposite() { @@ -64,7 +64,7 @@ public class BKUSelectionState extends State { return this.selectionComposite; } - + @Override public void run() { Status status = getStateMachine().getStatus(); @@ -85,13 +85,13 @@ public class BKUSelectionState extends State { getStateMachine().getGUIProvider().display(selection); selection.layout(); - + status.setBKU(selection.getSelected()); - + if(status.getBKU() == BKUs.NONE) { return; } - } + } this.setNextState(new PrepareSigningState(getStateMachine())); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java index 2d839bc0..d8ee2c63 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java @@ -27,7 +27,7 @@ import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; /** - * + * */ public class ConfigurationUIState extends State { /** @@ -37,8 +37,8 @@ public class ConfigurationUIState extends State { private static final Logger log = LoggerFactory .getLogger(ConfigurationUIState.class); - - + + private ConfigurationComposite configurationComposite = null; private ConfigurationComposite getConfigurationComposite() { @@ -52,7 +52,7 @@ public class ConfigurationUIState extends State { return this.configurationComposite; } - + /** * @param stateMachine */ @@ -69,7 +69,7 @@ public class ConfigurationUIState extends State { Status status = getStateMachine().getStatus(); ConfigurationComposite config = this.getConfigurationComposite(); - + getStateMachine().getGUIProvider().display(config); if(config.isUserDone()) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java index c2a5f039..86d8f32f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java @@ -54,7 +54,7 @@ public class KSState extends State { /* * (non-Javadoc) - * + * * @see * at.asit.pdfover.gui.workflow.WorkflowState#update(at.asit.pdfover.gui * .workflow.Workflow) @@ -70,10 +70,10 @@ public class KSState extends State { String file = config.getKeyStoreFile(); File f = new File(file); if (!f.isFile()) { - log.error("Keystore not found"); //$NON-NLS-1$ + log.error("Keystore not found"); // ErrorDialog dialog = new ErrorDialog( getStateMachine().getGUIProvider().getMainShell(), - String.format(Messages.getString("error.KeyStoreFileNotExist"), f.getName()), //$NON-NLS-1$ + String.format(Messages.getString("error.KeyStoreFileNotExist"), f.getName()), // BUTTONS.RETRY_CANCEL); if (dialog.open() != SWT.RETRY) { //getStateMachine().exit(); @@ -88,25 +88,25 @@ public class KSState extends State { if (storePass.isEmpty()) { PasswordInputDialog pwd = new PasswordInputDialog( getStateMachine().getGUIProvider().getMainShell(), - Messages.getString("keystore_config.KeystoreStorePass"), //$NON-NLS-1$ - Messages.getString("keystore.KeystoreStorePassEntry")); //$NON-NLS-1$ + Messages.getString("keystore_config.KeystoreStorePass"), // + Messages.getString("keystore.KeystoreStorePassEntry")); // storePass = pwd.open(); } String keyPass = config.getKeyStoreKeyPass(); if (keyPass.isEmpty()) { PasswordInputDialog pwd = new PasswordInputDialog( getStateMachine().getGUIProvider().getMainShell(), - Messages.getString("keystore_config.KeystoreKeyPass"), //$NON-NLS-1$ - Messages.getString("keystore.KeystoreKeyPassEntry")); //$NON-NLS-1$ + Messages.getString("keystore_config.KeystoreKeyPass"), // + Messages.getString("keystore.KeystoreKeyPassEntry")); // keyPass = pwd.open(); } String type = config.getKeyStoreType(); signingState.setKSSigner(file, alias, storePass, keyPass, type); } catch (SignatureException e) { - log.error("Error loading keystore", e); //$NON-NLS-1$ + log.error("Error loading keystore", e); // ErrorDialog dialog = new ErrorDialog( getStateMachine().getGUIProvider().getMainShell(), - Messages.getString("error.KeyStore"), //$NON-NLS-1$ + Messages.getString("error.KeyStore"), // BUTTONS.RETRY_CANCEL); if (dialog.open() != SWT.RETRY) { //getStateMachine().exit(); @@ -123,7 +123,7 @@ public class KSState extends State { /* * (non-Javadoc) - * + * * @see at.asit.pdfover.gui.workflow.states.State#cleanUp() */ @Override @@ -133,7 +133,7 @@ public class KSState extends State { /* * (non-Javadoc) - * + * * @see at.asit.pdfover.gui.workflow.states.State#setMainWindowBehavior() */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java index c0baabbf..ed6ee411 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java @@ -51,17 +51,17 @@ public class LocalBKUState extends State { /** * HTTP Response server HEADER */ - public final static String BKU_RESPONSE_HEADER_SERVER = "server"; //$NON-NLS-1$ + public final static String BKU_RESPONSE_HEADER_SERVER = "server"; // /** * HTTP Response user-agent HEADER */ - public final static String BKU_RESPONSE_HEADER_USERAGENT = "user-agent"; //$NON-NLS-1$ + public final static String BKU_RESPONSE_HEADER_USERAGENT = "user-agent"; // /** * HTTP Response SignatureLayout HEADER */ - public final static String BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; //$NON-NLS-1$ + public final static String BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; // Exception threadException = null; @@ -71,8 +71,8 @@ public class LocalBKUState extends State { /** * Null-Operation SL-Request */ - private final static String NULL_OPERATION_REQUEST = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + //$NON-NLS-1$ - "<sl:NullOperationRequest xmlns:sl=\"http://www.buergerkarte.at/namespaces/securitylayer/1.2#\"/>"; //$NON-NLS-1$ + private final static String NULL_OPERATION_REQUEST = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + // + "<sl:NullOperationRequest xmlns:sl=\"http://www.buergerkarte.at/namespaces/securitylayer/1.2#\"/>"; // /** * Constructor @@ -83,14 +83,14 @@ public class LocalBKUState extends State { } /** - * + * */ private final class SignLocalBKUThread implements Runnable { private LocalBKUState state; private SigningState signingState; - + /** * @param localBKUState * @param signingState @@ -109,7 +109,7 @@ public class LocalBKUState extends State { PostMethod method = new PostMethod(Constants.LOCAL_BKU_URL); String sl_request = NULL_OPERATION_REQUEST; - method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$ + method.addParameter("XMLRequest", sl_request); // int returnCode = client.executeMethod(method); String userAgent = getResponseHeader(method, BKU_RESPONSE_HEADER_USERAGENT); @@ -121,27 +121,27 @@ public class LocalBKUState extends State { } else { server = getResponseHeader(method, BKU_RESPONSE_HEADER_SERVER); if (server == null) - server = ""; //$NON-NLS-1$ + server = ""; // else - if (server.contains("trustDeskbasic") || server.contains("asignSecurityLayer")) //$NON-NLS-1$ //$NON-NLS-2$ + if (server.contains("trustDeskbasic") || server.contains("asignSecurityLayer")) // // LocalBKUState.this.useBase64Request = true; userAgent = getResponseHeader(method, BKU_RESPONSE_HEADER_USERAGENT); if (userAgent == null) - userAgent = ""; //$NON-NLS-1$ + userAgent = ""; // String signatureLayout = getResponseHeader(method, BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT); - log.debug("Server - UA: " + server + " - " + userAgent); //$NON-NLS-1$ //$NON-NLS-2$ + log.debug("Server - UA: " + server + " - " + userAgent); // // String response = method.getResponseBodyAsString(); - log.debug("SL Response: " + response); //$NON-NLS-1$ + log.debug("SL Response: " + response); // SLResponse slResponse = new SLResponse(response, server, userAgent, signatureLayout); this.signingState.setSignatureResponse(slResponse); this.signingState.setUseBase64Request(LocalBKUState.this.useBase64Request); } } catch (Exception e) { - log.error("SignLocalBKUThread: ", e); //$NON-NLS-1$ + log.error("SignLocalBKUThread: ", e); // this.state.threadException = e; } finally { @@ -164,7 +164,7 @@ public class LocalBKUState extends State { /* * (non-Javadoc) - * + * * @see * at.asit.pdfover.gui.workflow.WorkflowState#update(at.asit.pdfover.gui * .workflow.Workflow) @@ -186,7 +186,7 @@ public class LocalBKUState extends State { if (this.threadException != null) { ErrorDialog dialog = new ErrorDialog( getStateMachine().getGUIProvider().getMainShell(), - Messages.getString("error.LocalBKU"), //$NON-NLS-1$ + Messages.getString("error.LocalBKU"), // BUTTONS.RETRY_CANCEL); if (dialog.open() != SWT.RETRY) { //getStateMachine().exit(); @@ -204,7 +204,7 @@ public class LocalBKUState extends State { /* * (non-Javadoc) - * + * * @see at.asit.pdfover.gui.workflow.states.State#cleanUp() */ @Override @@ -214,7 +214,7 @@ public class LocalBKUState extends State { /* * (non-Javadoc) - * + * * @see at.asit.pdfover.gui.workflow.states.State#setMainWindowBehavior() */ @Override 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 a838c635..86266b13 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 @@ -75,15 +75,15 @@ public class MobileBKUState extends State { this.status = new IAIKStatus(provider);
this.handler = new IAIKHandler(this, stateMachine.getGUIProvider().getMainShell());
break;
-
+
default:
throw new RuntimeException("Unexpected mobileBKUType");
}
}
MobileBKUEnterTANComposite mobileBKUEnterTANComposite = null;
-
- WaitingForAppComposite waitingForAppComposite = null;
+
+ WaitingForAppComposite waitingForAppComposite = null;
WaitingForAppComposite getWaitingForAppComposite() {
if (this.waitingForAppComposite == null) {
this.waitingForAppComposite = getStateMachine().getGUIProvider()
@@ -92,7 +92,7 @@ public class MobileBKUState extends State { return this.waitingForAppComposite;
}
-
+
WaitingComposite waitingComposite = null;
WaitingComposite getWaitingComposite() {
if (this.waitingComposite == null) {
@@ -159,22 +159,22 @@ public class MobileBKUState extends State { /**
* Display an error message
- *
+ *
* @param e
* the exception
*/
public void displayError(Exception e) {
- String message = Messages.getString("error.Unexpected"); //$NON-NLS-1$
+ String message = Messages.getString("error.Unexpected"); //
log.error(message, e);
String errormsg = e.getLocalizedMessage();
if (errormsg != null && !errormsg.isEmpty())
- message += ": " + errormsg; //$NON-NLS-1$
+ message += ": " + errormsg; //
displayError(message);
}
/**
* Display an error message
- *
+ *
* @param message
* the error message
*/
@@ -205,7 +205,7 @@ public class MobileBKUState extends State { public void run() {
MobileBKUEnterNumberComposite ui = MobileBKUState.this
.getMobileBKUEnterNumberComposite();
-
+
if (!ui.userAck) {
// We need number and password => show UI!
if (mobileStatus.errorMessage != null
@@ -214,7 +214,7 @@ public class MobileBKUState extends State { ui.setErrorMessage(mobileStatus.errorMessage);
mobileStatus.errorMessage = null;
} else if (mobileStatus instanceof ATrustStatus) {
- ui.setErrorMessage(Messages.getString("mobileBKU.aTrustDisclaimer")); //$NON-NLS-1$
+ ui.setErrorMessage(Messages.getString("mobileBKU.aTrustDisclaimer")); //
}
if (ui.getMobileNumber() == null
@@ -231,7 +231,7 @@ public class MobileBKUState extends State { ui.enableButton();
getStateMachine().getGUIProvider().display(ui);
- Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
+ Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
while (!ui.userAck && !ui.userCancel) {
if (!display.readAndDispatch()) {
display.sleep();
@@ -241,7 +241,7 @@ public class MobileBKUState extends State { if (ui.userCancel) {
ui.userCancel = false;
- mobileStatus.errorMessage = "cancel"; //$NON-NLS-1$
+ mobileStatus.errorMessage = "cancel"; //
return;
}
@@ -270,7 +270,7 @@ public class MobileBKUState extends State { public void run() {
MobileBKUEnterTANComposite tan = MobileBKUState.this
.getMobileBKUEnterTANComposite();
-
+
if (!tan.isUserAck()) {
// we need the TAN
tan.setRefVal(mobileStatus.refVal);
@@ -280,13 +280,13 @@ public class MobileBKUState extends State { && mobileStatus.tanTries > 0) {
// show warning message x tries left!
// overrides error message
-
+
tan.setTries(mobileStatus.tanTries);
}
tan.enableButton();
getStateMachine().getGUIProvider().display(tan);
- Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
+ Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
while (!tan.isUserAck() && !tan.isUserCancel()) {
if (!display.readAndDispatch()) {
display.sleep();
@@ -321,14 +321,14 @@ public class MobileBKUState extends State { final Timer checkDone = new Timer();
checkDone.scheduleAtFixedRate(new TimerTask() {
-
+
@Override
public void run() {
// ping signature page to see if code has been scanned
try {
String resp = handler.getSignaturePage();
if (handler.handleQRResponse(resp)) {
- log.debug("Signature page response: " + resp); //$NON-NLS-1$
+ log.debug("Signature page response: " + resp); //
getMobileBKUQRComposite().setDone(true);
Display display = getStateMachine().getGUIProvider().
getMainShell().getDisplay();
@@ -337,7 +337,7 @@ public class MobileBKUState extends State { }
Display.getDefault().wake();
} catch (Exception e) {
- log.error("Error getting signature page", e); //$NON-NLS-1$
+ log.error("Error getting signature page", e); //
}
}
}, 0, 5000);
@@ -351,7 +351,7 @@ public class MobileBKUState extends State { InputStream qrcode = handler.getQRCode();
if (qrcode == null) {
MobileBKUState.this.threadException = new Exception(
- Messages.getString("error.FailedToLoadQRCode")); //$NON-NLS-1$
+ Messages.getString("error.FailedToLoadQRCode")); //
}
qr.setQR(qrcode);
getStateMachine().getGUIProvider().display(qr);
@@ -396,9 +396,9 @@ public class MobileBKUState extends State { getStateMachine().getGUIProvider().display(MobileBKUState.this.getWaitingForAppComposite());
}
});
-
+
}
-
+
/**
* This composite notifies the user to open the signature-app
*/
@@ -472,8 +472,8 @@ public class MobileBKUState extends State { }
/**
- * when fingerprint or faceid is selected in the app
- * this information is shown
+ * when fingerprint or faceid is selected in the app
+ * this information is shown
*/
public void showFingerPrintInformation() {
final ATrustStatus status = (ATrustStatus) this.status;
@@ -481,14 +481,14 @@ public class MobileBKUState extends State { Timer checkDone = new Timer();
checkDone.scheduleAtFixedRate(new TimerTask() {
-
+
@Override
public void run() {
// ping signature page to see if code has been scanned
try {
String resp = handler.getSignaturePage();
if (handler.handleQRResponse(resp)) {
- log.debug("Signature page response: " + resp); //$NON-NLS-1$
+ log.debug("Signature page response: " + resp); //
getMobileBKUFingerprintComposite().setDone(true);
Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
display.wake();
@@ -496,7 +496,7 @@ public class MobileBKUState extends State { }
Display.getDefault().wake();
} catch (Exception e) {
- log.error("Error getting signature page", e); //$NON-NLS-1$
+ log.error("Error getting signature page", e); //
}
}
}, 0, 5000);
@@ -539,14 +539,14 @@ public class MobileBKUState extends State { /**
* @return a boolean true if the user has pressed the sms tan button
*/
- public boolean getSMSStatus() {
-
- return this.getMobileBKUFingerprintComposite().isUserSMS();
+ public boolean getSMSStatus() {
+
+ return this.getMobileBKUFingerprintComposite().isUserSMS();
}
/*
* (non-Javadoc)
- *
+ *
* @see
* at.asit.pdfover.gui.workflow.WorkflowState#update(at.asit.pdfover.gui
* .workflow.Workflow)
@@ -556,15 +556,15 @@ public class MobileBKUState extends State { this.signingState = getStateMachine().getStatus().getSigningState();
this.signingState.setBKUConnector(new MobileBKUConnector(this));
- log.debug("Setting base64 request to " + this.handler.useBase64Request()); //$NON-NLS-1$
+ log.debug("Setting base64 request to " + this.handler.useBase64Request()); //
this.signingState.setUseBase64Request(this.handler.useBase64Request());
if (this.threadException != null) {
- String message = Messages.getString("error.Unexpected"); //$NON-NLS-1$
+ String message = Messages.getString("error.Unexpected"); //
log.error(message, this.threadException);
String errormsg = this.threadException.getLocalizedMessage();
if (errormsg != null && !errormsg.isEmpty())
- message += ": " + errormsg; //$NON-NLS-1$
+ message += ": " + errormsg; //
ErrorDialog error = new ErrorDialog(
getStateMachine().getGUIProvider().getMainShell(),
message, BUTTONS.OK);
@@ -583,7 +583,7 @@ public class MobileBKUState extends State { /*
* (non-Javadoc)
- *
+ *
* @see at.asit.pdfover.gui.workflow.states.State#cleanUp()
*/
@Override
@@ -600,7 +600,7 @@ public class MobileBKUState extends State { /*
* (non-Javadoc)
- *
+ *
* @see at.asit.pdfover.gui.workflow.states.State#setMainWindowBehavior()
*/
@Override
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 9fca3d2c..78b9db3c 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 @@ -67,8 +67,8 @@ public class OpenState extends State { **/ private static final Logger log = LoggerFactory .getLogger(OpenState.class); - private static final String advancedConfig = Constants.CONFIG_DIRECTORY + File.separator + "/cfg/advancedconfig.properties"; //$NON-NLS-1$ - + private static final String advancedConfig = Constants.CONFIG_DIRECTORY + File.separator + "/cfg/advancedconfig.properties"; // + private DataSourceSelectComposite selectionComposite = null; private DataSourceSelectComposite getSelectionComposite() { @@ -106,7 +106,7 @@ public class OpenState extends State { return; } } - log.debug("Got Datasource: " + getStateMachine().getStatus().getDocument().getAbsolutePath()); //$NON-NLS-1$ + log.debug("Got Datasource: " + getStateMachine().getStatus().getDocument().getAbsolutePath()); // // scan for signature placeholders // - see if we want to scan for placeholders in the settings @@ -116,7 +116,7 @@ public class OpenState extends State { boolean useSignatureFields = config.getUseSignatureFields(); boolean useMarker = config.getUseMarker(); log.debug("Placeholder usage enabled. Signature fields: {}, QR Markers: {}", useSignatureFields, useMarker); - //first check the signature fields placeholder + //first check the signature fields placeholder if (useSignatureFields) { List<String> fields = SignatureFieldsAndPlaceHolderExtractor.findEmptySignatureFields(pddocument); @@ -128,23 +128,23 @@ public class OpenState extends State { // icon MessageBox dialog = new MessageBox(getStateMachine().getGUIProvider().getMainShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL); - dialog.setText(Messages.getString("dataSourceSelection.usePlaceholderTitle")); //$NON-NLS-1$ - dialog.setMessage(Messages.getString("dataSourceSelection.usePlaceholderText")); //$NON-NLS-1$ + dialog.setText(Messages.getString("dataSourceSelection.usePlaceholderTitle")); // + dialog.setMessage(Messages.getString("dataSourceSelection.usePlaceholderText")); // // open dialog and await user selection int result = dialog.open(); if (result == SWT.YES) { - + if (fields.size() == 1) { addPlaceholderSelectionToConfig(fields.get(0)); this.setNextState(new BKUSelectionState(getStateMachine())); return; - + } else if (fields.size() > 1) { PlaceholderSelectionGui gui = new PlaceholderSelectionGui( - getStateMachine().getGUIProvider().getMainShell(), 65570, "text", //$NON-NLS-1$ - "select the fields", fields); //$NON-NLS-1$ + getStateMachine().getGUIProvider().getMainShell(), 65570, "text", // + "select the fields", fields); // int res = gui.open(); if (res != -1) { getStateMachine().getStatus().setSearchForPlaceholderSignature(true); @@ -174,8 +174,8 @@ public class OpenState extends State { // create a dialog with ok and cancel buttons and a question icon MessageBox dialog = new MessageBox(getStateMachine().getGUIProvider().getMainShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL); - dialog.setText(Messages.getString("dataSourceSelection.usePlaceholderTitle")); //$NON-NLS-1$ - dialog.setMessage(Messages.getString("dataSourceSelection.usePlaceholderText")); //$NON-NLS-1$ + dialog.setText(Messages.getString("dataSourceSelection.usePlaceholderTitle")); // + dialog.setMessage(Messages.getString("dataSourceSelection.usePlaceholderText")); // // open dialog and await user selection int result = dialog.open(); @@ -212,7 +212,7 @@ public class OpenState extends State { // proceed with the usual process. } } - + this.setNextState(new PositioningState(getStateMachine())); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index d20d5268..89b7d346 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -48,16 +48,16 @@ public class OutputState extends State { if (this.outputComposite == null) { this.outputComposite = getStateMachine().getGUIProvider() .createComposite(OutputComposite.class, SWT.RESIZE, this); - + ConfigProvider config = getStateMachine().getConfigProvider(); Status status = getStateMachine().getStatus(); - - File tmpDir = new File(config.getConfigurationDirectory() + File.separator + "tmp"); //$NON-NLS-1$ - + + File tmpDir = new File(config.getConfigurationDirectory() + File.separator + "tmp"); // + if(!tmpDir.exists()) { tmpDir.mkdir(); } - + this.outputComposite.setOutputDir(config.getDefaultOutputFolder()); this.outputComposite.setSaveFilePostFix(config.getSaveFilePostFix()); this.outputComposite.setTempDir(tmpDir.getAbsolutePath()); @@ -83,7 +83,7 @@ public class OutputState extends State { if (status.getSignResult() == null) { ErrorDialog error = new ErrorDialog(getStateMachine().getGUIProvider().getMainShell(), - Messages.getString("error.Signatur"), BUTTONS.RETRY_CANCEL); //$NON-NLS-1$ + Messages.getString("error.Signatur"), BUTTONS.RETRY_CANCEL); // if(error.open() == SWT.RETRY) { this.setNextState(new PrepareSigningState(getStateMachine())); } else { @@ -100,21 +100,21 @@ public class OutputState extends State { /* * (non-Javadoc) - * + * * @see at.asit.pdfover.gui.workflow.states.State#cleanUp() */ @Override public void cleanUp() { - + getStateMachine().getStatus().setSignResult(null); - + if (this.outputComposite != null) this.outputComposite.dispose(); } /* * (non-Javadoc) - * + * * @see at.asit.pdfover.gui.workflow.states.State#setMainWindowBehavior() */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 6aec43fe..df157774 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -71,7 +71,7 @@ public class PositioningState extends State { private PDFFile document = null; private void closePDFDocument() { - + if (this.document != null) { this.document = null; @@ -102,7 +102,7 @@ public class PositioningState extends State { } catch (IOException e) { if (e.getCause() instanceof UnsupportedEncryptionException) - throw new IOException(Messages.getString("error.PDFProtected")); + throw new IOException(Messages.getString("error.PDFProtected")); else throw new IOException(Messages.getString("error.MayNotBeAPDF"), e); } @@ -124,7 +124,7 @@ public class PositioningState extends State { Emblem emblem = new CachedFileNameEmblem(config.getDefaultEmblem()); param.setEmblem(emblem); if(config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) { - param.setProperty("SIG_NOTE", config.getSignatureNote()); //$NON-NLS-1$ + param.setProperty("SIG_NOTE", config.getSignatureNote()); // } param.setSignatureLanguage(config.getSignatureLocale().getLanguage()); @@ -140,7 +140,7 @@ public class PositioningState extends State { this.previousPosition.getX(), this.previousPosition.getY(), this.previousPosition.getPage()); - + return this.positionComposite; } @@ -156,15 +156,15 @@ public class PositioningState extends State { if ((this.document == null) || (this.loadedDocumentPath != getStateMachine().getStatus().getDocument())) { - log.debug("Checking PDF document for encryption"); //$NON-NLS-1$ + log.debug("Checking PDF document for encryption"); // try { openPDFDocument(); - } catch (IOException e) { + } catch (IOException e) { this.positionComposite = null; - log.error("Failed to display PDF document", e); //$NON-NLS-1$ + log.error("Failed to display PDF document", e); // String message = e.getLocalizedMessage(); if (message == null) - message = Messages.getString("error.IOError"); //$NON-NLS-1$ + message = Messages.getString("error.IOError"); // ErrorDialog dialog = new ErrorDialog( getStateMachine().getGUIProvider().getMainShell(), message, BUTTONS.RETRY_CANCEL); @@ -182,10 +182,10 @@ public class PositioningState extends State { try { position = this.getPositioningComposite(this.document); } catch(Exception ex) { - log.error("Failed to create composite (probably a mac...)", ex); //$NON-NLS-1$ + log.error("Failed to create composite (probably a mac...)", ex); // ErrorDialog dialog = new ErrorDialog( getStateMachine().getGUIProvider().getMainShell(), - Messages.getString("error.PositioningNotPossible"), BUTTONS.OK); //$NON-NLS-1$ + Messages.getString("error.PositioningNotPossible"), BUTTONS.OK); // dialog.open(); status.setSignaturePosition(new SignaturePosition()); this.setNextState(new BKUSelectionState(getStateMachine())); @@ -193,13 +193,13 @@ public class PositioningState extends State { } getStateMachine().getGUIProvider().display(position); - + status.setSignaturePosition(position.getPosition()); - + if(status.getSignaturePosition() != null) { this.setNextState(new BKUSelectionState(getStateMachine())); } - + this.positionComposite.requestFocus(); } else { this.setNextState(new BKUSelectionState(getStateMachine())); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index 21343b5b..d653a07f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -114,7 +114,7 @@ public class PrepareConfigurationState extends State { new FileInputStream( getStateMachine().getConfigProvider().getConfigurationDirectory() + FILE_SEPARATOR + filename)); - log.info("Loaded config from file : " + filename); //$NON-NLS-1$ + log.info("Loaded config from file : " + filename); // } catch (FileNotFoundException ex) { if (filename.equals(Constants.DEFAULT_CONFIG_FILENAME)) { // we only check for resource config file if it is the @@ -125,7 +125,7 @@ public class PrepareConfigurationState extends State { getStateMachine().getConfigProvider() .loadConfiguration(is); - log.info("Loaded config from resource : " + filename); //$NON-NLS-1$ + log.info("Loaded config from resource : " + filename); // } catch (Exception eex) { throw ex; } @@ -136,7 +136,7 @@ public class PrepareConfigurationState extends State { } catch (IOException ex) { throw new InitializationException( - "Failed to read configuration from config file", ex); //$NON-NLS-1$ + "Failed to read configuration from config file", ex); // } } @@ -150,7 +150,7 @@ public class PrepareConfigurationState extends State { String note = config.getSignatureNote(); Locale loc = config.getSignatureLocale(); - String note_old = Messages.getString("simple_config.Note_Default_Old", loc); //$NON-NLS-1$ + String note_old = Messages.getString("simple_config.Note_Default_Old", loc); // if (note.equals(note_old)) resetSignatureNoteField(config); } @@ -189,9 +189,9 @@ public class PrepareConfigurationState extends State { } } catch (Exception e) { log.error( - "Failed to write PDF Over config file to config directory", e); //$NON-NLS-1$ + "Failed to write PDF Over config file to config directory", e); // throw new InitializationException( - "Failed to write PDF Over config file to config directory", //$NON-NLS-1$ + "Failed to write PDF Over config file to config directory", // e); } finally { if (pdfOverConfig != null) { @@ -199,7 +199,7 @@ public class PrepareConfigurationState extends State { pdfOverConfig.close(); } catch (IOException e) { log.warn( - "Failed to close File stream for PDFOver config", e); //$NON-NLS-1$ + "Failed to close File stream for PDFOver config", e); // } } @@ -208,7 +208,7 @@ public class PrepareConfigurationState extends State { inputStream.close(); } catch (IOException e) { log.warn( - "Failed to close Resource stream for PDFOver config", e); //$NON-NLS-1$ + "Failed to close Resource stream for PDFOver config", e); // } } } @@ -229,17 +229,17 @@ public class PrepareConfigurationState extends State { String filename = getStateMachine().getConfigProvider().getConfigurationDirectory() + FILE_SEPARATOR + Constants.DEFAULT_LOG4J_FILENAME; pdfOverConfig = new FileOutputStream(filename); - + while ((byteCount = inputStream.read(buffer)) >= 0) { pdfOverConfig.write(buffer, 0, byteCount); } - + PropertyConfigurator.configureAndWatch(filename); } catch (Exception e) { log.error( - "Failed to write log4j config file to config directory", e); //$NON-NLS-1$ + "Failed to write log4j config file to config directory", e); // throw new InitializationException( - "Failed to write log4j config file to config directory", //$NON-NLS-1$ + "Failed to write log4j config file to config directory", // e); } finally { if (pdfOverConfig != null) { @@ -247,16 +247,16 @@ public class PrepareConfigurationState extends State { pdfOverConfig.close(); } catch (IOException e) { log.warn( - "Failed to close File stream for log4j config", e); //$NON-NLS-1$ + "Failed to close File stream for log4j config", e); // } } - + if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { log.warn( - "Failed to close Resource stream for log4j config", e); //$NON-NLS-1$ + "Failed to close Resource stream for log4j config", e); // } } }*/ @@ -269,9 +269,9 @@ public class PrepareConfigurationState extends State { Zipper.unzip(is, configDir.getAbsolutePath()); } catch (IOException e) { log.error( - "Failed to create local configuration directory!", e); //$NON-NLS-1$ + "Failed to create local configuration directory!", e); // throw new InitializationException( - "Failed to create local configuration directory!", //$NON-NLS-1$ + "Failed to create local configuration directory!", // e); } } @@ -280,14 +280,14 @@ public class PrepareConfigurationState extends State { File versionFile = new File(configDir, Constants.CONFIG_VERSION_FILENAME); try { BufferedWriter versionWriter = new BufferedWriter(new FileWriter(versionFile)); - String version = Constants.APP_VERSION == null ? "Unknown" : Constants.APP_VERSION; //$NON-NLS-1$ + String version = Constants.APP_VERSION == null ? "Unknown" : Constants.APP_VERSION; // versionWriter.write(version); versionWriter.close(); } catch (IOException e) { log.error( - "Failed to create configuration version file!", e); //$NON-NLS-1$ + "Failed to create configuration version file!", e); // throw new InitializationException( - "Failed to create configuration version file!", //$NON-NLS-1$ + "Failed to create configuration version file!", // e); } } @@ -295,16 +295,16 @@ public class PrepareConfigurationState extends State { private void initializeConfig() throws InitializationException { initializeFromConfigurationFile(getStateMachine() .getConfigProvider().getConfigurationFile()); - + resetSignatureNoteField(getStateMachine().getConfigProvider()); - + try { getStateMachine().getConfigManipulator().saveCurrentConfiguration(); } catch (IOException e) { log.error( - "Failed to set local configuration signature note!", e); //$NON-NLS-1$ + "Failed to set local configuration signature note!", e); // throw new InitializationException( - "Failed to set local configuration signature note!", //$NON-NLS-1$ + "Failed to set local configuration signature note!", // e); } } @@ -312,7 +312,7 @@ public class PrepareConfigurationState extends State { private void createConfiguration(File configDir) throws InitializationException { boolean allOK = false; - log.info("Creating configuration directory"); //$NON-NLS-1$ + log.info("Creating configuration directory"); // if (!configDir.exists()) { configDir.mkdir(); } @@ -345,14 +345,14 @@ public class PrepareConfigurationState extends State { String version; while ((version = versionReader.readLine()) != null) { version = version.trim(); - if (version.length() > 0 && !version.startsWith("#")) { //$NON-NLS-1$ - log.trace("configuration version from " + versionFile //$NON-NLS-1$ - + ": " + version); //$NON-NLS-1$ + if (version.length() > 0 && !version.startsWith("#")) { // + log.trace("configuration version from " + versionFile // + + ": " + version); // return version; } } } catch (IOException ex) { - log.error("failed to read configuration version from " //$NON-NLS-1$ + log.error("failed to read configuration version from " // + versionFile, ex); } finally { try { @@ -362,7 +362,7 @@ public class PrepareConfigurationState extends State { } } } - log.debug("unknown configuration version"); //$NON-NLS-1$ + log.debug("unknown configuration version"); // return null; } @@ -373,24 +373,24 @@ public class PrepareConfigurationState extends State { */ private void backupAndCreatePdfAsConfiguration(File configDir) throws InitializationException { try { - File backup = File.createTempFile(Constants.PDF_AS_CONFIG_BACKUP_FILENAME, ".zip"); //$NON-NLS-1$ + File backup = File.createTempFile(Constants.PDF_AS_CONFIG_BACKUP_FILENAME, ".zip"); // OutputStream os = new FileOutputStream(backup); - Zipper.zip(configDir + FILE_SEPARATOR + "cfg", os, true); //$NON-NLS-1$ + Zipper.zip(configDir + FILE_SEPARATOR + "cfg", os, true); // os.close(); unzipPdfAsConfig(configDir); - File b = new File(configDir, Constants.PDF_AS_CONFIG_BACKUP_FILENAME + ".zip"); //$NON-NLS-1$ + File b = new File(configDir, Constants.PDF_AS_CONFIG_BACKUP_FILENAME + ".zip"); // int i = 1; while (b.exists()) { - b = new File(configDir, Constants.PDF_AS_CONFIG_BACKUP_FILENAME + i++ + ".zip"); //$NON-NLS-1$ + b = new File(configDir, Constants.PDF_AS_CONFIG_BACKUP_FILENAME + i++ + ".zip"); // } backup.renameTo(b); updateVersionFile(configDir); } catch (FileNotFoundException e) { - log.error("Backup file not found", e); //$NON-NLS-1$ - throw new InitializationException("Backup file not found", e); //$NON-NLS-1$ + log.error("Backup file not found", e); // + throw new InitializationException("Backup file not found", e); // } catch (IOException e) { - log.error("Error creating configuration backup", e); //$NON-NLS-1$ - throw new InitializationException("Error creating configuration backup", e); //$NON-NLS-1$ + log.error("Error creating configuration backup", e); // + throw new InitializationException("Error creating configuration backup", e); // } } @@ -405,10 +405,10 @@ public class PrepareConfigurationState extends State { File configDir = new File(cDir); File configFile = new File(configDir, Constants.DEFAULT_CONFIG_FILENAME); if (!configDir.exists() || !configFile.exists()) { - log.debug("Creating configuration file"); //$NON-NLS-1$ + log.debug("Creating configuration file"); // createConfiguration(configDir); } else { - log.debug("Configuration directory exists!"); //$NON-NLS-1$ + log.debug("Configuration directory exists!"); // // Check PDF-AS config version File versionFile = new File(configDir, Constants.CONFIG_VERSION_FILENAME); String configVersion = getVersion(versionFile); @@ -422,9 +422,9 @@ public class PrepareConfigurationState extends State { initializeFromArguments(stateMachine.getCmdArgs(), this.configFileHandler); } catch (InitializationException e) { - log.error("Error in cmd line arguments: ", e); //$NON-NLS-1$ + log.error("Error in cmd line arguments: ", e); // ErrorDialog error = new ErrorDialog(gui.getMainShell(), - Messages.getString("error.CmdLineArgs") + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.getString("error.CmdLineArgs") + "\n" + // // e.getMessage(), BUTTONS.OK); error.open(); @@ -440,18 +440,18 @@ public class PrepareConfigurationState extends State { initializeFromArguments(stateMachine.getCmdArgs(), this.handler); } catch (InitializationException e) { - log.error("Error in cmd line arguments: ", e); //$NON-NLS-1$ + log.error("Error in cmd line arguments: ", e); // ErrorDialog error; - + if (e.getCause() instanceof FileNotFoundException) { error = new ErrorDialog(gui.getMainShell(), String.format( - Messages.getString("error.FileNotExist"), //$NON-NLS-1$ + Messages.getString("error.FileNotExist"), // e.getCause().getMessage()), BUTTONS.OK); } else { error = new ErrorDialog(gui.getMainShell(), - Messages.getString("error.CmdLineArgs") + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.getString("error.CmdLineArgs") + "\n" + // // e.getMessage(), BUTTONS.OK); } @@ -471,7 +471,7 @@ public class PrepareConfigurationState extends State { final String version = method.getResponseBodyAsString().trim(); if (!VersionComparator.before(Constants.APP_VERSION, version)) return; - + // wait 500ms before invoke the GUI message, because GUI had to be started from // main thread try {Thread.sleep(500); } catch (InterruptedException e1) { } @@ -480,8 +480,8 @@ public class PrepareConfigurationState extends State { @Override public void run() { Dialog info = new Dialog(gui.getMainShell(), - Messages.getString("version_check.UpdateTitle"), //$NON-NLS-1$ - String.format(Messages.getString("version_check.UpdateText"), //$NON-NLS-1$ + Messages.getString("version_check.UpdateTitle"), // + String.format(Messages.getString("version_check.UpdateText"), // version), BUTTONS.OK_CANCEL, ICON.INFORMATION); if (info.open() == SWT.OK) @@ -490,17 +490,17 @@ public class PrepareConfigurationState extends State { try { Desktop.getDesktop().browse(new URI(Constants.UPDATE_URL)); } catch (Exception e) { - log.error("Error opening update location ", e); //$NON-NLS-1$ + log.error("Error opening update location ", e); // } } else { - log.info("SWT Desktop is not supported on this platform"); //$NON-NLS-1$ + log.info("SWT Desktop is not supported on this platform"); // Program.launch(Constants.UPDATE_URL); } } } }); } catch (Exception e) { - log.error("Error downloading update information: ", e); //$NON-NLS-1$ + log.error("Error downloading update information: ", e); // } } }).start(); @@ -520,10 +520,10 @@ public class PrepareConfigurationState extends State { setNextState(new OpenState(stateMachine)); } catch (InitializationException e) { - log.error("Failed to initialize: ", e); //$NON-NLS-1$ + log.error("Failed to initialize: ", e); // ErrorDialog error = new ErrorDialog(getStateMachine() .getGUIProvider().getMainShell(), - Messages.getString("error.Initialization"), //$NON-NLS-1$ + Messages.getString("error.Initialization"), // BUTTONS.OK); // error.setException(e); // setNextState(error); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index 38049be0..11f5459a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -80,33 +80,33 @@ public class PrepareSigningState extends State { final String proxyPass = configuration.getProxyPass(); if (proxyHost != null && !proxyHost.isEmpty()) { - log.debug("Setting proxy host to " + proxyHost); //$NON-NLS-1$ - System.setProperty("http.proxyHost", proxyHost); //$NON-NLS-1$ - System.setProperty("https.proxyHost", proxyHost); //$NON-NLS-1$ + log.debug("Setting proxy host to " + proxyHost); // + System.setProperty("http.proxyHost", proxyHost); // + System.setProperty("https.proxyHost", proxyHost); // } if (proxyPort > 0 && proxyPort <= 0xFFFF) { String port = Integer.toString(proxyPort); - log.debug("Setting proxy port to " + port); //$NON-NLS-1$ - System.setProperty("http.proxyPort", port); //$NON-NLS-1$ - System.setProperty("https.proxyPort", port); //$NON-NLS-1$ + log.debug("Setting proxy port to " + port); // + System.setProperty("http.proxyPort", port); // + System.setProperty("https.proxyPort", port); // } if (proxyUser != null && !proxyUser.isEmpty()) { - log.debug("Setting proxy username to " + proxyUser); //$NON-NLS-1$ - System.setProperty("http.proxyUser", proxyUser); //$NON-NLS-1$ - System.setProperty("https.proxyUser", proxyUser); //$NON-NLS-1$ + log.debug("Setting proxy username to " + proxyUser); // + System.setProperty("http.proxyUser", proxyUser); // + System.setProperty("https.proxyUser", proxyUser); // } if (proxyPass != null) { - log.debug("Setting proxy password"); //$NON-NLS-1$ - System.setProperty("http.proxyPassword", proxyPass); //$NON-NLS-1$ - System.setProperty("https.proxyPassword", proxyPass); //$NON-NLS-1$ + log.debug("Setting proxy password"); // + System.setProperty("http.proxyPassword", proxyPass); // + System.setProperty("https.proxyPassword", proxyPass); // } if (proxyUser != null && !proxyUser.isEmpty() && proxyPass != null && !proxyPass.isEmpty()) { - log.debug("Enabling proxy authentication"); //$NON-NLS-1$ + log.debug("Enabling proxy authentication"); // Authenticator.setDefault(new Authenticator() { /* (non-Javadoc) * @see java.net.Authenticator#getPasswordAuthentication() @@ -116,7 +116,7 @@ public class PrepareSigningState extends State { if (getRequestorType() == RequestorType.PROXY) { if (getRequestingHost().equalsIgnoreCase(proxyHost) && (getRequestingPort() == proxyPort)) { - return new PasswordAuthentication(proxyUser, + return new PasswordAuthentication(proxyUser, proxyPass.toCharArray()); } } @@ -153,7 +153,7 @@ public class PrepareSigningState extends State { if (configuration.getSignatureNote() != null && !configuration.getSignatureNote().isEmpty()) { this.state.signatureParameter.setProperty( - "SIG_NOTE", configuration.getSignatureNote()); //$NON-NLS-1$ + "SIG_NOTE", configuration.getSignatureNote()); // } this.state.signatureParameter @@ -172,7 +172,7 @@ public class PrepareSigningState extends State { .prepare(this.state.signatureParameter); } catch (Exception e) { - log.error("PrepareDocumentThread: ", e); //$NON-NLS-1$ + log.error("PrepareDocumentThread: ", e); // this.state.threadException = e; } finally { this.state.updateStateMachine(); @@ -228,7 +228,7 @@ public class PrepareSigningState extends State { if (this.threadException != null) { ErrorDialog error = new ErrorDialog(getStateMachine() .getGUIProvider().getMainShell(), - Messages.getString("error.PrepareDocument"), //$NON-NLS-1$ + Messages.getString("error.PrepareDocument"), // BUTTONS.RETRY_CANCEL); this.threadException = null; if (error.open() == SWT.RETRY) { @@ -249,7 +249,7 @@ public class PrepareSigningState extends State { } else if (status.getBKU() == BKUs.KS) { this.setNextState(new KSState(getStateMachine())); } else { - log.error("Invalid selected BKU Value \"NONE\" in PrepareSigningState!"); //$NON-NLS-1$ + log.error("Invalid selected BKU Value \"NONE\" in PrepareSigningState!"); // this.setNextState(new BKUSelectionState(getStateMachine())); } } 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 4b329b47..12412b42 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 @@ -38,12 +38,12 @@ import at.asit.pdfover.signator.Signer; public class SigningState extends State { /** - * + * */ private final class FinishSignThread implements Runnable { - + private SigningState state; - + /** * @param signingState */ @@ -56,7 +56,7 @@ public class SigningState extends State { try { Signer signer = this.state.getStateMachine().getPDFSigner().getPDFSigner(); Status status = this.state.getStateMachine().getStatus(); - + status.setSignResult(signer.sign(status.getSigningState())); } catch(Exception e) { this.state.threadException = e; @@ -77,20 +77,20 @@ public class SigningState extends State { * SLF4J Logger instance **/ static final Logger log = LoggerFactory.getLogger(SigningState.class); - + Exception threadException = null; - + @Override public void run() { Status status = getStateMachine().getStatus(); - - if(status.getSignResult() == null && + + if(status.getSignResult() == null && this.threadException == null) { Thread t = new Thread(new FinishSignThread(this)); t.start(); return; } - + if(this.threadException != null) { // workaround for PDF-AS nullpointerexception intercepting our IllegalStateException // cf. issue #52 @@ -102,19 +102,19 @@ public class SigningState extends State { this.threadException = new SignatureException(new IllegalStateException()); } - String message = Messages.getString("error.Signatur"); //$NON-NLS-1$ + String message = Messages.getString("error.Signatur"); // if (this.threadException instanceof SignatureException) { Throwable cause = this.threadException; while (cause.getCause() != null) cause = cause.getCause(); if (cause instanceof ConnectException) - message += ": " + cause.getMessage(); //$NON-NLS-1$ + message += ": " + cause.getMessage(); // if (cause instanceof IllegalStateException) { // Dummy exception - don't display error, go back to BKU Selection this.setNextState(new BKUSelectionState(getStateMachine())); return; } - + } // if we have gotten to this point, this is an actual exception diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java index 54842137..55aee598 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/State.java @@ -19,7 +19,7 @@ package at.asit.pdfover.gui.workflow.states; import at.asit.pdfover.gui.workflow.StateMachine; /** - * Base state class + * Base state class */ public abstract class State { @@ -38,7 +38,7 @@ public abstract class State { this.stateMachine = stateMachine; this.nextState = this; } - + /** * Gets the next logical state or null if this their is no state transition * @return the next state (or null) @@ -46,7 +46,7 @@ public abstract class State { public State nextState() { return this.nextState; } - + /** * Sets the next logical state * @param state @@ -54,7 +54,7 @@ public abstract class State { protected void setNextState(State state) { this.nextState = state; } - + /** * Perform main logic for this state */ @@ -84,7 +84,7 @@ public abstract class State { /** * Update the main window behavior of this state if necessary - * Should update this.stateMachine.getStatus().getBehavior() + * Should update this.stateMachine.getStatus().getBehavior() */ public abstract void updateMainWindowBehavior(); } |