Example usage for android.util Log wtf

List of usage examples for android.util Log wtf

Introduction

In this page you can find the example usage for android.util Log wtf.

Prototype

public static int wtf(String tag, Throwable tr) 

Source Link

Document

What a Terrible Failure: Report an exception that should never happen.

Usage

From source file:Main.java

public static void threadSleep(int ms) {
    try {/*from   w  w  w .  j a v a 2  s  .  c  o  m*/
        Thread.sleep(ms);
    } catch (InterruptedException e) {
        Log.wtf("WTF", "WOW! Thread sleep exception. ");
    }
}

From source file:Main.java

public static boolean isURLConnectable(Context context, String url) {
    ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo != null && netInfo.isConnected()) {
        try {/*from www. ja  va2 s  .  c  o  m*/
            HttpURLConnection urlc = (HttpURLConnection) new URL(url).openConnection();
            urlc.setConnectTimeout(10 * 1000); // 10 s.
            urlc.connect();
            if (urlc.getResponseCode() == 200) { // 200 = "OK" code (http
                // connection is fine).
                Log.wtf("Connection", "Success !");
                return true;
            } else {
                return false;
            }
        } catch (MalformedURLException e1) {
            return false;
        } catch (IOException e) {
            return false;
        }
    }
    return false;
}

From source file:org.catnut.metadata.WeiboAPIError.java

/**
 * volley?// w  w  w . ja va  2  s. co m
 *
 * @param volleyError
 * @return WeiboAPIError
 */
public static WeiboAPIError fromVolleyError(VolleyError volleyError) {
    // very bad situation!
    if (volleyError.networkResponse == null) {
        String message = volleyError.getLocalizedMessage();
        return new WeiboAPIError(-1, null,
                TextUtils.isEmpty(message) ? volleyError.getClass().getName() : message);
    }
    // ?response body
    String jsonString;
    try {
        jsonString = new String(volleyError.networkResponse.data);
    } catch (Exception e) {
        Log.wtf(TAG, e);
        // fall back to http error!
        String msg = volleyError.getLocalizedMessage();
        return new WeiboAPIError(volleyError.networkResponse.statusCode, null,
                TextUtils.isEmpty(msg) ? "Unknown error! Please try again later:-(" : msg);
    }

    try {
        JSONObject jsonObject = new JSONObject(jsonString);
        return new WeiboAPIError(jsonObject.optInt(ERROR_CODE), jsonObject.optString(REQUEST),
                jsonObject.optString(ERROR));
    } catch (JSONException e) {
        Log.wtf(TAG, e.getLocalizedMessage());
    }
    // never happen?
    return null;
}

From source file:at.bitfire.davdroid.webdav.TlsSniSocketFactory.java

/**
 * Check that we have an android {@link Context} set.
 *///from ww  w .j  a  va2 s  .c o  m
private static void verifyAndroidContextSet() {
    if (androidContext == null)
        Log.wtf(TAG, "sockets should not be created before setAndroidContext is called");
}

From source file:com.granita.icloudcalsync.webdav.HttpReport.java

HttpReport(URI uri, String entity) {
    this(uri);//from w w  w . j a  va 2s. c o  m

    setHeader("Content-Type", "text/xml; charset=UTF-8");
    setHeader("Accept", "text/xml");
    setHeader("Depth", "1");

    try {
        setEntity(new StringEntity(entity, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        Log.wtf(TAG, "String entity doesn't support UTF-8");
    }
}

From source file:com.dubsar_dictionary.SecureClient.SecureSocketFactory.java

public static SSLSocketFactory getHttpSocketFactory(int handshakeTimeoutMillis) {
    if (sFactory == null) {
        try {//from  w  ww  . jav a2  s.  c  om
            sFactory = new SecureSocketFactory(handshakeTimeoutMillis);
        } catch (Exception e) {
            Log.wtf(TAG, e);
        }
    }
    return sFactory;
}

From source file:com.android.volley.VolleyLog.java

public static void wtf(String format, Object... args) {
    Log.wtf(TAG, buildMessage(format, args));
}

From source file:at.bitfire.davdroid.webdav.TlsSniSocketFactory.java

private static SSLContext initializedContext(SSLContext sslContext) {
    verifyAndroidContextSet();/*ww  w .  j  a  v a 2s. c  om*/
    if (sslContext == null) {
        try {
            sslContext = SSLContext.getInstance("TLS");
        } catch (NoSuchAlgorithmException e) {
            Log.wtf(TAG, "TLS not supported: " + e.getMessage());
            throw new RuntimeException("No support for TLS!");
        }
    }
    try {
        sslContext.init(null, MemorizingTrustManager.getInstanceList(androidContext), null);
    } catch (KeyManagementException e) {
        Log.wtf(TAG, "Ignoring unexpected KeyManagementException: " + e.getMessage());
    }
    return sslContext;
}

From source file:com.mobage.air.extension.Dispatcher.java

public static void dispatch(FREContext context, String eventType, Throwable exception) {
    try {/*ww  w  .j  av  a 2s.com*/
        JSONArray args = new JSONArray();

        args.put(exception.toString());
        for (StackTraceElement item : exception.getStackTrace()) {
            args.put(item.toString());
        }

        context.dispatchStatusEventAsync(eventType, args.toString());
    } catch (Exception e) {
        Log.wtf(TAG, e);
    }
}

From source file:origamiduck.com.polarbear.MyDatabase.AsyncRecipe.java

@Override
protected void onPostExecute(String s) {
    super.onPostExecute(s);
    Log.wtf("RESULT", s);
}