List of usage examples for java.lang Exception toString
public String toString()
From source file:org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory.java
private static SSLContext createEasySSLContext() { try {// w ww.j ava2s. co m SSLContext context = SSLContext.getInstance("SSL"); context.init(null, new TrustManager[] { new EasyX509TrustManager(null) }, null); return context; } catch (Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e.toString()); } }
From source file:com.spacetimeinsight.webservice.ssl.EasySSLProtocolSocketFactory.java
private static SSLContext createEasySSLContext() { try {/*from w w w . ja v a 2 s. c o m*/ SSLContext context = getContext( new File("C:\\Program Files\\SpaceTimeAwarenessServer\\cert\\STI_clientMiddleware.p12"), "lJaV8hP2eU2xaM3e6Rea"); return context; } catch (Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e.toString()); } }
From source file:gravity.android.discovery.DiscoveryClient.java
public static ArrayList<DiscoveryServerInfo> findServer(WifiManager mWifi, int port, String token) { ArrayList<DiscoveryServerInfo> ret = new ArrayList<DiscoveryServerInfo>(); try {//from w ww .j av a 2 s . co m DatagramSocket clientSocket = new DatagramSocket(); clientSocket.setBroadcast(true); InetAddress IPAddress = Utils.getBroadcastAddress(mWifi); Log.v("DISCOVERY_CLIENT", "broadcast addr " + IPAddress.getHostAddress()); byte[] receiveData = new byte[2048]; byte[] sendData = new byte[128]; sendData = token.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port); Log.v("DISCOVERY_CLIENT", "sent " + token); clientSocket.send(sendPacket); long t1 = System.currentTimeMillis(); while (System.currentTimeMillis() - t1 <= 4000) // 4 secondi { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); try { clientSocket.setSoTimeout(500); clientSocket.receive(receivePacket); if (receivePacket.getAddress() != null && receivePacket.getAddress().getHostAddress() != null) { String discovered_name, discovered_ip; int discovered_port; String received = new String(receivePacket.getData()); if (received != null) { received = received.trim().substring(0, receivePacket.getLength()).trim(); Log.d("Recieved Msg Packet:", received); //StringTokenizer st = new StringTokenizer(received, ","); //Gravity Code JSONObject recievedJson = new JSONObject(received); try { //discovered_name = st.nextToken(); discovered_name = recievedJson.getString("name"); //Gravity code discovered_ip = receivePacket.getAddress().getHostAddress(); //discovered_port = Integer.parseInt(st.nextToken()); discovered_port = recievedJson.getInt("port_to_share"); //Gravity code Log.v("DISCOVERY_CLIENT", "discovered " + discovered_name + ", " + discovered_ip + ":" + discovered_port); boolean add = true; if (ret.size() > 0) { for (DiscoveryServerInfo dsi : ret) { if (dsi != null && dsi.ip.equals(discovered_ip)) { add = false; break; } } } if (add) { ret.add(new DiscoveryServerInfo(discovered_name, discovered_ip, discovered_port)); } } catch (NoSuchElementException nsee) { Log.v("DISCOVERY_CLIENT", nsee.getLocalizedMessage()); } } } } catch (SocketTimeoutException tex) { /* ignored */ } } clientSocket.close(); } catch (Exception ex) { ex.printStackTrace(); Log.e("DISCOVERY_CLIENT", ex.toString()); } return ret; }
From source file:com.libresoft.apps.ARviewer.Utils.GeoNames.AltitudeManager.java
public static double getAbsoluteAltitude(Context context, double base_altitude, boolean is_floor) { double altitude = AltitudeManager.NO_ALTITUDE_VALUE; if (base_altitude != AltitudeManager.NO_ALTITUDE_VALUE) { try {// w w w .j av a 2s. c o m SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); float user_height = ((float) sharedPreferences.getInt(AltitudePreferences.KEY_USER_HEIGHT, 175)) / 100; if (is_floor && sharedPreferences.getBoolean(AltitudePreferences.KEY_USE_FLOOR, false)) { int floor_number = sharedPreferences.getInt(AltitudePreferences.KEY_FLOOR, 0); altitude = (float) (base_altitude + user_height + floor_number * 3); // 3 meters per room Log.d("AltitudeManager", "Using floor"); } else altitude = (float) (base_altitude + user_height); } catch (Exception e) { // TODO Auto-generated catch block Log.e("AltitudeManager", e.toString()); } } return altitude; }
From source file:totalcross.android.ConnectionManager4A.java
public static String getLocalIpAddress() { String ipv4 = null;//from www . j ava 2s .c o m try { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en .hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); // for getting IPV4 format if (!inetAddress.isLoopbackAddress() && InetAddressUtils.isIPv4Address(ipv4 = inetAddress.getHostAddress())) return ipv4; } } } catch (Exception ex) { AndroidUtils.debug("IP Address" + ex.toString()); } return null; }
From source file:com.owera.xaps.web.app.page.monitor.EasySSLProtocolSocketFactory.java
/** * Creates a new EasySSLProtocolSocket object. * * @return the SSL context/*from www . jav a 2 s .com*/ */ private static SSLContext createEasySSLContext() { try { SSLContext context = SSLContext.getInstance("SSL"); context.init(null, new TrustManager[] { new EasyX509TrustManager(null) }, null); return context; } catch (Exception e) { throw new HttpClientError(e.toString()); } }
From source file:com.sun.socialsite.util.LeniantSSLProtocolSocketFactory.java
private static SSLContext createLeniantSSLContext() { try {/* w ww .j a va 2 s. c om*/ SSLContext context = SSLContext.getInstance("SSL"); context.init(null, new TrustManager[] { new LeniantX509TrustManager(null) }, null); return context; } catch (Exception e) { log.error(e.getMessage(), e); throw new HttpClientError(e.toString()); } }
From source file:cz.vity.freerapid.plugins.webclient.ssl.EasySSLProtocolSocketFactory.java
private static SSLContext createEasySSLContext() { try {/* ww w .jav a 2s .c o m*/ SSLContext context = SSLContext.getInstance("SSL"); context.init(null, new TrustManager[] { new EasyX509TrustManager(null) }, null); return context; } catch (Exception e) { LogUtils.processException(logger, e); throw new HttpClientError(e.toString()); } }
From source file:com.cazoodle.crawl.DummySSLProtocolSocketFactory.java
private static SSLContext createEasySSLContext() { try {//from w w w .j a v a 2 s . c o m SSLContext context = SSLContext.getInstance("SSL"); context.init(null, new TrustManager[] { new DummyX509TrustManager(null) }, null); return context; } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(e.getMessage(), e); } throw new HttpClientError(e.toString()); } }
From source file:com.mapr.ocr.text.ImageToText.java
public static String processImageFile(String fileName) { Tesseract instance = new Tesseract(); // JNA Interface Mapping File imageFile = new File(fileName); String resultText = null;/* w w w . jav a 2 s. c om*/ instance.setLanguage("eng"); try { resultText = instance.doOCR(imageFile); } catch (Exception e) { e.printStackTrace(); LOGGER.log(Level.SEVERE, "Exception processing image file " + fileName + " " + e.toString()); String rowKey = FilenameUtils .removeExtension(fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length())); populateDataInMapRDB(config, errorTable, rowKey, cf, "error", e.toString()); populateDataInMapRDB(config, errorTable, rowKey, cf, "filepath", fileName); } finally { return resultText; } }