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:org.couchbase.health.PoolHealthReader.java

/**
 * Get the state from all of the nodes in the cluster
 * /*from w ww  . ja v a2 s .co  m*/
 * @return an array containing all of the servers in the cluster. This
 *         should be refactored to return a host object so that we could
 *         provide more information about the failing nodes..
 * @throws IOException
 *             if we fail to send/receive data on the network
 */
public State[] getStates() throws IOException {

    if (poolUrl == null) {
        bootstrap();
    }

    String json = spider.download(poolUrl);
    try {
        JSONObject root = (JSONObject) (new JSONTokener(json)).nextValue();
        JSONArray nodes = root.getJSONArray("nodes");
        State[] ret = new State[nodes.length()];

        for (int ii = 0; ii < nodes.length(); ++ii) {
            JSONObject obj = nodes.optJSONObject(ii);
            String status = obj.getString("status");
            if (status.equalsIgnoreCase("healthy")) {
                ret[ii] = State.GOOD;
            } else {
                ret[ii] = State.BAD;
            }
        }
        return ret;
    } catch (JSONException e) {
        Log.wtf("Failed to decode JSON response", e);
        throw new IOException("Invalid data returned from server");
    }
}

From source file:org.jivesoftware.spark.util.DummySSLSocketFactory.java

public Socket createSocket(Socket socket, String s, int i, boolean flag) throws IOException {
    AsyncTask<Object, Void, Object> socketCreationTask = new AsyncTask<Object, Void, Object>() {
        @Override/*from   ww  w  . j  a v a  2s  .c  om*/
        protected Object doInBackground(Object... params) {
            Object ret;
            try {
                ret = factory.createSocket((Socket) params[0], (String) params[1], (int) params[2],
                        (boolean) params[3]);
            } catch (Exception e) {
                Log.wtf("F2 :" + getClass().getName(), e);
                ret = e;
            }
            return ret;
        }
    };
    //It's necessary to run the task in an executor because the main one is already full and if we
    // add this one a livelock will occur
    ExecutorService socketCreationExecutor = Executors.newFixedThreadPool(1);
    socketCreationTask.executeOnExecutor(socketCreationExecutor, socket, s, i, flag);
    Object returned;
    try {
        returned = socketCreationTask.get();
    } catch (InterruptedException | ExecutionException e) {
        Log.wtf("F3 :" + getClass().getName(), e);
        throw new IOException("Failure intentionally provoked. See log above.");
    }

    if (returned instanceof Exception) {
        throw (IOException) returned;
    } else {
        return (Socket) returned;
    }
}

From source file:de.jadehs.jadehsnavigator.fragment.NewsFragment.java

public void initializeRSSFeeds() {
    // try to load from db
    Log.wtf(TAG, "Starting initializeRSSFeeds");
    try {//from w  w w .j av  a2s  .  c om
        /* Open datasource and create View */
        this.datasource = new NewsItemDataSource(getActivity().getApplicationContext());
        this.datasource.open();
        //ArrayList<RSSItem> infoSysItems = this.datasource.getInfoSysItemsFromFB(this.preferences.getFB());
        ArrayList<RSSItem> rssItems = this.datasource.getAllRSSItems();

        processFinish(rssItems); // create View

        this.datasource.close();

        // try to update
        updateRSSFeeds();
    } catch (Exception ex) {
        Log.wtf(TAG, "DATABASE LOAD", ex);
    }
}

From source file:com.google.android.gms.common.C0270e.java

public static int m3379a(Context context) {
    PackageManager packageManager = context.getPackageManager();
    if (!C0418g.f2234a) {
        try {/*from w  w  w .  j  a v  a 2 s.co m*/
            context.getResources().getString(R.common_google_play_services_unknown_issue);
        } catch (Throwable th) {
            Log.e("GooglePlayServicesUtil",
                    "The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.");
        }
    }
    if (!C0418g.f2234a) {
        C0270e.m3398c(context);
    }
    try {
        PackageInfo packageInfo = packageManager.getPackageInfo("com.google.android.gms", 64);
        C0399i a = C0399i.m3510a();
        if (!C0516u.m4168c(packageInfo.versionCode) && !C0516u.m4166a(context)) {
            try {
                if (a.m3512a(packageManager.getPackageInfo("com.android.vending", 64), C0373r.f2177a) == null) {
                    Log.w("GooglePlayServicesUtil", "Google Play Store signature invalid.");
                    return 9;
                }
                if (a.m3512a(packageInfo, a.m3512a(packageManager.getPackageInfo("com.android.vending", 64),
                        C0373r.f2177a)) == null) {
                    Log.w("GooglePlayServicesUtil", "Google Play services signature invalid.");
                    return 9;
                }
            } catch (NameNotFoundException e) {
                Log.w("GooglePlayServicesUtil", "Google Play Store is missing.");
                return 9;
            }
        } else if (a.m3512a(packageInfo, C0373r.f2177a) == null) {
            Log.w("GooglePlayServicesUtil", "Google Play services signature invalid.");
            return 9;
        }
        if (C0516u.m4165a(packageInfo.versionCode) < C0516u.m4165a(7095000)) {
            Log.w("GooglePlayServicesUtil",
                    "Google Play services out of date.  Requires 7095000 but found " + packageInfo.versionCode);
            return 2;
        }
        try {
            return !packageManager.getApplicationInfo("com.google.android.gms", 0).enabled ? 3 : 0;
        } catch (NameNotFoundException e2) {
            Log.wtf("GooglePlayServicesUtil", "Google Play services missing when getting application info.");
            e2.printStackTrace();
            return 1;
        }
    } catch (NameNotFoundException e3) {
        Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
        return 1;
    }
}

From source file:conexionSiabra.ConexionSiabra.java

public boolean obtenerAccessToken(String verificador) {
    boolean result = false;
    verificador = verificador.trim(); // Le quitamos espacios finales ya que
    // a veces los navegadores los
    // insertan al hacer copy
    if (oauth.obtainAccessToken(verificador)) {
        db.addOauth(oauth);//from w  w w  . j  ava 2  s.com
        Log.wtf("exito", "en DB");
        result = true;
    }

    return result;
}

From source file:gxu.software_engineering.market.android.ui.RegisterBoxFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Holo_Dialog);
    final View v = getActivity().getLayoutInflater().inflate(R.layout.register, null);
    builder.setIcon(R.drawable.social_add_person).setTitle(R.string.register);
    return builder.setView(v).setNegativeButton(R.string.no, null)
            .setPositiveButton(R.string.ok, new OnClickListener() {
                @Override//from   w  w w.ja v  a 2s.  c  o m
                public void onClick(DialogInterface dialog, int which) {
                    String[] data = data(v);
                    ContentValues user = null;
                    try {
                        user = new Post2Server().execute(data).get();
                    } catch (Exception e) {
                        Log.wtf("register error!", e);
                        Toast.makeText(getActivity(), R.string.register_fail, Toast.LENGTH_SHORT).show();
                    }
                    Toast.makeText(getActivity(), R.string.register_ok, Toast.LENGTH_SHORT).show();
                    if (user != null) {
                        getActivity().getContentResolver().insert(Uri.parse(C.BASE_URI + C.USERS), user);
                    } else {
                        Toast.makeText(getActivity(), R.string.register_fail, Toast.LENGTH_SHORT).show();
                    }
                }
            }).create();
}

From source file:com.softminds.matrixcalculator.base_activities.FillingMatrix.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean isDark = preferences.getBoolean("DARK_THEME_KEY", false);
    boolean SmartFit = preferences.getBoolean("SMART_FIT_KEY", false);

    if (isDark)/* w  ww .  j a  v a  2s. c o  m*/
        setTheme(R.style.AppThemeDark_NoActionBar);
    else
        setTheme(R.style.AppTheme_NoActionBar);
    super.onCreate(savedInstanceState);

    Bundle bundle = getIntent().getExtras();
    if (bundle == null) {
        Log.wtf("FillingMatrix", "How the heck, it got called ??");
        Toast.makeText(getApplication(), R.string.unexpected_error, Toast.LENGTH_SHORT).show();
        finish();
    } else {
        col = bundle.getInt("COL");
        row = bundle.getInt("ROW");
    }
    setContentView(R.layout.filler);
    adCard = findViewById(R.id.AddCardFiller);

    if (!((GlobalValues) getApplication()).DonationKeyFound()) {
        AdView adView = findViewById(R.id.adViewFiller);
        AdRequest adRequest = new AdRequest.Builder().build();
        adView.setAdListener(new AdLoadListener(adCard));
        adView.loadAd(adRequest);
        if (getResources()
                .getConfiguration().orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE)
            adCard.setVisibility(View.INVISIBLE);
        else
            adCard.setVisibility(View.VISIBLE);
    } else
        ((ViewGroup) adCard.getParent()).removeView(adCard);

    Toolbar toolbar = findViewById(R.id.toolbarFill);
    setSupportActionBar(toolbar);

    CardView cardView = findViewById(R.id.DynamicCard);

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    String string = sharedPreferences.getString("ELEVATE_AMOUNT", "4");
    String string2 = sharedPreferences.getString("CARD_CHANGE_KEY", "#bdbdbd");

    cardView.setCardElevation(Integer.parseInt(string));

    CardView.LayoutParams params1 = new CardView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    GridLayout gridLayout = new GridLayout(getApplicationContext());
    gridLayout.setRowCount(row);
    gridLayout.setColumnCount(col);
    for (int i = 0; i < row; i++) {
        for (int j = 0; j < col; j++) {
            EditText editText = new EditText(getApplication());
            editText.setBackgroundColor(Color.parseColor(string2));
            editText.setId(i * 10 + j);
            if (isDark)
                editText.setTextColor(ContextCompat.getColor(this, R.color.white));
            editText.setGravity(Gravity.CENTER);
            SpannableStringBuilder stringBuilder = new SpannableStringBuilder(
                    "a" + String.valueOf(i + 1) + String.valueOf(j + 1));
            stringBuilder.setSpan(new SubscriptSpan(), 1, 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            stringBuilder.setSpan(new RelativeSizeSpan(0.75f), 1, 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            editText.setHint(stringBuilder);
            if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean("DECIMAL_USE", true)) {
                editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
            } else {
                editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
                        | InputType.TYPE_NUMBER_FLAG_SIGNED);
            }
            editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(getLength()) });
            if (SmartFit) {
                editText.setWidth(ConvertTopx(CalculatedWidth(col)));
                editText.setTextSize(SizeReturner(row, col,
                        PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
                                .getBoolean("EXTRA_SMALL_FONT", false)));
            } else {
                editText.setWidth(ConvertTopx(62));
                editText.setTextSize(SizeReturner(3, 3,
                        PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
                                .getBoolean("EXTRA_SMALL_FONT", false)));
            }
            editText.setSingleLine();
            GridLayout.Spec Row = GridLayout.spec(i, 1);
            GridLayout.Spec Col = GridLayout.spec(j, 1);
            GridLayout.LayoutParams params = new GridLayout.LayoutParams(Row, Col);
            params.leftMargin = params.topMargin = params.bottomMargin = params.rightMargin = getResources()
                    .getDimensionPixelOffset(R.dimen.border_width);
            gridLayout.addView(editText, params);
        }
    }
    gridLayout.setLayoutParams(params1);
    cardView.addView(gridLayout);
    MakeType((Type) (getIntent().getExtras().getSerializable("TYPE")));
    if (GetMaximum() < GetMinimum()) {
        final Snackbar snackbar;
        snackbar = Snackbar.make(findViewById(R.id.filling_matrix), R.string.Warning3,
                Snackbar.LENGTH_INDEFINITE);
        snackbar.show();
        snackbar.setAction(getString(R.string.action_settings), new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                snackbar.dismiss();
                Intent intent = new Intent(getApplicationContext(), SettingsTab.class);
                startActivity(intent);
                finish();
            }
        });
    }

}

From source file:com.knurld.alphabank.com.knurld.alphabank.request.MultipartRequest.java

@Override
protected VolleyError parseNetworkError(VolleyError volleyError) {
    if (volleyError.networkResponse != null && volleyError.networkResponse.data != null) {
        String error = new String(volleyError.networkResponse.data);
        volleyError = new VolleyError(error);
        Log.wtf(TAG, "Network Response " + new String(volleyError.networkResponse.data));
    }/*w w w  .j  a v a2 s.com*/
    return volleyError;
}

From source file:me.moxun.dreamcatcher.connector.util.KLog.java

private static void printLog(int type, String tagStr, String msg) {

    if (!IS_SHOW_LOG) {
        return;/*from   w  w  w  .j  av a2 s .c o m*/
    }

    String tag;
    if (tagStr == null) {
        tag = "DreamCatcher";
    } else {
        tag = "DreamCatcher-" + tagStr;
    }

    if (msg == null) {
        return;
    }

    StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();

    int index = 6;
    String className = stackTrace[index].getFileName();
    String methodName = stackTrace[index].getMethodName();
    int lineNumber = stackTrace[index].getLineNumber();

    methodName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1);

    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("(").append(className).append(":").append(lineNumber).append("").append(") ");

    if (msg != null && type != JSON) {
        stringBuilder.append(msg);
    }

    String logStr = stringBuilder.toString();

    switch (type) {
    case V:
        Log.v(tag, logStr);
        break;
    case D:
        Log.d(tag, logStr);
        break;
    case I:
        Log.i(tag, logStr);
        break;
    case W:
        Log.w(tag, logStr);
        break;
    case E:
        Log.e(tag, logStr);
        break;
    case A:
        Log.wtf(tag, logStr);
        break;
    case JSON: {

        if (TextUtils.isEmpty(msg)) {
            Log.d(tag, "Empty or Null json content");
            return;
        }

        String message = null;

        try {
            if (msg.startsWith("{")) {
                JSONObject jsonObject = new JSONObject(msg);
                message = jsonObject.toString(JSON_INDENT);
            } else if (msg.startsWith("[")) {
                JSONArray jsonArray = new JSONArray(msg);
                message = jsonArray.toString(JSON_INDENT);
            }
        } catch (JSONException e) {
            e(tag, e.getCause().getMessage() + "\n" + msg);
            return;
        }

        printLine(tag, true);
        message = logStr + LINE_SEPARATOR + message;
        String[] lines = message.split(LINE_SEPARATOR);
        StringBuilder jsonContent = new StringBuilder();
        for (String line : lines) {
            jsonContent.append(" ").append(line).append(LINE_SEPARATOR);
        }
        Log.d(tag, jsonContent.toString());
        printLine(tag, false);
    }
        break;
    }

}

From source file:de.jadehs.jadehsnavigator.fragment.InfoSysFragment.java

/**
 * Initial load of the InfoSys. This will try to load a number of InfoSys entries
 */// w w  w .jav a2s.c o  m
public void initializeInfoSys() {
    Log.wtf(TAG, "Starting initializeInfoSys");
    try {
        /* Open datasource and create View */
        this.preferences = new Preferences(getActivity().getApplicationContext());
        this.datasource = new InfoSysItemDataSource(getActivity().getApplicationContext());
        this.datasource.open();
        ArrayList<InfoSysItem> infoSysItems = this.datasource.getInfoSysItemsFromFB(this.preferences.getFB());

        processFinish(infoSysItems); // create View

        this.datasource.close();

        // try to update
        updateInfoSys(false);
    } catch (Exception ex) {
        Log.wtf(TAG, "DATABASE LOAD", ex);
    }
}