List of usage examples for android.util Log wtf
public static int wtf(String tag, Throwable tr)
From source file:org.jivesoftware.spark.util.DummySSLSocketFactory.java
public Socket createSocket(InetAddress inaddr, int i, InetAddress inaddr2, int j) throws IOException { AsyncTask<Object, Void, Object> socketCreationTask = new AsyncTask<Object, Void, Object>() { @Override//from w w w. ja v a 2 s . c o m protected Object doInBackground(Object... params) { Object ret; try { ret = factory.createSocket((InetAddress) params[0], (int) params[1], (InetAddress) params[2], (int) params[3]); } catch (Exception e) { Log.wtf("F4 :" + 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, inaddr, i, inaddr2, j); Object returned; try { returned = socketCreationTask.get(); } catch (InterruptedException | ExecutionException e) { Log.wtf("F5 :" + 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:com.balch.mocktrade.finance.FinanceYQLModel.java
@Override public void getQuotes(final List<String> symbols, final RequestListener<Map<String, Quote>> listener) { final CountDownLatch latch = new CountDownLatch(2); final Map<String, Quote> yqlQuotes = new HashMap<String, Quote>(); final Map<String, Quote> googleQuotes = new HashMap<String, Quote>(); final StringBuilder errorMessages = new StringBuilder(); this.getYQLQuotes(symbols, new RequestListener<Map<String, Quote>>() { @Override/*from ww w .j ava 2 s. co m*/ public void onResponse(Map<String, Quote> response) { try { yqlQuotes.putAll(response); } finally { latch.countDown(); } } @Override public void onErrorResponse(String error) { errorMessages.append(error).append("\n"); latch.countDown(); } }); this.getGoogleRealTimeQuotes(symbols, new RequestListener<Map<String, Quote>>() { @Override public void onResponse(Map<String, Quote> response) { try { googleQuotes.putAll(response); } finally { latch.countDown(); } } @Override public void onErrorResponse(String error) { errorMessages.append(error).append("\n"); latch.countDown(); } }); try { // wait for both requests to finish latch.await(); if (errorMessages.length() == 0) { // add google's realtime quotes on top of yql quotes for (Quote q : googleQuotes.values()) { Quote yqlQuote = yqlQuotes.get(q.getSymbol()); if (yqlQuote != null) { yqlQuote.setPrice(q.getPrice()); yqlQuote.setLastTradeTime(q.getLastTradeTime()); } else { Log.wtf(TAG, "GoogleQuote contains a symbol that is not in the yqlQuote map. GoogleQuote Symbol:" + q.getSymbol() + " Submitted Symbols:" + TextUtils.join(",", symbols)); } } listener.onResponse(yqlQuotes); } else { listener.onErrorResponse(errorMessages.toString()); } } catch (InterruptedException e) { } }
From source file:com.achep.acdisplay.ui.activities.MainActivity.java
private void handleAppUpgrade() { PackageInfo pi;/*from w w w . ja v a 2s . c om*/ try { pi = getPackageManager().getPackageInfo(PackageUtils.getName(this), 0); } catch (PackageManager.NameNotFoundException e) { Log.wtf(TAG, "Failed to find my PackageInfo."); return; } Config.Triggers triggers = mConfig.getTriggers(); final int versionCode = pi.versionCode; final int versionCodeOld = triggers.getPreviousVersion(); if (versionCodeOld < versionCode) { triggers.setPreviousVersion(this, pi.versionCode, null); if (versionCodeOld <= 34 /* version 3.0.2 */) { DialogHelper.showCompatDialog(MainActivity.this); } } }
From source file:edu.stanford.mobisocial.dungbeetle.model.DbObject.java
/** * Use SocialKit Obj implementations.//from w ww . j av a2 s .co m */ @Deprecated public static DbObject fromCursor(Cursor c) { try { return new DbObject(c); } catch (Exception e) { Log.wtf("Bad data from db", e); return null; } }
From source file:at.bitfire.davdroid.resource.RemoteCollection.java
public Resource get(Resource resource) throws URISyntaxException, IOException, HttpException, DavException, InvalidResourceException { WebDavResource member = new WebDavResource(collection, resource.getName()); if (resource instanceof Contact) member.get(Contact.MIME_TYPE);/* w w w .j a va 2 s . co m*/ else if (resource instanceof Event) member.get(Event.MIME_TYPE); else { Log.wtf(TAG, "Should fetch something, but neither contact nor calendar"); throw new InvalidResourceException("Didn't now which MIME type to accept"); } byte[] data = member.getContent(); if (data == null) throw new DavNoContentException(); @Cleanup InputStream is = new ByteArrayInputStream(data); try { resource.parseEntity(is, getDownloader()); } catch (VCardParseException e) { throw new InvalidResourceException(e); } return resource; }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment51.java
public void start(final Context context) { // Write the correct ip of your local conection. // The port (8081) must not be changed String URL = "http://125.131.73.198:8081"; DoRead.DoReadCallback callback = new DoRead.DoReadCallback() { @Override/*from w ww . j a v a2 s . c o m*/ public void onFinish(MjpegInputStream result) { Log.wtf("MainFragment51", "onFinish"); mv.setBackgroundColor(Color.TRANSPARENT); mv.setSource(result); mv.setDisplayMode(MjpegView.SIZE_BEST_FIT); showFps = !showFps; mv.showFps(showFps); } @Override public void onError(String errorMsg) { Log.wtf("Error", errorMsg); createDialog(context); dialog.show(); } }; new DoRead(callback, context).execute(URL); }
From source file:de.damdi.fitness.activity.create_workout.ExerciseTypeDetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.exercise_detail_menu, menu); // configure menu_item_add_exercise MenuItem menu_item_add_exercise = (MenuItem) menu.findItem(R.id.menu_item_add_exercise); menu_item_add_exercise.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // assert, that an exercise was choosen if (mExercise == null) { Log.wtf(TAG, "No exercise has been choosen. This should not happen"); return true; }//from w w w. j a v a 2s. com // add exercise to workout or create a new one if (mWorkout == null) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity()); String defaultWorkoutName = settings.getString("default_workout_name", "Workout"); mWorkout = new Workout(defaultWorkoutName, new FitnessExercise(mExercise)); } else { // assert that there is not already such an exercise in the // workout for (FitnessExercise fEx : mWorkout.getFitnessExercises()) { if (fEx.getExType().equals(mExercise)) { Toast.makeText(getActivity(), getString(R.string.exercise_already_in_workout), Toast.LENGTH_LONG).show(); return true; } } mWorkout.addFitnessExercise(new FitnessExercise(mExercise)); } // update Workout in Activity if (getActivity() instanceof Callbacks) { // was launched by ExerciseTypeListActivity ((Callbacks) getActivity()).onWorkoutChanged(mWorkout); } else { // was launched by ExerciseTypeDetailActivity Intent i = new Intent(); i.putExtra(ExerciseTypeListActivity.ARG_WORKOUT, mWorkout); getActivity().setResult(Activity.RESULT_OK, i); getActivity().finish(); } Toast.makeText(getActivity(), getString(R.string.exercise) + " " + mExercise.getLocalizedName() + " " + getString(R.string.has_been_added), Toast.LENGTH_SHORT).show(); return true; } }); // configure menu_item_license_info MenuItem menu_item_license_info = (MenuItem) menu.findItem(R.id.menu_item_license_info); menu_item_license_info.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.license_info)); String license = ""; if (mExercise.getImageLicenseMap().values().iterator().hasNext()) { license = mExercise.getImageLicenseMap().values().iterator().next(); } else { license = getString(R.string.no_license_available); } builder.setMessage(license); builder.create().show(); return true; } }); // configure menu_item_description MenuItem menu_item_description = (MenuItem) menu.findItem(R.id.menu_item_description); menu_item_description.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { if (mExercise.getDescription() == null || mExercise.getDescription().equals("")) { Toast.makeText(getActivity(), getString(R.string.no_description_available), Toast.LENGTH_LONG) .show(); return true; } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.description)); builder.setMessage(Html.fromHtml(mExercise.getDescription())); builder.create().show(); return true; } }); }
From source file:gxu.software_engineering.market.android.activity.NewItemActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish();// w ww . j a va 2 s. c o m break; case R.id.discard: finish(); break; case R.id.done: Toast.makeText(this, R.string.submit, Toast.LENGTH_SHORT).show(); Log.i("null???", String.format("%s", this.name == null)); String[] data = resolveData(); try { long uid = MarketApp.marketApp().getPrefs().getLong(C.UID, -1); ContentValues values = new PostToCloud() .execute(cid + "", uid + "", data[0], data[1], data[2], data[3]).get(); Log.i("items>>>", values.toString()); getContentResolver().insert(Uri.parse(C.BASE_URI + C.ITEMS), values); Toast.makeText(this, R.string.publish_ok, Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, ItemActivity.class); intent.putExtra(C.ID, values.getAsLong(C._ID)); startActivity(intent); } catch (Exception e) { Log.wtf("receive result error!", e); Toast.makeText(this, R.string.publish_fail, Toast.LENGTH_SHORT).show(); } break; default: break; } return false; }
From source file:edu.stanford.mobisocial.dungbeetle.model.DbObject.java
/** * Use SocialKit Obj implementations.//ww w . j av a 2s .c o m */ @Deprecated private DbObject(Cursor c) { mType = c.getString(c.getColumnIndexOrThrow(DbObject.TYPE)); String jsonStr = c.getString(c.getColumnIndexOrThrow(DbObject.JSON)); try { mRaw = c.getBlob(c.getColumnIndexOrThrow(DbObject.RAW)); } catch (IllegalArgumentException e) { mRaw = null; } try { mJson = new JSONObject(jsonStr); } catch (JSONException e) { Log.wtf("DB", "Bad json from database."); } //mTimestamp = c.getLong(c.getColumnIndexOrThrow(DbObject.TIMESTAMP)); }
From source file:com.pixmob.r2droid.DeviceRegistrationService.java
@Override protected void handleAction(Intent intent) throws ActionExecutionFailedException, InterruptedException { startForeground();/*from w w w . j a v a2s . c om*/ final String action = intent.getAction(); if (ACTION_CONNECT.equals(action)) { try { connect(); } finally { stopForeground(false); } } else if (ACTION_DISCONNECT.equals(action)) { try { disconnect(); } finally { stopForeground(false); } } else if (ACTION_C2DM_REGISTERED.equals(action)) { try { onC2DMRegistered(); } finally { stopForeground(true); } } else if (ACTION_C2DM_UNREGISTERED.equals(action)) { try { onC2DMUnregistered(); } finally { stopForeground(true); } } else { Log.wtf(TAG, "Unsupported action: " + action); } }