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();
}
}
}
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;
}
}
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
}
}
Aggregations