summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-14 13:27:06 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-14 13:27:06 +0200
commitbf04fba3b1ff92b4288c37c474c8e4b9d4e2e342 (patch)
tree772122c26ea4ce387bad3ff27dc8d82910cb8827 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow
parentd8455be73b62176f85a4008efd733497b7b13711 (diff)
downloadpdf-over-bf04fba3b1ff92b4288c37c474c8e4b9d4e2e342.tar.gz
pdf-over-bf04fba3b1ff92b4288c37c474c8e4b9d4e2e342.tar.bz2
pdf-over-bf04fba3b1ff92b4288c37c474c8e4b9d4e2e342.zip
better error message if internet connection is unavailable
cf. #47
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java31
1 files changed, 14 insertions, 17 deletions
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 09f67602..594e46c8 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
@@ -16,6 +16,7 @@
package at.asit.pdfover.gui.workflow.states;
import java.io.InputStream;
+import java.net.UnknownHostException;
import java.util.Timer;
import java.util.TimerTask;
@@ -164,11 +165,18 @@ public class MobileBKUState extends State {
* the exception
*/
public void displayError(Exception e) {
- String message = Messages.getString("error.Unexpected");
- log.error(message, e);
- String errormsg = e.getLocalizedMessage();
- if (errormsg != null && !errormsg.isEmpty())
- message += ": " + errormsg;
+ String message = null;
+ if (e instanceof UnknownHostException)
+ {
+ log.error("Failed to resolve hostname", e);
+ message = String.format(Messages.getString("error.CouldNotResolveHostname"), e.getMessage());
+ } else {
+ message = Messages.getString("error.Unexpected");
+ log.error(message, e);
+ String errormsg = e.getLocalizedMessage();
+ if (errormsg != null && !errormsg.isEmpty())
+ message += ": " + errormsg;
+ }
displayError(message);
}
@@ -548,18 +556,7 @@ public class MobileBKUState extends State {
this.signingState.setUseBase64Request(this.handler.useBase64Request());
if (this.threadException != null) {
- String message = Messages.getString("error.Unexpected");
- log.error(message, this.threadException);
- String errormsg = this.threadException.getLocalizedMessage();
- if (errormsg != null && !errormsg.isEmpty())
- message += ": " + errormsg;
- ErrorDialog error = new ErrorDialog(
- getStateMachine().getMainShell(),
- message, BUTTONS.OK);
- // error.setException(this.threadException);
- // this.setNextState(error);
- error.open();
- getStateMachine().exit();
+ displayError(this.threadException);
return;
}