static void init(String host, String portStr) { Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); BasicConfigurator.configure(root.getLoggerContext()); try { int port = Integer.parseInt(portStr); logger.info("Creating socket appender (" + host + "," + port + ")."); s = new SocketAppender(); s.setRemoteHost(host); s.setPort(port); s.setName("S"); root.addAppender(s); } catch (java.lang.NumberFormatException e) { e.printStackTrace(); usage("Could not interpret port number [" + portStr + "]."); } catch (Exception e) { System.err.println("Could not start!"); e.printStackTrace(); System.exit(1); } }
public EncryptionKeys( @Nullable String adminKey, @Nullable String memberKey, @Nullable String guestKey) { _adminKey = getKeyFromString(adminKey); _memberKey = getKeyFromString(memberKey); _guestKey = getKeyFromString(guestKey); _adminKeyBytes = null; _memberKeyBytes = null; _guestKeyBytes = null; try { if (_adminKey != null) { _adminKeyBytes = BleUtils.hexStringToBytes(_adminKey); } if (_memberKey != null) { _memberKeyBytes = BleUtils.hexStringToBytes(_memberKey); } if (_guestKey != null) { _guestKeyBytes = BleUtils.hexStringToBytes(_guestKey); } } catch (java.lang.NumberFormatException e) { BleLog.getInstance().LOGe(TAG, "Invalid key format"); e.printStackTrace(); } }