From e4767bccc7324d4b61a334bf6c0558d0080045e2 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 6 Jul 2022 12:33:33 +0200 Subject: remove NON-NLS comments, cleanup whitespace --- .../pdfover/gui/bku/mobile/MobileBKUHelper.java | 108 ++++++++++----------- 1 file changed, 54 insertions(+), 54 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java') 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 9466fecb..6b9f0584 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 @@ -36,7 +36,7 @@ import at.asit.pdfover.gui.exceptions.PasswordTooLongException; import at.asit.pdfover.gui.exceptions.PasswordTooShortException; /** - * + * */ public class MobileBKUHelper { /** @@ -48,15 +48,15 @@ public class MobileBKUHelper { /** * Regular expression for mobile phone numbers: this allows the entry of * mobile numbers in the following formats: - * + * * +(countryCode)99999999999 00(countryCode)99999999999 099999999999 * 1030199999999999 (A-Trust Test bku) */ - private static final String NUMBER_REGEX = "^((\\+[\\d]{2})|(00[\\d]{2})|(0)|(10301))([1-9][\\d]+)$"; //$NON-NLS-1$ + private static final String NUMBER_REGEX = "^((\\+[\\d]{2})|(00[\\d]{2})|(0)|(10301))([1-9][\\d]+)$"; // /** * Extracts a substring from data starting after start and ending with end - * + * * @param data * the whole data string * @param start @@ -76,16 +76,16 @@ public class MobileBKUHelper { if (endidx > startidx) { return data.substring(startidx, endidx); } - log.error("extracting substring: end not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$ - throw new Exception("End string not available! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting substring: end not valid!: " + start + " ... " + end); //// + throw new Exception("End string not available! Mobile BKU site changed?"); // } - log.error("extracting substring: start not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$ - throw new Exception("Start string not available! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting substring: start not valid!: " + start + " ... " + end); //// + throw new Exception("Start string not available! Mobile BKU site changed?"); // } /** * Extracts an XML tag from data with the given param="value" - * + * * @param data * the whole data string * @param tag @@ -101,25 +101,25 @@ public class MobileBKUHelper { public static String extractTagWithParam(String data, String tag, String param, String value) throws Exception { String start = '<' + tag; - int startidx, endidx = 0; + int startidx, endidx = 0; while ((startidx = data.indexOf(start, endidx)) != -1) { endidx = data.indexOf('>', startidx); if (endidx == -1) { - log.error("extracting tag: unterminated tag! " + tag + " (" + param + "=" + value + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting tag: unterminated tag! " + tag + " (" + param + "=" + value + ")"); //// // // + throw new Exception("Tag not found! Mobile BKU site changed?"); // } String found = data.substring(startidx, endidx + 1); - if (found.contains(param + "='" + value + "'") || //$NON-NLS-1$ //$NON-NLS-2$ - found.contains(param + "=\"" + value + "\"")) //$NON-NLS-1$ //$NON-NLS-2$ + if (found.contains(param + "='" + value + "'") || // // + found.contains(param + "=\"" + value + "\"")) // // return found; } - log.info("extracting tag: not found!: " + tag + " (" + param + "='" + value + "')"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + log.info("extracting tag: not found!: " + tag + " (" + param + "='" + value + "')"); //// // // + throw new Exception("Tag not found! Mobile BKU site changed?"); // } /** * Extracts a parameter value from an XML tag from data with the given param="value" - * + * * @param data * the whole data string * @param tag @@ -139,25 +139,25 @@ public class MobileBKUHelper { String found = extractTagWithParam(data, tag, param, value); int startidx = found.indexOf(returnparam + '='); if (startidx == -1) { - log.error("extracting tag: param not found! " + tag + " (" + param + "=" + value + ") - " + returnparam); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting tag: param not found! " + tag + " (" + param + "=" + value + ") - " + returnparam); //// // // + throw new Exception("Tag not found! Mobile BKU site changed?"); // } startidx += returnparam.length() + 1; int endidx = found.indexOf(found.charAt(startidx), startidx + 1); if (endidx == -1) { - log.error("extracting tag: unterminated param value! " + tag + " (" + param + "=" + value + ") - " + returnparam); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting tag: unterminated param value! " + tag + " (" + param + "=" + value + ") - " + returnparam); //// // // + throw new Exception("Tag not found! Mobile BKU site changed?"); // } return found.substring(startidx + 1, endidx); } - + /** - * This method is the same as the non optional method but instead of throwing the exception it returns null - * @return the string or null + * This method is the same as the non optional method but instead of throwing the exception it returns null + * @return the string or null */ public static String extractValueFromTagWithParamOptional(String data, String tag, String param, String value, String returnparam) { - String str; + String str; try { str = extractValueFromTagWithParam(data, tag, param, value, returnparam); } catch (Exception e) { @@ -165,12 +165,12 @@ public class MobileBKUHelper { str = null; } return str; - + } /** * Extracts the content from an XML tag from data with the given param="value" - * + * * @param data * the whole data string * @param tag @@ -187,17 +187,17 @@ public class MobileBKUHelper { String param, String value) throws Exception { String found = extractTagWithParam(data, tag, param, value); int startidx = data.indexOf(found) + found.length(); - int endidx = data.indexOf("", startidx); //$NON-NLS-1$ //$NON-NLS-2$ + int endidx = data.indexOf("", startidx); // // if (endidx == -1) { - log.error("extracting tag: closing tag not found! " + tag + " (" + param + "=" + value + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - throw new Exception("Tag not found! Mobile BKU site changed?"); //$NON-NLS-1$ + log.error("extracting tag: closing tag not found! " + tag + " (" + param + "=" + value + ")"); //// // // + throw new Exception("Tag not found! Mobile BKU site changed?"); // } return data.substring(startidx, endidx); } /** * Validates the Mobile phone number - * + * * @param number * @return the normalized Phone number */ @@ -220,15 +220,15 @@ public class MobileBKUHelper { String normalNumber = matcher.group(6); - if (countryCode.equals("10301")) { //$NON-NLS-1$ + if (countryCode.equals("10301")) { // // A-Trust Testnumber! Don't change return number; } - countryCode = countryCode.replace("00", "+"); //$NON-NLS-1$ //$NON-NLS-2$ + countryCode = countryCode.replace("00", "+"); // // - if (countryCode.equals("0")) { //$NON-NLS-1$ - countryCode = "+43"; //$NON-NLS-1$ + if (countryCode.equals("0")) { // + countryCode = "+43"; // } return countryCode + normalNumber; @@ -236,7 +236,7 @@ public class MobileBKUHelper { /** * Validate given Password for Mobile BKU - * + * * @param password * @throws InvalidPasswordException */ @@ -252,7 +252,7 @@ public class MobileBKUHelper { /** * Removes file extension from URL - * + * * @param url * the url string * @return the stripped url @@ -272,14 +272,14 @@ public class MobileBKUHelper { * @return the fully qualified URL */ public static String getQualifiedURL(String fragment, URL base) { - if (fragment.startsWith("http:") || fragment.startsWith("https:")) //$NON-NLS-1$ //$NON-NLS-2$ + if (fragment.startsWith("http:") || fragment.startsWith("https:")) // // return fragment; int p = base.getPort(); - String port = ((p != -1) && (p != base.getDefaultPort())) ? ":" + p : ""; //$NON-NLS-1$ //$NON-NLS-2$ - if (fragment.startsWith("/")) { //$NON-NLS-1$ - return base.getProtocol() + "://" + base.getHost() + port + fragment; //$NON-NLS-1$ + String port = ((p != -1) && (p != base.getDefaultPort())) ? ":" + p : ""; // // + if (fragment.startsWith("/")) { // + return base.getProtocol() + "://" + base.getHost() + port + fragment; // } - return stripQueryString(base.toString()) + "/" + fragment; //$NON-NLS-1$ + return stripQueryString(base.toString()) + "/" + fragment; // } /** @@ -287,8 +287,8 @@ public class MobileBKUHelper { */ @SuppressWarnings("deprecation") public static void registerTrustedSocketFactory() { - Protocol.registerProtocol("https", //$NON-NLS-1$ - new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$ + Protocol.registerProtocol("https", // + new Protocol("https", new TrustedSocketFactory(), 443)); // } /** @@ -299,21 +299,21 @@ public class MobileBKUHelper { public static HttpClient getHttpClient(MobileBKUStatus status) { return BKUHelper.getHttpClient(true); } - + /*** - * - * @param htmlString describes the html data in String representation - * @param attributeName is the attribute which should be selected + * + * @param htmlString describes the html data in String representation + * @param attributeName is the attribute which should be selected * @return returns the attribute name or null otherswise */ public static String getDynamicNameAttribute(String htmlString, String attributeName) { - + Document doc = Jsoup.parse(htmlString); Elements inputs = doc.select("div input#" + attributeName); - - if (inputs.size() == 0 ) return null; - - String name = inputs.get(0).attr("name"); - return name; + + if (inputs.size() == 0 ) return null; + + String name = inputs.get(0).attr("name"); + return name; } } -- cgit v1.2.3