guava/src/com/google/common/io/Resources.java
@CanIgnoreReturnValue // being used to check if a resource exists
  // TODO(cgdecker): maybe add a better way to check if a resource exists
  // e.g. Optional<URL> tryGetResource or boolean resourceExists
  public static URL getResource(String resourceName) {
    ClassLoader loader =
        MoreObjects.firstNonNull(
            Thread.currentThread().getContextClassLoader(), Resources.class.getClassLoader());
    URL url = loader.getResource(resourceName);
    checkArgument(url != null, "resource %s not found.", resourceName);
    return url;
  }
@CanIgnoreReturnValue // being used to check if a resource exists
  // TODO(cgdecker): maybe add a better way to check if a resource exists
  // e.g. Optional<URL> tryGetResource or boolean resourceExists
  public static URL getResource(String resourceName) {
    ClassLoader loader =
        MoreObjects.firstNonNull(
            Thread.currentThread().getContextClassLoader(), Resources.class.getClassLoader());
    URL url = loader.getResource(resourceName);
    checkArgument(url != null, "resource %s not found.", resourceName);
    return url;
  }
@ CanIgnoreReturnValue // being used to check if a resource exists // TODO(cgdecker): maybe add a better way to check if a resource exists // e.g. Optional<URL> tryGetResource or boolean resourceExists public static URL getResource ( String resourceName ) { ClassLoader loader = MoreObjects . firstNonNull ( Thread . currentThread ( ) . getContextClassLoader ( ) , Resources . class . getClassLoader ( ) ) ; URL url = loader . getResource ( resourceName ) ; checkArgument ( url != null , "resource %s not found." , resourceName ) ; return url ; }
Returns a {@code URL} pointing to {@code resourceName} if the resource is found using the
{@linkplain Thread#getContextClassLoader() context class loader}. In simple environments, the
context class loader will find resources from the class path. In environments where different
threads can have different class loaders, for example app servers, the context class loader
will typically have been set to an appropriate loader for the current thread.

<p>In the unusual case where the context class loader is null, the class loader that loaded
this class ({@code Resources}) will be used instead.

@throws IllegalArgumentException if the resource is not found
Returns a { @code URL } pointing to { @code resourceName } if the resource is found using the { @linkplain Thread#getContextClassLoader () context class loader } . In simple environments the context class loader will find resources from the class path . In environments where different threads can have different class loaders for example app servers the context class loader will typically have been set to an appropriate loader for the current thread .