Search in sources :

Example 6 with NullPointerException

use of java.lang.NullPointerException in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DimmableIZatIconPreference method load.

private static void load(Context context) {
    if (mLoader == null) {
        try {
            if (mXtProxyClz == null || mNotifierClz == null) {
                mLoader = new DexClassLoader("/system/framework/izat.xt.srv.jar", context.getFilesDir().getAbsolutePath(), null, ClassLoader.getSystemClassLoader());
                mXtProxyClz = Class.forName("com.qti.izat.XTProxy", true, mLoader);
                mNotifierClz = Class.forName("com.qti.izat.XTProxy$Notifier", true, mLoader);
                mIzatPackage = (String) mXtProxyClz.getField("IZAT_XT_PACKAGE").get(null);
                mGetXtProxyMethod = mXtProxyClz.getMethod("getXTProxy", Context.class, mNotifierClz);
                mGetConsentMethod = mXtProxyClz.getMethod("getUserConsent");
                mShowIzatMethod = mXtProxyClz.getMethod("showIzat", Context.class, String.class);
            }
        } catch (NoSuchMethodException | NullPointerException | SecurityException | NoSuchFieldException | LinkageError | IllegalAccessException | ClassNotFoundException e) {
            mXtProxyClz = null;
            mNotifierClz = null;
            mIzatPackage = null;
            mGetXtProxyMethod = null;
            mGetConsentMethod = null;
            mShowIzatMethod = null;
            e.printStackTrace();
        }
    }
}
Also used : Context(android.content.Context) LinkageError(java.lang.LinkageError) NullPointerException(java.lang.NullPointerException) DexClassLoader(dalvik.system.DexClassLoader) SecurityException(java.lang.SecurityException) NoSuchFieldException(java.lang.NoSuchFieldException) ClassNotFoundException(java.lang.ClassNotFoundException) NoSuchMethodException(java.lang.NoSuchMethodException) IllegalAccessException(java.lang.IllegalAccessException)

Example 7 with NullPointerException

use of java.lang.NullPointerException in project jdk8u_jdk by JetBrains.

the class AppContextCreator method getResourceAsStreamFromJar.

/**
     * Returns an input stream for reading the specified resource from the
     * the loaded jar files.
     *
     * The search order is described in the documentation for {@link
     * #getResource(String)}.<p>
     *
     * @param  name the resource name
     * @return an input stream for reading the resource, or <code>null</code>
     *         if the resource could not be found
     * @since  JDK1.1
     */
public InputStream getResourceAsStreamFromJar(String name) {
    if (name == null) {
        throw new NullPointerException("name");
    }
    try {
        InputStream is = null;
        synchronized (syncResourceAsStreamFromJar) {
            resourceAsStreamFromJarInCall = true;
            // Call super class
            is = super.getResourceAsStream(name);
            resourceAsStreamFromJarInCall = false;
        }
        return is;
    } catch (Exception e) {
        return null;
    }
}
Also used : NullPointerException(java.lang.NullPointerException) BufferedInputStream(java.io.BufferedInputStream) InputStream(java.io.InputStream) NullPointerException(java.lang.NullPointerException) NoSuchElementException(java.util.NoSuchElementException) PrivilegedActionException(java.security.PrivilegedActionException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Example 8 with NullPointerException

use of java.lang.NullPointerException in project j2objc by google.

the class IvParameterSpecTest method testIvParameterSpec2.

/**
 * IvParameterSpec(byte[] iv) constructor testing. Checks that
 * NullPointerException is thrown in the case of null input
 * array and that input array is copied during initialization.
 */
public void testIvParameterSpec2() {
    try {
        new IvParameterSpec(null, 1, 1);
        fail("Should raise an IllegalArgumentException " + "in the case of null byte array.");
    } catch (ArrayIndexOutOfBoundsException e) {
        fail("Unexpected ArrayIndexOutOfBoundsException was thrown");
    } catch (IllegalArgumentException e) {
    } catch (NullPointerException e) {
        fail("Unexpected NullPointerException was thrown");
    }
    try {
        new IvParameterSpec(new byte[] { 1, 2, 3 }, 2, 2);
        fail("Should raise an IllegalArgumentException " + "if (iv.length - offset < len).");
    } catch (ArrayIndexOutOfBoundsException e) {
        fail("Unexpected ArrayIndexOutOfBoundsException was thrown");
    } catch (IllegalArgumentException e) {
    } catch (NullPointerException e) {
        fail("Unexpected NullPointerException was thrown");
    }
    try {
        new IvParameterSpec(new byte[] { 1, 2, 3 }, -1, 1);
        fail("Should raise an ArrayIndexOutOfBoundsException " + "if offset index bytes outside the iv.");
    } catch (ArrayIndexOutOfBoundsException e) {
    } catch (IllegalArgumentException e) {
        fail("Unexpected IllegalArgumentException was thrown");
    } catch (NullPointerException e) {
        fail("Unexpected NullPointerException was thrown");
    }
    /* TODO: DRL fail with java.lang.NegativeArraySizeException
        try {
            new IvParameterSpec(new byte[] {1, 2, 3}, 1, -2);
            fail("Should raise an ArrayIndexOutOfBoundsException "
                    + "if len index bytes outside the iv.");
        } catch(ArrayIndexOutOfBoundsException e) {
        } catch(IllegalArgumentException e) {
            fail("Unexpected IllegalArgumentException was thrown");
        } catch(NullPointerException e) {
            fail("Unexpected NullPointerException was thrown");
        }
        */
    byte[] iv = new byte[] { 1, 2, 3, 4, 5 };
    IvParameterSpec ivps = new IvParameterSpec(iv, 0, iv.length);
    iv[0]++;
    assertFalse("The change of input array's content should not cause " + "the change of internal array", iv[0] == ivps.getIV()[0]);
    // Regression for HARMONY-1089
    try {
        new IvParameterSpec(new byte[2], 2, -1);
        fail("ArrayIndexOutOfBoundsException expected");
    } catch (ArrayIndexOutOfBoundsException e) {
    // expected
    }
}
Also used : NullPointerException(java.lang.NullPointerException) IvParameterSpec(javax.crypto.spec.IvParameterSpec) ArrayIndexOutOfBoundsException(java.lang.ArrayIndexOutOfBoundsException) IllegalArgumentException(java.lang.IllegalArgumentException)

Aggregations

NullPointerException (java.lang.NullPointerException)8 IvParameterSpec (javax.crypto.spec.IvParameterSpec)4 Context (android.content.Context)2 BufferedInputStream (java.io.BufferedInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayIndexOutOfBoundsException (java.lang.ArrayIndexOutOfBoundsException)2 IllegalArgumentException (java.lang.IllegalArgumentException)2 NoSuchMethodException (java.lang.NoSuchMethodException)2 MalformedURLException (java.net.MalformedURLException)2 UnknownHostException (java.net.UnknownHostException)2 PrivilegedActionException (java.security.PrivilegedActionException)2 NoSuchElementException (java.util.NoSuchElementException)2 Intent (android.content.Intent)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)1 DeepLinkEntry (com.airbnb.deeplinkdispatch.DeepLinkEntry)1 DeepLinkUri (com.airbnb.deeplinkdispatch.DeepLinkUri)1 DexClassLoader (dalvik.system.DexClassLoader)1