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.irccloud.android.HTTPFetcher.java
private void http_thread() { try {// w ww.j ava 2 s.c o m mThread.setName("http-stream-thread"); int port = (mURI.getPort() != -1) ? mURI.getPort() : (mURI.getProtocol().equals("https") ? 443 : 80); String path = TextUtils.isEmpty(mURI.getPath()) ? "/" : mURI.getPath(); if (!TextUtils.isEmpty(mURI.getQuery())) { path += "?" + mURI.getQuery(); } PrintWriter out = new PrintWriter(mSocket.getOutputStream()); if (mProxyHost != null && mProxyHost.length() > 0 && mProxyPort > 0) { out.print("CONNECT " + mURI.getHost() + ":" + port + " HTTP/1.0\r\n"); out.print("\r\n"); out.flush(); HybiParser.HappyDataInputStream stream = new HybiParser.HappyDataInputStream( mSocket.getInputStream()); // Read HTTP response status line. StatusLine statusLine = parseStatusLine(readLine(stream)); if (statusLine == null) { throw new HttpException("Received no reply from server."); } else if (statusLine.getStatusCode() != HttpStatus.SC_OK) { throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); } // Read HTTP response headers. while (!TextUtils.isEmpty(readLine(stream))) ; if (mURI.getProtocol().equals("https")) { mSocket = getSSLSocketFactory().createSocket(mSocket, mURI.getHost(), port, false); SSLSocket s = (SSLSocket) mSocket; try { s.setEnabledProtocols(ENABLED_PROTOCOLS); } catch (IllegalArgumentException e) { //Not supported on older Android versions } try { s.setEnabledCipherSuites(ENABLED_CIPHERS); } catch (IllegalArgumentException e) { //Not supported on older Android versions } out = new PrintWriter(mSocket.getOutputStream()); } } if (mURI.getProtocol().equals("https")) { SSLSocket s = (SSLSocket) mSocket; StrictHostnameVerifier verifier = new StrictHostnameVerifier(); if (!verifier.verify(mURI.getHost(), s.getSession())) throw new SSLException("Hostname mismatch"); } Crashlytics.log(Log.DEBUG, TAG, "Sending HTTP request"); out.print("GET " + path + " HTTP/1.0\r\n"); out.print("Host: " + mURI.getHost() + "\r\n"); if (mURI.getHost().equals(NetworkConnection.IRCCLOUD_HOST) && NetworkConnection.getInstance().session != null && NetworkConnection.getInstance().session.length() > 0) out.print("Cookie: session=" + NetworkConnection.getInstance().session + "\r\n"); out.print("Connection: close\r\n"); out.print("Accept-Encoding: gzip\r\n"); out.print("User-Agent: " + NetworkConnection.getInstance().useragent + "\r\n"); out.print("\r\n"); out.flush(); HybiParser.HappyDataInputStream stream = new HybiParser.HappyDataInputStream(mSocket.getInputStream()); // Read HTTP response status line. StatusLine statusLine = parseStatusLine(readLine(stream)); if (statusLine != null) Crashlytics.log(Log.DEBUG, TAG, "Got HTTP response: " + statusLine); if (statusLine == null) { throw new HttpException("Received no reply from server."); } else if (statusLine.getStatusCode() != HttpStatus.SC_OK && statusLine.getStatusCode() != HttpStatus.SC_MOVED_PERMANENTLY) { Crashlytics.log(Log.ERROR, TAG, "Failure: " + mURI + ": " + statusLine.getStatusCode() + " " + statusLine.getReasonPhrase()); throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); } // Read HTTP response headers. String line; boolean gzipped = false; while (!TextUtils.isEmpty(line = readLine(stream))) { Header header = parseHeader(line); if (header.getName().equalsIgnoreCase("content-encoding") && header.getValue().equalsIgnoreCase("gzip")) gzipped = true; if (statusLine.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY && header.getName().equalsIgnoreCase("location")) { Crashlytics.log(Log.INFO, TAG, "Redirecting to: " + header.getValue()); mURI = new URL(header.getValue()); mSocket.close(); mSocket = null; mThread = null; connect(); return; } } if (gzipped) onStreamConnected(new GZIPInputStream(mSocket.getInputStream())); else onStreamConnected(mSocket.getInputStream()); onFetchComplete(); } catch (Exception ex) { NetworkConnection.printStackTraceToCrashlytics(ex); onFetchFailed(); } }
From source file:com.kth.common.utils.etc.LogUtil.java
/** * ERROR ? ? ?. */ public static boolean isErrorEnabled() { return Log.isLoggable(TAG, Log.ERROR); }
From source file:com.google.firebase.codelab.friendlychat.activity.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.crash_menu: FirebaseCrash.logcat(Log.ERROR, TAG, "crash caused"); causeCrash();//from ww w .j a v a 2s .c o m return true; case R.id.invite_menu: sendInvitation(); return true; case R.id.fresh_config_menu: // fetchConfig(); // Intent i = new Intent(MainActivity.this, FirebaseTestActivity.class); Intent i = new Intent(MainActivity.this, RadiusTestActivity.class); startActivity(i); return true; case R.id.sign_out_menu: mFirebaseAuth.signOut(); mUsername = ANONYMOUS; startActivity(new Intent(this, SignInActivity.class)); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.bisonswap.bisonswap.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.invite_menu: sendInvitation();//from w w w. j a va2 s.com return true; case R.id.crash_menu: FirebaseCrash.logcat(Log.ERROR, TAG, "crash caused"); causeCrash(); return true; case R.id.sign_out_menu: mFirebaseAuth.signOut(); Auth.GoogleSignInApi.signOut(mGoogleApiClient); mFirebaseUser = null; mUsername = ANONYMOUS; mPhotoUrl = null; startActivity(new Intent(this, SignInActivity.class)); return true; case R.id.fresh_config_menu: fetchConfig(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.ofalvai.bpinfo.api.bkkfutar.FutarApiClient.java
@NonNull private Map<String, Route> parseRoutes(@NonNull JSONObject response) throws JSONException { Map<String, Route> routeMap = new ArrayMap<>(); JSONObject dataNode = response.getJSONObject(AlertSearchContract.DATA); JSONObject referencesNode = dataNode.getJSONObject(AlertSearchContract.DATA_REFERENCES); JSONObject routesNode = referencesNode.getJSONObject(AlertSearchContract.DATA_REFERENCES_ROUTES); JSONArray routesArray = Utils.jsonObjectToArray(routesNode); for (int i = 0; i < routesArray.length(); i++) { JSONObject routeNode = routesArray.getJSONObject(i); Route route;//from w w w . j a v a 2 s.c om try { route = parseRoute(routeNode); // Replacement routes are inconsistent and unnecessary to display if (!Utils.isRouteReplacement(route.getId())) { routeMap.put(route.getId(), route); } } catch (JSONException ex) { Crashlytics.log(Log.ERROR, TAG, "Route parse: failed at index " + i + ":\n" + routeNode.toString()); } } return routeMap; }
From source file:com.bisonswap.bisonswap.Chat.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.home: startActivity(new Intent(this, MainActivity.class)); return true; case R.id.invite_menu: sendInvitation();// ww w . j av a 2 s . co m return true; case R.id.crash_menu: FirebaseCrash.logcat(Log.ERROR, TAG, "crash caused"); causeCrash(); return true; case R.id.sign_out_menu: mFirebaseAuth.signOut(); Auth.GoogleSignInApi.signOut(mGoogleApiClient); mFirebaseUser = null; mUsername = ANONYMOUS; mPhotoUrl = null; startActivity(new Intent(this, SignIn.class)); return true; case R.id.fresh_config_menu: fetchConfig(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:eu.liveandgov.ar.core.ARViewFragment.java
@Override public boolean onTouch(View v, MotionEvent event) { IGeometry geometry = null;//from ww w . j a v a 2 s .c o m if (mRendererInitialized && event.getAction() == MotionEvent.ACTION_UP) { try { final int xCenter = (int) event.getX(); final int yCenter = (int) event.getY(); for (int i = 0; i < 25; i++) { int xPen = i / 5 - 2; int yPen = i % 5 - 2; int x = xCenter + xPen; int y = yCenter + yPen; // ask the SDK if a geometry has been hit geometry = metaioSDK.getGeometryFromScreenCoordinates(x, y, true); if (geometry != null) break; } if (geometry != null) { MetaioDebug.log("ARViewActivity geometry found: " + geometry); onGeometryTouched(geometry); } } catch (Exception e) { MetaioDebug.log(Log.ERROR, "onTouch: " + e.getMessage()); } } return true; }
From source file:eu.liveandgov.ar.core.ARViewFragment.java
@Override public void onLowMemory() { MetaioDebug.log(Log.ERROR, "Low memory"); MetaioDebug.logMemory(ctxL); }
From source file:com.google.android.marvin.mytalkback.ProcessorFocusAndSingleTap.java
/** * Attempts to place focus within a new window. *//*from w w w . j a v a 2s .c o m*/ private boolean ensureFocusConsistency(boolean shouldPlaceFocus) { AccessibilityNodeInfoCompat root = null; AccessibilityNodeInfoCompat focused = null; AccessibilityNodeInfoCompat inputFocused = null; AccessibilityNodeInfoCompat firstFocus = null; try { root = AccessibilityServiceCompatUtils.getRootInActiveWindow(mService); if (root == null) { return false; } // First, see if we've already placed accessibility focus. focused = root.findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY); if (focused != null) { if (AccessibilityNodeInfoUtils.shouldFocusNode(mService, focused)) { return true; } LogUtils.log(Log.VERBOSE, "Clearing focus from invalid node"); focused.performAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } // If not, should we attempt to place focus? if (!shouldPlaceFocus) { return false; } // Next, see if the system has placed input focus. inputFocused = root.findFocus(AccessibilityNodeInfo.FOCUS_INPUT); if (tryFocusing(inputFocused)) { return true; } // Finally, just try to focus the first focusable item. firstFocus = AccessibilityNodeInfoUtils.searchFromInOrderTraversal(mService, root, AccessibilityNodeInfoUtils.FILTER_SHOULD_FOCUS, NodeFocusFinder.SEARCH_FORWARD); if (tryFocusing(firstFocus)) { return true; } LogUtils.log(Log.ERROR, "Failed to place focus from new window"); return false; } finally { AccessibilityNodeInfoUtils.recycleNodes(root, focused, inputFocused, firstFocus); } }
From source file:com.radicaldynamic.groupinform.activities.AccountFolderList.java
public static void fetchFolderList(boolean fetchAnyway) { if (Collect.getInstance().getIoService().isSignedIn() || fetchAnyway) { if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, t + "fetching list of folders"); } else {//from ww w . j av a 2s. c om if (Collect.Log.DEBUG) Log.d(Collect.LOGTAG, t + "not signed in, skipping folder list fetch"); return; } // Try to ping the service to see if it is "up" String folderListUrl = Collect.getInstance().getInformOnlineState().getServerUrl() + "/folder/list"; String getResult = HttpUtils.getUrlData(folderListUrl); JSONObject jsonFolderList; try { jsonFolderList = (JSONObject) new JSONTokener(getResult).nextValue(); String result = jsonFolderList.optString(InformOnlineState.RESULT, InformOnlineState.ERROR); if (result.equals(InformOnlineState.OK)) { // Write out list of jsonFolders for later retrieval by loadFoldersList() JSONArray jsonFolders = jsonFolderList.getJSONArray("folders"); try { // Write out a folder list cache file FileOutputStream fos = new FileOutputStream( new File(Collect.getInstance().getCacheDir(), FileUtilsExtended.FOLDER_CACHE_FILE)); fos.write(jsonFolders.toString().getBytes()); fos.close(); } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "unable to write folder cache: " + e.toString()); e.printStackTrace(); } } else { // There was a problem.. handle it! } } catch (NullPointerException e) { // Communication error if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "no getResult to parse. Communication error with node.js server?"); e.printStackTrace(); } catch (JSONException e) { // Parse error (malformed result) if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "failed to parse getResult " + getResult); e.printStackTrace(); } }