Example usage for android.os BadParcelableException BadParcelableException

List of usage examples for android.os BadParcelableException BadParcelableException

Introduction

In this page you can find the example usage for android.os BadParcelableException BadParcelableException.

Prototype

public BadParcelableException(Exception cause) 

Source Link

Usage

From source file:edu.umich.oasis.sandbox.ResolvedSoda.java

public ResolvedSoda(SandboxService sandbox, SodaDescriptor descriptor, boolean bestMatch) throws Exception {
    //if (localLOGD) {
    Log.d(TAG, "Resolving " + descriptor.toString());
    //}/*from   w ww .  j  a v  a 2s.  com*/
    mSandbox = sandbox;
    mContext = mSandbox.getContextForPackage(descriptor.definingClass.getPackageName());
    //if (localLOGD) {
    Log.d(TAG, "Got package context");
    //}
    final ClassLoader loader = mContext.getClassLoader();

    mDefiningClass = ClassUtils.getClass(loader, descriptor.definingClass.getClassName(), true);

    Class<?>[] paramClasses = classNamesToClasses(descriptor.paramTypes, loader);

    switch (descriptor.kind) {
    case SodaDescriptor.KIND_INSTANCE:
        mMemberData = resolveInstance(mDefiningClass, descriptor.methodName, paramClasses, bestMatch);
        break;
    case SodaDescriptor.KIND_STATIC:
        mMemberData = resolveStatic(mDefiningClass, descriptor.methodName, paramClasses, bestMatch);
        break;
    case SodaDescriptor.KIND_CTOR:
        mMemberData = resolveConstructor(mDefiningClass, paramClasses, bestMatch);
        break;
    default:
        throw new IllegalArgumentException("Unknown SodaDescriptor type");
    }

    // Check that return type can be marshalled.
    if (!ParceledPayload.canParcelType(mMemberData.getReturnType(), true)) {
        throw new BadParcelableException("Cannot parcel type " + mMemberData.getReturnType().getName());
    }

    mOriginalDescriptor = descriptor;
}

From source file:edu.umich.flowfence.sandbox.ResolvedQM.java

public ResolvedQM(SandboxService sandbox, QMDescriptor descriptor, boolean bestMatch) throws Exception {
    //if (localLOGD) {
    Log.d(TAG, "Resolving " + descriptor.toString());
    //}//from w w w .j  av a  2 s . com
    mSandbox = sandbox;
    mContext = mSandbox.getContextForPackage(descriptor.definingClass.getPackageName());
    //if (localLOGD) {
    Log.d(TAG, "Got package context");
    //}
    final ClassLoader loader = mContext.getClassLoader();

    mDefiningClass = ClassUtils.getClass(loader, descriptor.definingClass.getClassName(), true);

    Class<?>[] paramClasses = classNamesToClasses(descriptor.paramTypes, loader);

    switch (descriptor.kind) {
    case QMDescriptor.KIND_INSTANCE:
        mMemberData = resolveInstance(mDefiningClass, descriptor.methodName, paramClasses, bestMatch);
        break;
    case QMDescriptor.KIND_STATIC:
        mMemberData = resolveStatic(mDefiningClass, descriptor.methodName, paramClasses, bestMatch);
        break;
    case QMDescriptor.KIND_CTOR:
        mMemberData = resolveConstructor(mDefiningClass, paramClasses, bestMatch);
        break;
    default:
        throw new IllegalArgumentException("Unknown QMDescriptor type");
    }

    // Check that return type can be marshalled.
    if (!ParceledPayload.canParcelType(mMemberData.getReturnType(), true)) {
        throw new BadParcelableException("Cannot parcel type " + mMemberData.getReturnType().getName());
    }

    mOriginalDescriptor = descriptor;
}