类java.lang.NullPointerException源码实例Demo

下面列出了怎么用java.lang.NullPointerException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码2 项目: TencentKona-8   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码3 项目: jdk8u60   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码4 项目: openjdk-jdk8u   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码6 项目: openjdk-jdk9   文件: AppletClassLoader.java
/**
 * 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}
 *         if the resource could not be found
 * @since  1.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;
    }
}
 
源代码7 项目: jdk8u-jdk   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码8 项目: hottub   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码9 项目: openjdk-8-source   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码10 项目: openjdk-8   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码11 项目: jdk8u_jdk   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码12 项目: Silence   文件: SmsCipher.java
public IncomingTextMessage decrypt(Context context, IncomingTextMessage message)
    throws LegacyMessageException, InvalidMessageException, DuplicateMessageException,
           NoSessionException, UntrustedIdentityException
{
  try {
    byte[]        decoded       = transportDetails.getDecodedMessage(message.getMessageBody().getBytes());
    SignalMessage signalMessage = new SignalMessage(decoded);
    SessionCipher sessionCipher = new SessionCipher(signalProtocolStore, new SignalProtocolAddress(message.getSender(), 1));
    byte[]        padded        = sessionCipher.decrypt(signalMessage);
    byte[]        plaintext     = transportDetails.getStrippedPaddingMessageBody(padded);

    if (message.isEndSession() && "TERMINATE".equals(new String(plaintext))) {
      signalProtocolStore.deleteSession(new SignalProtocolAddress(message.getSender(), 1));
    }

    return message.withMessageBody(new String(plaintext));
  } catch (IOException | IllegalArgumentException | NullPointerException e) {
    throw new InvalidMessageException(e);
  }
}
 
源代码13 项目: jdk8u-jdk   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码14 项目: jdk8u-dev-jdk   文件: AppletClassLoader.java
/**
 * 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;
    }
}
 
源代码15 项目: pluotsorbet   文件: constructor.java
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    NullPointerException object1 = new NullPointerException();
    harness.check(object1 != null);
    harness.check(object1.toString(), "java.lang.NullPointerException");

    NullPointerException object2 = new NullPointerException("nothing happens");
    harness.check(object2 != null);
    harness.check(object2.toString(), "java.lang.NullPointerException: nothing happens");

    NullPointerException object3 = new NullPointerException(null);
    harness.check(object3 != null);
    harness.check(object3.toString(), "java.lang.NullPointerException");

}
 
源代码16 项目: lams   文件: UndertowServletMessages_$bundle.java
@Override
public final NullPointerException listenerCannotBeNull() {
    final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), listenerCannotBeNull$str()));
    final StackTraceElement[] st = result.getStackTrace();
    result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
    return result;
}
 
源代码17 项目: lams   文件: UndertowServletMessages_$bundle.java
@Override
public final NullPointerException nullName() {
    final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), nullName$str()));
    final StackTraceElement[] st = result.getStackTrace();
    result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
    return result;
}
 
源代码18 项目: lams   文件: UndertowServletMessages_$bundle.java
@Override
public final NullPointerException headerNameWasNull() {
    final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), headerNameWasNull$str()));
    final StackTraceElement[] st = result.getStackTrace();
    result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
    return result;
}
 
源代码19 项目: lams   文件: UndertowServletMessages_$bundle.java
@Override
public final NullPointerException paramCannotBeNullNPE(final String name) {
    final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), paramCannotBeNullNPE$str(), name));
    final StackTraceElement[] st = result.getStackTrace();
    result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
    return result;
}
 
源代码20 项目: openjdk-jdk9   文件: ParsingTest.java
private static void checkNull(int start, int end, int radix) {
    int n = 0;
    try {
        n = Integer.parseInt(null, start, end, radix);
        System.err.println("parseInt(null, " + start + ", " + end + ", " + radix +
                ") incorrectly returned " + n);
        throw new RuntimeException();
    } catch (NullPointerException npe) {
        ; // Expected
    }
}
 
public void parseDataLinks(Set<Step> cwlSteps) {
    for(Step step: cwlSteps) {
        for(InputPort stepInput: step.getInputs()) {
            String[] sourcePath = stepInput.getSource().split("/");
            String source = sourcePath[sourcePath.length-1];
            source = source.replace("#", "");

            DataLink dataLink = new DataLink();
            SenderPort sender = workflowInputs.get(source);
            if(sender == null) {
                sender = processorOutputs.get(source);
            }
            if(sender == null) {
                throw new NullPointerException("Cannot find sender port with name: " + source);
            }
            String receiverId = stepInput.getName();
            ReceiverPort receiver = workflowOutputs.get(receiverId);
            if(receiver == null) {
                receiver = processorInputs.get(receiverId);
            }
            if(receiver == null) {
                throw new NullPointerException("Cannot find receiver port with name: " + receiverId);
            }
            dataLink.setSendsTo(receiver);
            dataLink.setReceivesFrom(sender);
            dataLinks.add(dataLink);
        }
    }
}
 
源代码22 项目: j2objc   文件: IvParameterSpecTest.java
/**
 * 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 testIvParameterSpec1() {
    try {
        new IvParameterSpec(null);
        fail("Should raise an NullPointerException "
                + "in the case of null byte array.");
    } catch(NullPointerException e) {
    }

    byte[] iv = new byte[] {1, 2, 3, 4, 5};
    IvParameterSpec ivps = new IvParameterSpec(iv);
    iv[0] ++;
    assertFalse("The change of input array's content should not cause "
                + "the change of internal array", iv[0] == ivps.getIV()[0]);
}
 
源代码23 项目: pluotsorbet   文件: TryCatch.java
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    // flag that is set when exception is caught
    boolean caught = false;
    try {
        throw new NullPointerException("NullPointerException");
    }
    catch (NullPointerException e) {
        // correct exception was caught
        caught = true;
    }
    harness.check(caught);
}
 
源代码24 项目: dragonwell8_jdk   文件: AppletClassLoader.java
/**
 * Returns an input stream for reading the specified resource.
 *
 * 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 getResourceAsStream(String name)
{

    if (name == null) {
        throw new NullPointerException("name");
    }

    try
    {
        InputStream is = null;

        // Fixed #4507227: Slow performance to load
        // class and resources. [stanleyh]
        //
        // The following is used to avoid calling
        // AppletClassLoader.findResource() in
        // super.getResourceAsStream(). Otherwise,
        // unnecessary connection will be made.
        //
        synchronized(syncResourceAsStream)
        {
            resourceAsStreamInCall = true;

            // Call super class
            is = super.getResourceAsStream(name);

            resourceAsStreamInCall = false;
        }

        // 4668479: Option to turn off codebase lookup in AppletClassLoader
        // during resource requests. [stanley.ho]
        if (codebaseLookup == true && is == null)
        {
            // If resource cannot be obtained,
            // try to download it from codebase
            URL url = new URL(base, ParseUtil.encodePath(name, false));
            is = url.openStream();
        }

        return is;
    }
    catch (Exception e)
    {
        return null;
    }
}
 
源代码25 项目: TencentKona-8   文件: AppletClassLoader.java
/**
 * Returns an input stream for reading the specified resource.
 *
 * 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 getResourceAsStream(String name)
{

    if (name == null) {
        throw new NullPointerException("name");
    }

    try
    {
        InputStream is = null;

        // Fixed #4507227: Slow performance to load
        // class and resources. [stanleyh]
        //
        // The following is used to avoid calling
        // AppletClassLoader.findResource() in
        // super.getResourceAsStream(). Otherwise,
        // unnecessary connection will be made.
        //
        synchronized(syncResourceAsStream)
        {
            resourceAsStreamInCall = true;

            // Call super class
            is = super.getResourceAsStream(name);

            resourceAsStreamInCall = false;
        }

        // 4668479: Option to turn off codebase lookup in AppletClassLoader
        // during resource requests. [stanley.ho]
        if (codebaseLookup == true && is == null)
        {
            // If resource cannot be obtained,
            // try to download it from codebase
            URL url = new URL(base, ParseUtil.encodePath(name, false));
            is = url.openStream();
        }

        return is;
    }
    catch (Exception e)
    {
        return null;
    }
}
 
源代码26 项目: jdk8u60   文件: AppletClassLoader.java
/**
 * Returns an input stream for reading the specified resource.
 *
 * 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 getResourceAsStream(String name)
{

    if (name == null) {
        throw new NullPointerException("name");
    }

    try
    {
        InputStream is = null;

        // Fixed #4507227: Slow performance to load
        // class and resources. [stanleyh]
        //
        // The following is used to avoid calling
        // AppletClassLoader.findResource() in
        // super.getResourceAsStream(). Otherwise,
        // unnecessary connection will be made.
        //
        synchronized(syncResourceAsStream)
        {
            resourceAsStreamInCall = true;

            // Call super class
            is = super.getResourceAsStream(name);

            resourceAsStreamInCall = false;
        }

        // 4668479: Option to turn off codebase lookup in AppletClassLoader
        // during resource requests. [stanley.ho]
        if (codebaseLookup == true && is == null)
        {
            // If resource cannot be obtained,
            // try to download it from codebase
            URL url = new URL(base, ParseUtil.encodePath(name, false));
            is = url.openStream();
        }

        return is;
    }
    catch (Exception e)
    {
        return null;
    }
}
 
源代码27 项目: openjdk-jdk8u   文件: AppletClassLoader.java
/**
 * Returns an input stream for reading the specified resource.
 *
 * 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 getResourceAsStream(String name)
{

    if (name == null) {
        throw new NullPointerException("name");
    }

    try
    {
        InputStream is = null;

        // Fixed #4507227: Slow performance to load
        // class and resources. [stanleyh]
        //
        // The following is used to avoid calling
        // AppletClassLoader.findResource() in
        // super.getResourceAsStream(). Otherwise,
        // unnecessary connection will be made.
        //
        synchronized(syncResourceAsStream)
        {
            resourceAsStreamInCall = true;

            // Call super class
            is = super.getResourceAsStream(name);

            resourceAsStreamInCall = false;
        }

        // 4668479: Option to turn off codebase lookup in AppletClassLoader
        // during resource requests. [stanley.ho]
        if (codebaseLookup == true && is == null)
        {
            // If resource cannot be obtained,
            // try to download it from codebase
            URL url = new URL(base, ParseUtil.encodePath(name, false));
            is = url.openStream();
        }

        return is;
    }
    catch (Exception e)
    {
        return null;
    }
}
 
源代码28 项目: openjdk-jdk8u-backup   文件: AppletClassLoader.java
/**
 * Returns an input stream for reading the specified resource.
 *
 * 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 getResourceAsStream(String name)
{

    if (name == null) {
        throw new NullPointerException("name");
    }

    try
    {
        InputStream is = null;

        // Fixed #4507227: Slow performance to load
        // class and resources. [stanleyh]
        //
        // The following is used to avoid calling
        // AppletClassLoader.findResource() in
        // super.getResourceAsStream(). Otherwise,
        // unnecessary connection will be made.
        //
        synchronized(syncResourceAsStream)
        {
            resourceAsStreamInCall = true;

            // Call super class
            is = super.getResourceAsStream(name);

            resourceAsStreamInCall = false;
        }

        // 4668479: Option to turn off codebase lookup in AppletClassLoader
        // during resource requests. [stanley.ho]
        if (codebaseLookup == true && is == null)
        {
            // If resource cannot be obtained,
            // try to download it from codebase
            URL url = new URL(base, ParseUtil.encodePath(name, false));
            is = url.openStream();
        }

        return is;
    }
    catch (Exception e)
    {
        return null;
    }
}
 
源代码29 项目: openjdk-jdk9   文件: AppletClassLoader.java
/**
 * Returns an input stream for reading the specified resource.
 *
 * 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}
 *         if the resource could not be found
 * @since  1.1
 */
public InputStream getResourceAsStream(String name)
{

    if (name == null) {
        throw new NullPointerException("name");
    }

    try
    {
        InputStream is = null;

        // Fixed #4507227: Slow performance to load
        // class and resources. [stanleyh]
        //
        // The following is used to avoid calling
        // AppletClassLoader.findResource() in
        // super.getResourceAsStream(). Otherwise,
        // unnecessary connection will be made.
        //
        synchronized(syncResourceAsStream)
        {
            resourceAsStreamInCall = true;

            // Call super class
            is = super.getResourceAsStream(name);

            resourceAsStreamInCall = false;
        }

        // 4668479: Option to turn off codebase lookup in AppletClassLoader
        // during resource requests. [stanley.ho]
        if (codebaseLookup == true && is == null)
        {
            // If resource cannot be obtained,
            // try to download it from codebase
            URL url = new URL(base, ParseUtil.encodePath(name, false));
            is = url.openStream();
        }

        return is;
    }
    catch (Exception e)
    {
        return null;
    }
}
 
源代码30 项目: openjdk-jdk9   文件: Basic.java
@Test(expectedExceptions=NullPointerException.class)
public void testEmptyOrElseGetNull() {
    Optional<Boolean> empty = Optional.empty();

    Boolean got = empty.orElseGet(null);
}
 
 类所在包
 类方法
 同包方法