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, String msg, Throwable tr) 

Source Link

Document

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

Usage

From source file:at.bitfire.davdroid.mirakel.webdav.WebDavResource.java

protected void processMultiStatus(HttpResponse response) throws IOException, HttpException, DavException {
    if (response.getStatusLine().getStatusCode() != HttpStatus.SC_MULTI_STATUS)
        throw new DavNoMultiStatusException();

    HttpEntity entity = response.getEntity();
    if (entity == null)
        throw new DavNoContentException();
    @Cleanup//from  w w  w  .j  a v  a  2 s. c  o m
    InputStream content = entity.getContent();

    DavMultistatus multiStatus;
    try {
        Serializer serializer = new Persister();
        multiStatus = serializer.read(DavMultistatus.class, content, false);
    } catch (Exception ex) {
        throw new DavException("Couldn't parse Multi-Status response on REPORT multi-get", ex);
    }

    if (multiStatus.response == null) // empty response
        throw new DavNoContentException();

    // member list will be built from response
    List<WebDavResource> members = new LinkedList<WebDavResource>();

    for (DavResponse singleResponse : multiStatus.response) {
        URI href;
        try {
            href = location.resolve(URIUtils.sanitize(singleResponse.getHref().href));
        } catch (IllegalArgumentException ex) {
            Log.w(TAG, "Ignoring illegal member URI in multi-status response", ex);
            continue;
        }
        Log.d(TAG, "Processing multi-status element: " + href);

        // about which resource is this response?
        WebDavResource referenced = null;
        if (location.equals(href)) { // -> ourselves
            referenced = this;
        } else {

            if (!location.getRawPath().endsWith("/")) // this is only possible if location doesn't have a trailing slash
                try {
                    URI locationAsCollection = new URI(location.getScheme(), location.getAuthority(),
                            location.getPath() + "/", location.getQuery(), null);
                    if (locationAsCollection.equals(href)) {
                        Log.d(TAG, "Server implicitly appended trailing slash to " + locationAsCollection);
                        referenced = this;
                    }
                } catch (URISyntaxException e) {
                    Log.wtf(TAG, "Couldn't understand our own URI", e);
                }

            // otherwise, the referenced resource is a member
            if (referenced == null) {
                referenced = new WebDavResource(this, href);
                members.add(referenced);
            }
        }

        for (DavPropstat singlePropstat : singleResponse.getPropstat()) {
            StatusLine status = BasicLineParser.parseStatusLine(singlePropstat.status, new BasicLineParser());

            // ignore information about missing properties etc.
            if (status.getStatusCode() / 100 != 1 && status.getStatusCode() / 100 != 2)
                continue;

            DavProp prop = singlePropstat.prop;
            HashMap<Property, String> properties = referenced.properties;

            if (prop.currentUserPrincipal != null && prop.currentUserPrincipal.getHref() != null)
                properties.put(Property.CURRENT_USER_PRINCIPAL, prop.currentUserPrincipal.getHref().href);

            if (prop.currentUserPrivilegeSet != null) {
                // privilege info available
                boolean mayAll = false, mayBind = false, mayUnbind = false, mayWrite = false,
                        mayWriteContent = false;
                for (DavProp.Privilege privilege : prop.currentUserPrivilegeSet) {
                    if (privilege.getAll() != null)
                        mayAll = true;
                    if (privilege.getBind() != null)
                        mayBind = true;
                    if (privilege.getUnbind() != null)
                        mayUnbind = true;
                    if (privilege.getWrite() != null)
                        mayWrite = true;
                    if (privilege.getWriteContent() != null)
                        mayWriteContent = true;
                }
                if (!mayAll && !mayWrite && !(mayWriteContent && mayBind && mayUnbind))
                    properties.put(Property.READ_ONLY, "1");
            }

            if (prop.addressbookHomeSet != null && prop.addressbookHomeSet.getHref() != null)
                properties.put(Property.ADDRESSBOOK_HOMESET, prop.addressbookHomeSet.getHref().href);

            if (prop.calendarHomeSet != null && prop.calendarHomeSet.getHref() != null)
                properties.put(Property.CALENDAR_HOMESET, prop.calendarHomeSet.getHref().href);

            if (prop.displayname != null)
                properties.put(Property.DISPLAY_NAME, prop.displayname.getDisplayName());

            if (prop.resourcetype != null) {
                if (prop.resourcetype.getAddressbook() != null) { // CardDAV collection properties
                    properties.put(Property.IS_ADDRESSBOOK, "1");

                    if (prop.addressbookDescription != null)
                        properties.put(Property.DESCRIPTION, prop.addressbookDescription.getDescription());
                    if (prop.supportedAddressData != null)
                        for (DavProp.AddressDataType dataType : prop.supportedAddressData)
                            if ("text/vcard".equalsIgnoreCase(dataType.getContentType()))
                                // ignore "3.0" as it MUST be supported anyway
                                if ("4.0".equals(dataType.getVersion()))
                                    properties.put(Property.VCARD_VERSION, VCardVersion.V4_0.getVersion());
                }
                if (prop.resourcetype.getCalendar() != null) { // CalDAV collection propertioes
                    properties.put(Property.IS_CALENDAR, "1");

                    if (prop.calendarDescription != null)
                        properties.put(Property.DESCRIPTION, prop.calendarDescription.getDescription());

                    if (prop.calendarColor != null)
                        properties.put(Property.COLOR, prop.calendarColor.getColor());

                    if (prop.calendarTimezone != null)
                        properties.put(Property.TIMEZONE,
                                Event.TimezoneDefToTzId(prop.calendarTimezone.getTimezone()));

                    if (prop.supportedCalendarComponentSet != null) {
                        referenced.supportedComponents = new LinkedList<String>();
                        for (Comp component : prop.supportedCalendarComponentSet)
                            referenced.supportedComponents.add(component.getName());
                    }
                }
            }

            if (prop.getctag != null)
                properties.put(Property.CTAG, prop.getctag.getCTag());

            if (prop.getetag != null)
                properties.put(Property.ETAG, prop.getetag.getETag());

            if (prop.calendarData != null && prop.calendarData.ical != null)
                referenced.content = prop.calendarData.ical.getBytes();
            else if (prop.addressData != null && prop.addressData.vcard != null)
                referenced.content = prop.addressData.vcard.getBytes();
        }
    }

    this.members = members;
}

From source file:org.catnut.util.CatnutUtils.java

/**
 * if pics.len > 1, return the json, or null
 * @param json//  ww w  . j ava  2 s  . c om
 * @return
 */
public static JSONArray optPics(String json) {
    if (!TextUtils.isEmpty(json)) {
        try {
            JSONArray jsonArray = new JSONArray(json);
            return optPics(jsonArray);
        } catch (JSONException e) {
            Log.wtf(TAG, "cannot serialize pics json array!", e);
            return null;
        }
    }
    return null;
}

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

private static void m3398c(Context context) {
    ApplicationInfo applicationInfo = null;
    try {/*from w  w w  . ja  v a 2 s  .  c o m*/
        applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
    } catch (Throwable e) {
        Log.wtf("GooglePlayServicesUtil", "This should never happen.", e);
    }
    Bundle bundle = applicationInfo.metaData;
    if (bundle != null) {
        int i = bundle.getInt("com.google.android.gms.version");
        if (i != 7095000) {
            throw new IllegalStateException(
                    "The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 7095000 but found "
                            + i + ".  You must have the"
                            + " following declaration within the <application> element: "
                            + "    <meta-data android:name=\"" + "com.google.android.gms.version"
                            + "\" android:value=\"@integer/google_play_services_version\" />");
        }
        return;
    }
    throw new IllegalStateException(
            "A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name=\"com.google.android.gms.version\" android:value=\"@integer/google_play_services_version\" />");
}

From source file:com.appsimobile.appsii.Appsi.java

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    switch (key) {
    case "pref_minimal_notification":
        onNotificationOptionsChanged();/*from   w  ww  .  ja v a  2 s . c  o  m*/
        break;
    case "pref_sidebar_dimming_level":
        int value = mPreferenceHelper.getSidebarDimLevel();
        updateDefaultDimColor(ThemingUtils.getPercentage(value));
        break;
    case "pref_icon_theme":
        // TODO: add this again
        String iconPackStringUri = sharedPreferences.getString("pref_icon_theme", null);
        Uri iconPackUri = iconPackStringUri == null ? null : Uri.parse(iconPackStringUri);
        ActiveIconPackInfo.getInstance(this).setActiveIconPackUri(iconPackUri);
        mIconCache.clearAllIcons();
        break;
    case "pref_hotspot_width":
        removeHotspots();
        try {
            addHotspotsIfUnlocked();
        } catch (PermissionDeniedException e) {
            Log.wtf(TAG, "permission denied?", e);
        }
        break;
    case "pref_hide_persistent_notification_with_hack":
        onNotificationOptionsChanged();
        break;
    case "pref_sidebar_size":
        mSidebarPercentage = mPreferenceHelper.getSidebarWidth();
        break;
    case "pref_sidebar_haptic_feedback":
        boolean mVibrate = mPreferenceHelper.getHotspotsHapticFeedbackEnabled();
        mHotspotHelper.setVibrate(mVibrate);
        break;
    }
}

From source file:com.appsimobile.appsii.Appsi.java

/**
 * There seems to be a problem unregistering receivers sometimes.
 * This is definitely a bug in Appsi. For now work around it by
 * catching the exception to make sure Appsi won't crash.
 *///w w  w.  j  a v a  2 s. co m
@Override
public void unregisterReceiver(BroadcastReceiver receiver) {
    try {
        super.unregisterReceiver(receiver);
    } catch (Exception e) {
        Log.wtf("Appsi", "error unregistering receiver", e);
    }
}

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

private static void m118t(Context context) {
    ApplicationInfo applicationInfo = null;
    try {//w w w  .j a  v a  2s  .c om
        applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                TransportMediator.FLAG_KEY_MEDIA_NEXT);
    } catch (Throwable e) {
        Log.wtf("GooglePlayServicesUtil", "This should never happen.", e);
    }
    Bundle bundle = applicationInfo.metaData;
    if (bundle != null) {
        int i = bundle.getInt("com.google.android.gms.version");
        if (i != GOOGLE_PLAY_SERVICES_VERSION_CODE) {
            throw new IllegalStateException(
                    "The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4452000 but found "
                            + i + ".  You must have the"
                            + " following declaration within the <application> element: "
                            + "    <meta-data android:name=\"" + "com.google.android.gms.version"
                            + "\" android:value=\"@integer/google_play_services_version\" />");
        }
        return;
    }
    throw new IllegalStateException(
            "A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name=\"com.google.android.gms.version\" android:value=\"@integer/google_play_services_version\" />");
}