From 60ee69060e5e6f8f1727995f424d20bbb52dd646 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 14 Jul 2022 12:48:27 +0200 Subject: cleanup exception handling in credential handler (also update to new a-trust html, cf. #101) --- .../at/asit/pdfover/gui/bku/mobile/ATrustHandler.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main') 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, "", "") + ": " + - MobileBKUHelper.extractSubstring(responseData, "", "")); + log.error("Failed to get credentials error message", e); + String msg = null; + try + { + msg = MobileBKUHelper.extractSubstring(responseData, "", "") + ": " + + MobileBKUHelper.extractSubstring(responseData, "", ""); + } catch (Exception e2) { + log.error("Failed to get credentials error code", e2); + msg = Messages.getString("error.Unexpected"); + } + status.errorMessage = msg.strip(); } } -- cgit v1.2.3