public void run() { URLConnection con = null; try { con = url.openConnection(); if ("HTTPS".equalsIgnoreCase(url.getProtocol())) { HttpsURLConnection scon = (HttpsURLConnection) con; try { scon.setSSLSocketFactory(SSLUtil.getSSLSocketFactory(clientCertAlias, trustAnyCert)); HostnameVerifier hv = SSLUtil.getHostnameVerifier(hostCertLevel); if (hv != null) { scon.setHostnameVerifier(hv); } } catch (GeneralSecurityException e) { Debug.logError(e, module); } catch (GenericConfigException e) { Debug.logError(e, module); } } } catch (IOException e) { Debug.logError(e, module); } synchronized (URLConnector.this) { if (timedOut && con != null) { close(con); } else { connection = con; URLConnector.this.notify(); } } }
/** * Method to format an amount using a custom rule set. Current rule sets available: * * <p>en_US %dollars-and-cents - 1,225.25 becomes "one thousand two hundred twenty five dollars * and twenty five cents" (useful for checks) %dollars-and-hundreths - 1,225.25 becomes "one * thousand two hundred twenty five and 25/00" (alternate for checks) * * @param amount - the amount to format * @param rule - the name of the rule set to use (e.g., %dollars-and-hundredths) * @param locale - the Locale * @return formatted string or an empty string if there was an error */ public static String formatRuleBasedAmount(double amount, String rule, Locale locale) { String ruleSet = rbnfRuleSets.get(locale); if (ruleSet == null) { Debug.logWarning( "Cannot format rule based amount for locale " + locale.toString() + " because rule set for that locale does not exist", module); return ""; } RuleBasedNumberFormat formatter = new RuleBasedNumberFormat(ruleSet, locale); String result = ""; try { result = formatter.format(amount, rule); } catch (Exception e) { Debug.logError(e, "Failed to format amount " + amount + " using rule " + rule, module); } return result; }
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { debug.logError("ChannelWriterHandler, exceptionCaught() ", e.getCause()); e.getChannel().close(); }