summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-14 12:48:27 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-14 12:48:27 +0200
commit60ee69060e5e6f8f1727995f424d20bbb52dd646 (patch)
treecaac8bffc97e4eead170375379a26c70b3e2cb85
parent1802a99548ad759c54f3ad48092ea37fc2494c81 (diff)
downloadpdf-over-60ee69060e5e6f8f1727995f424d20bbb52dd646.tar.gz
pdf-over-60ee69060e5e6f8f1727995f424d20bbb52dd646.tar.bz2
pdf-over-60ee69060e5e6f8f1727995f424d20bbb52dd646.zip
cleanup exception handling in credential handler
(also update to new a-trust html, cf. #101)
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
index 96530cf0..c9bda35f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
@@ -282,11 +282,22 @@ public class ATrustHandler extends MobileBKUHandler {
state.clearRememberedCredentials();
// extract error text!
try {
- String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "class", "ErrorClass");
- status.errorMessage = errorMessage;
+ String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "Label1");
+ if (errorMessage.startsWith("Fehler: "))
+ errorMessage = errorMessage.substring(8);
+ status.errorMessage = errorMessage.strip();
} catch (Exception e) {
- throw new SignatureException(MobileBKUHelper.extractSubstring(responseData, "<sl:ErrorCode>", "</sl:ErrorCode>") + ": " +
- MobileBKUHelper.extractSubstring(responseData, "<sl:Info>", "</sl:Info>"));
+ log.error("Failed to get credentials error message", e);
+ String msg = null;
+ try
+ {
+ msg = MobileBKUHelper.extractSubstring(responseData, "<sl:ErrorCode>", "</sl:ErrorCode>") + ": " +
+ MobileBKUHelper.extractSubstring(responseData, "<sl:Info>", "</sl:Info>");
+ } catch (Exception e2) {
+ log.error("Failed to get credentials error code", e2);
+ msg = Messages.getString("error.Unexpected");
+ }
+ status.errorMessage = msg.strip();
}
}