List of usage examples for android.util Log ERROR
int ERROR
To view the source code for android.util Log ERROR.
Click Source Link
From source file:com.google.android.gcm.demo.model.SenderCollection.java
private void saveSenders() { File file = new File(mContext.getFilesDir(), GCM_SENDERS_FILE); JSONArray jsonArray = new JSONArray(); FileOutputStream out = null;/*w ww . j a v a 2s .co m*/ try { for (int i = 0; i < mSenders.size(); i++) { Sender sender = mSenders.get(mSenders.keyAt(i)); jsonArray.put(sender.toJson()); } out = new FileOutputStream(file); out.write(jsonArray.toString().getBytes()); } catch (IOException e) { mLogger.log(Log.ERROR, "Failed to write senders file.", e); } catch (JSONException e) { mLogger.log(Log.ERROR, "Failed to serialize senders.", e); } finally { if (out != null) { try { out.close(); } catch (IOException e) { // silently ignore } } } }
From source file:com.github.tony19.timber.loggly.JsonFormatterTest.java
@Test public void formatRendersErrorLevel() throws IOException { final JsonLog log = getLog(Log.ERROR, "tag", "message", new RuntimeException()); assertThat(log.level, is(equalTo("ERROR"))); }
From source file:com.github.marcosalis.kraken.cache.internal.AbstractDiskModelContentProxy.java
/** * Constructor for an {@link AbstractDiskModelContentProxy}.<br> * Takes care of initializing memory and disk caches. * //from w ww . j av a 2 s. com * @param context * @param mapper * TODO * @param modelClass * @param modelsInCache * @param diskFolder * @param expiration * @param loaderFactory * An (optional) custom {@link ModelDiskContentLoaderFactory} */ public AbstractDiskModelContentProxy(@Nonnull Context context, @Nonnull ObjectMapper mapper, @Nonnull Class<MODEL> modelClass, int modelsInCache, @Nonnull String diskFolder, long expiration, ModelDiskContentLoaderFactory<CacheableRequest<MODEL>, MODEL> loaderFactory) { // initialize memory LRU caches mModelCache = new ContentLruCache<String, ExpirableFutureTask<MODEL>>(modelsInCache); try { // initialize disk caches mModelDisk = new ModelDiskCache<MODEL>(context, mapper, diskFolder, modelClass); } catch (IOException e) { // something went wrong. TODO: handle this! LogUtils.log(Log.ERROR, TAG, "Unable to create disk cache for " + diskFolder); } if (loaderFactory != null) { mContentLoader = loaderFactory.getContentLoader(mModelCache, mModelDisk); } else { mContentLoader = new DiskContentLoader<MODEL>(mModelCache, mModelDisk, expiration, null, null); } mExpiration = expiration; }
From source file:org.thoughtland.xlocation.Util.java
public static void bug(XHook hook, Throwable ex) { int priority; if (ex instanceof ActivityShare.AbortException) priority = Log.WARN;//from w ww . j a va 2 s . c o m else if (ex instanceof ActivityShare.ServerException) priority = Log.WARN; else if (ex instanceof ConnectTimeoutException) priority = Log.WARN; else if (ex instanceof FileNotFoundException) priority = Log.WARN; else if (ex instanceof HttpHostConnectException) priority = Log.WARN; else if (ex instanceof NoClassDefFoundError) priority = Log.WARN; else if (ex instanceof OutOfMemoryError) priority = Log.WARN; else if (ex instanceof RuntimeException) priority = Log.WARN; else if (ex instanceof SecurityException) priority = Log.WARN; else if (ex instanceof SocketTimeoutException) priority = Log.WARN; else if (ex instanceof SSLPeerUnverifiedException) priority = Log.WARN; else if (ex instanceof TransactionTooLargeException) priority = Log.WARN; else if (ex instanceof UnknownHostException) priority = Log.WARN; else priority = Log.ERROR; boolean xlocation = false; for (StackTraceElement frame : ex.getStackTrace()) if (frame.getClassName() != null && frame.getClassName().startsWith("org.thoughtland.xlocation")) { xlocation = true; break; } if (!xlocation) priority = Log.WARN; log(hook, priority, ex.toString() + " uid=" + Process.myUid() + "\n" + Log.getStackTraceString(ex)); }
From source file:com.streamdataio.android.stockmarket.StockMarketList.java
/** * Closes the event source connection and dereference the EventSource object *//*from w w w. j av a 2 s. c o m*/ private void disconnect() { // Disconnect the eventSource Handler if (eventSource != null && eventSource.isConnected()) { try { eventSource.close(); } catch (Exception e) { if (Log.isLoggable(TAG, Log.ERROR)) { Log.e(TAG, "Error on closing SSE", e); } } } // Dereferencing variable eventSource = null; }
From source file:com.facebook.internal.ServerProtocol.java
public static Bundle getQueryParamsForPlatformActivityIntentWebFallback(Context context, String callId, int version, String applicationName, Bundle methodArgs) { String keyHash = Settings.getApplicationSignature(context); if (Utility.isNullOrEmpty(keyHash)) { return null; }//from w ww .ja va 2 s.c o m Bundle webParams = new Bundle(); webParams.putString(FALLBACK_DIALOG_PARAM_KEY_HASH, keyHash); webParams.putString(FALLBACK_DIALOG_PARAM_APP_ID, Settings.getApplicationId()); webParams.putInt(FALLBACK_DIALOG_PARAM_VERSION, version); webParams.putString(DIALOG_PARAM_DISPLAY, FALLBACK_DIALOG_DISPLAY_VALUE_TOUCH); Bundle bridgeArguments = new Bundle(); bridgeArguments.putString(NativeProtocol.BRIDGE_ARG_ACTION_ID_STRING, callId); bridgeArguments.putString(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, applicationName); methodArgs = (methodArgs == null) ? new Bundle() : methodArgs; try { JSONObject bridgeArgsJSON = BundleJSONConverter.convertToJSON(bridgeArguments); JSONObject methodArgsJSON = BundleJSONConverter.convertToJSON(methodArgs); if (bridgeArgsJSON == null || methodArgsJSON == null) { return null; } webParams.putString(FALLBACK_DIALOG_PARAM_BRIDGE_ARGS, bridgeArgsJSON.toString()); webParams.putString(FALLBACK_DIALOG_PARAM_METHOD_ARGS, methodArgsJSON.toString()); } catch (JSONException je) { webParams = null; Logger.log(LoggingBehavior.DEVELOPER_ERRORS, Log.ERROR, TAG, "Error creating Url -- " + je); } return webParams; }
From source file:com.googlecode.eyesfree.brailleback.FocusFinder.java
private static AccessibilityNodeInfoCompat findLastFocusableDescendantInternal(AccessibilityNodeInfoCompat root, Context context, HashSet<AccessibilityNodeInfoCompat> seenNodes) { for (int end = root.getChildCount(), i = end - 1; i >= 0; --i) { AccessibilityNodeInfoCompat child = root.getChild(i); if (child == null) { continue; }//from w w w . jav a 2 s .c o m AccessibilityNodeInfoCompat n = findLastFocusableDescendantInternal(child, context, seenNodes); if (n != null) { return n; } if (AccessibilityNodeInfoUtils.shouldFocusNode(context, child)) { return child; } if (!seenNodes.add(child)) { LogUtils.log(FocusFinder.class, Log.ERROR, "Cycle in node tree"); child.recycle(); return null; } } return null; }
From source file:com.pomelodesign.cordova.metaio.MetaioPlugin.java
@Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { if (action.equals("open")) { MetaioDebug.log("Metaio open..."); try {/*w w w .j a va2s . c om*/ cordova.getActivity().runOnUiThread(new Runnable() { public void run() { if (mTask == null) { mTask = new AssetsExtracter(); mTask.execute(0); } else { mTask.onPostExecute(true); } callbackContext.success(); } }); loaded = true; return true; } catch (Exception e) { MetaioDebug.log(Log.ERROR, "Error opening metaio: " + e.getMessage()); MetaioDebug.printStackTrace(Log.ERROR, e); callbackContext.error("Error opening metaio"); return false; } } else if (action.compareTo("destroy") == 0) { MetaioDebug.log("Metaio destroy..."); try { if (loaded == true) { cordova.getActivity().runOnUiThread(new Runnable() { public void run() { ARELViewActivity.removeARELView(); loaded = false; callbackContext.success(); } }); return true; } callbackContext.error("Error detroying metaio, metaio not loaded"); return true; } catch (Exception e) { MetaioDebug.log(Log.ERROR, "Error destroying metaio: " + e.getMessage()); MetaioDebug.printStackTrace(Log.ERROR, e); callbackContext.error("Error detroying metaio"); return false; } } else if (action.compareTo("close") == 0) { MetaioDebug.log("Metaio close..."); try { if (cordovaIntent == null) { cordovaIntent = new Intent(MetaioPlugin.getContext().getApplicationContext(), this.cordova.getClass()); } cordovaIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); MetaioPlugin.getContext().startActivity(cordovaIntent); Url = args.getString(0); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { String url = Url; if (url != null && url.length() > 0 && url.compareTo("null") != 0) { mPlugin.webView .loadUrl("javascript:cordova.fireDocumentEvent('metaioclose', { 'detail': '" + url + "' })"); } else { mPlugin.webView.loadUrl("javascript:cordova.fireDocumentEvent('metaioclose')"); } } }); callbackContext.success(); return true; } catch (Exception e) { MetaioDebug.log(Log.ERROR, "Error hiding metaio: " + e.getMessage()); MetaioDebug.printStackTrace(Log.ERROR, e); callbackContext.error("Error closing metaio"); return false; } } return false; }
From source file:com.android.talkback.labeling.CustomLabelMigrationManager.java
private void createLabelFileAsync(final List<Label> labels, final OnLabelMigrationCallback callback) { mExecutor.execute(new Runnable() { @Override//from ww w.ja va2s. co m public void run() { try { String jsonText = generateJsonText(labels); if (jsonText != null) { final File file = getFilePath(); writeToFile(jsonText, file); if (callback != null) { mHandler.post(new Runnable() { @Override public void run() { callback.onLabelsExported(file); } }); } } else { notifyFailure(callback); } } catch (Exception e) { notifyFailure(callback); LogUtils.log(Log.ERROR, "Failed to export labels"); } } }); }
From source file:biz.bokhorst.xprivacy.Util.java
public static void bug(XHook hook, Throwable ex) { if (ex instanceof InvocationTargetException) { InvocationTargetException exex = (InvocationTargetException) ex; if (exex.getTargetException() != null) ex = exex.getTargetException(); }/*from w ww . ja v a 2 s. co m*/ int priority; if (ex instanceof ActivityShare.AbortException) priority = Log.WARN; else if (ex instanceof ActivityShare.ServerException) priority = Log.WARN; else if (ex instanceof ConnectTimeoutException) priority = Log.WARN; else if (ex instanceof FileNotFoundException) priority = Log.WARN; else if (ex instanceof HttpHostConnectException) priority = Log.WARN; else if (ex instanceof NameNotFoundException) priority = Log.WARN; else if (ex instanceof NoClassDefFoundError) priority = Log.WARN; else if (ex instanceof OutOfMemoryError) priority = Log.WARN; else if (ex instanceof RuntimeException) priority = Log.WARN; else if (ex instanceof SecurityException) priority = Log.WARN; else if (ex instanceof SocketTimeoutException) priority = Log.WARN; else if (ex instanceof SSLPeerUnverifiedException) priority = Log.WARN; else if (ex instanceof StackOverflowError) priority = Log.WARN; else if (ex instanceof TransactionTooLargeException) priority = Log.WARN; else if (ex instanceof UnknownHostException) priority = Log.WARN; else if (ex instanceof UnsatisfiedLinkError) priority = Log.WARN; else priority = Log.ERROR; boolean xprivacy = false; for (StackTraceElement frame : ex.getStackTrace()) if (frame.getClassName() != null && frame.getClassName().startsWith("biz.bokhorst.xprivacy")) { xprivacy = true; break; } if (!xprivacy) priority = Log.WARN; log(hook, priority, ex.toString() + " uid=" + Process.myUid() + "\n" + Log.getStackTraceString(ex)); }