@@ -0,0 +1,1643 @@
+/*%0A * This Source Code Form is subject to the terms of the Mozilla Public%0A * License, v. 2.0. If a copy of the MPL was not distributed with this%0A * file, you can obtain one at http://mozilla.org/MPL/2.0/.%0A */%0A%0Apackage org.mozilla.focus.utils;%0A%0Aimport android.os.Bundle;%0Aimport android.os.Parcelable;%0Aimport android.util.Log;%0A%0A/**%0A * See SafeIntent for more background: applications can put garbage values into Bundles. This is primarily%0A * experienced when there's garbage in the Intent's Bundle. However that Bundle can contain further bundles,%0A * and we need to handle those defensively too.%0A *%0A * See bug 1090385 for more.%0A */%0Apublic class SafeBundle %7B%0A    private static final String LOGTAG = SafeBundle.class.getSimpleName();%0A%0A    private final Bundle bundle;%0A%0A    public SafeBundle(final Bundle bundle) %7B%0A        this.bundle = bundle;%0A    %7D%0A%0A    public String getString(final String name) %7B%0A        try %7B%0A            return bundle.getString(name);%0A        %7D catch (OutOfMemoryError e) %7B%0A            Log.w(LOGTAG, %22Couldn't get bundle items: OOM. Malformed?%22);%0A            return null;%0A        %7D catch (RuntimeException e) %7B%0A            Log.w(LOGTAG, %22Couldn't get bundle items.%22, e);%0A            return null;%0A        %7D%0A    %7D%0A%0A    public %3CT extends Parcelable%3E T getParcelable(final String name) %7B%0A        try %7B%0A            return bundle.getParcelable(name);%0A        %7D catch (OutOfMemoryError e) %7B%0A            Log.w(LOGTAG, %22Couldn't get bundle items: OOM. Malformed?%22);%0A            return null;%0A        %7D catch (RuntimeException e) %7B%0A            Log.w(LOGTAG, %22Couldn't get bundle items.%22, e);%0A            return null;%0A        %7D%0A    %7D%0A%7D%0A

Add SafeBundle for safe bundle handling (#450)