From 80f046ab49015cf9cffca11597b9ee57d8a998bc Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Tue, 2 Aug 2022 13:36:50 +0200 Subject: misc cleanup --- .../at/asit/pdfover/gui/bku/LocalBKUConnector.java | 3 +-- .../asit/pdfover/gui/bku/MobileBKUConnector.java | 3 +-- .../asit/pdfover/gui/bku/mobile/ATrustHandler.java | 24 +++------------------- .../asit/pdfover/gui/bku/mobile/ATrustStatus.java | 3 +-- .../asit/pdfover/gui/bku/mobile/IAIKHandler.java | 3 +-- .../pdfover/gui/bku/mobile/MobileBKUHandler.java | 3 +-- .../pdfover/gui/bku/mobile/MobileBKUHelper.java | 3 +-- .../gui/bku/mobile/SimpleXMLTrustManager.java | 3 +-- .../gui/bku/mobile/TrustedSocketFactory.java | 3 +-- 9 files changed, 11 insertions(+), 37 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java index 2fcd9938..7967fe0e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java @@ -45,8 +45,7 @@ public class LocalBKUConnector implements BkuSlConnector { /** * SLF4J Logger instance **/ - private static final Logger log = LoggerFactory - .getLogger(LocalBKUConnector.class); + private static final Logger log = LoggerFactory.getLogger(LocalBKUConnector.class); /** * HTTP Response server HEADER 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 3d0a199a..d7d98172 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 @@ -37,8 +37,7 @@ public class MobileBKUConnector implements BkuSlConnector { /** * SLF4J Logger instance **/ - private static final Logger log = LoggerFactory - .getLogger(MobileBKUConnector.class); + private static final Logger log = LoggerFactory.getLogger(MobileBKUConnector.class); private MobileBKUState state; 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 c9bda35f..d6febeaa 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 @@ -21,14 +21,12 @@ import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; -import java.net.URLConnection; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringEscapeUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.program.Program; import org.eclipse.swt.widgets.Display; @@ -48,7 +46,6 @@ import at.asit.pdfover.gui.exceptions.ATrustConnectionException; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.states.MobileBKUState; import at.asit.pdfover.signator.SLResponse; -import at.asit.pdfover.signator.SignatureException; /** * A-Trust mobile BKU handler @@ -70,8 +67,7 @@ public class ATrustHandler extends MobileBKUHandler { /** * SLF4J Logger instance **/ - static final Logger log = LoggerFactory - .getLogger(ATrustHandler.class); + static final Logger log = LoggerFactory.getLogger(ATrustHandler.class); private static boolean expiryNoticeDisplayed = false; @@ -166,11 +162,6 @@ public class ATrustHandler extends MobileBKUHandler { if (responseData.contains("ExpiresInfo.aspx?sid=")) { // Certificate expiration interstitial - skip - String notice = Messages.getString("mobileBKU.notice") + " " + - StringEscapeUtils.unescapeHtml4(MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "Label2")) - .replaceAll("\\<.*?\\>", ""); - log.info(notice); - if (!expiryNoticeDisplayed) { Display.getDefault().syncExec(()-> { Dialog d = new Dialog(ATrustHandler.this.shell, Messages.getString("common.info"), Messages.getString("mobileBKU.certExpiresSoon"), BUTTONS.YES_NO, ICON.WARNING); @@ -502,11 +493,8 @@ public class ATrustHandler extends MobileBKUHandler { public boolean handlePolling() throws ATrustConnectionException { ATrustStatus status = getStatus(); - URLConnection urlconnection = null; String isReady = null; Status serverStatus = null; - int waits = 0; - final String ERROR = "Error: Server is not responding"; HttpClient client; try { do { @@ -521,7 +509,7 @@ public class ATrustHandler extends MobileBKUHandler { get.addRequestHeader("Referer", uri); - int returnValue = client.executeMethod(get); + client.executeMethod(get); InputStream in = new BufferedInputStream(get.getResponseBodyAsStream()); isReady = IOUtils.toString(in, "utf-8"); @@ -556,19 +544,13 @@ public class ATrustHandler extends MobileBKUHandler { private final boolean wait; public Status(String status) { - JsonElement jelement = new JsonParser().parse(status.toLowerCase()); + JsonElement jelement = JsonParser.parseString(status.toLowerCase()); JsonObject jobject = jelement.getAsJsonObject(); this.fin = jobject.get("fin").getAsBoolean(); this.error = jobject.get("error").getAsBoolean(); this.wait = jobject.get("wait").getAsBoolean(); } - public Status(boolean error) { - this.error = error; - this.fin = false; - this.wait = false; - } - public boolean isFin() { return fin; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java index 5bc0c745..b61b3a8b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java @@ -29,8 +29,7 @@ public class ATrustStatus extends MobileBKUStatus { * SLF4J Logger instance **/ @SuppressWarnings("unused") - private static final Logger log = LoggerFactory - .getLogger(ATrustStatus.class); + private static final Logger log = LoggerFactory.getLogger(ATrustStatus.class); /** Maximum number of TAN tries */ public static final int MOBILE_MAX_TAN_TRIES = 3; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java index ac47a3b7..bf5c865f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java @@ -44,8 +44,7 @@ public class IAIKHandler extends MobileBKUHandler { /** * SLF4J Logger instance **/ - private static final Logger log = LoggerFactory - .getLogger(IAIKHandler.class); + private static final Logger log = LoggerFactory.getLogger(IAIKHandler.class); Shell shell; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java index 696f75fe..90e4ff46 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHandler.java @@ -48,8 +48,7 @@ public abstract class MobileBKUHandler { /** * SLF4J Logger instance **/ - static final Logger log = LoggerFactory - .getLogger(MobileBKUHandler.class); + static final Logger log = LoggerFactory.getLogger(MobileBKUHandler.class); public final MobileBKUState state; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java index c397fa72..f6de0789 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java @@ -40,8 +40,7 @@ public class MobileBKUHelper { /** * SLF4J Logger instance **/ - private static final Logger log = LoggerFactory - .getLogger(MobileBKUHelper.class); + private static final Logger log = LoggerFactory.getLogger(MobileBKUHelper.class); /** * Regular expression for mobile phone numbers: this allows the entry of diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java index f529d658..ca57dc87 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/SimpleXMLTrustManager.java @@ -41,8 +41,7 @@ public class SimpleXMLTrustManager implements X509TrustManager { /** * SLF4J Logger instance **/ - private static final Logger log = LoggerFactory - .getLogger(SimpleXMLTrustManager.class); + private static final Logger log = LoggerFactory.getLogger(SimpleXMLTrustManager.class); /* * The default X509TrustManager returned by SunX509. We'll delegate diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java index 6f306cdd..3dae25c9 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/TrustedSocketFactory.java @@ -45,8 +45,7 @@ public class TrustedSocketFactory implements SecureProtocolSocketFactory { /** * SLF4J Logger instance **/ - private static final Logger log = LoggerFactory - .getLogger(TrustedSocketFactory.class); + private static final Logger log = LoggerFactory.getLogger(TrustedSocketFactory.class); private static final String ENABLED_CS[] = { "TLS_RSA_WITH_AES_128_CBC_SHA", -- cgit v1.2.3