Pattern 0

      ClassLoader cl = getClass().getClassLoader();
      Icon icon = new ImageIcon(cl.getResource(img));


Pattern 1

        URL resource = loader.getResource(name);
        if (resource == null) {
            throw new IOException("resource not found: " + name);
        }


Pattern 2

        URL classUrl = cl.getResource(endpointPath);
        File srcFile = new File(classUrl.toURI());


Pattern 3

        URL resourceUrl = cloader.getResourceresource );
        if resourceUrl == null )
        {
            throw new FileNotFoundException"Unable to find: " + resource );
        }
        return new FileURI.createresourceUrl.toString().replaceAll" ""%20" ) ) );


Pattern 4

      URL url = loader.getResource("org/apache/hadoop/hive/conf/HiveConf.class");
        File file = new File(url.getFile());


Pattern 5

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        DEACTIVATED_VALIDATION_XML = new File(cl.getResource("META-INF/deactivated_validation.xml").toURI());


Pattern 6

        final URL resource = classLoader.getResource(name);
        if (resource == null) {
            throw new IllegalArgumentException("Can't locate resource " + name + " on " + classLoader);
        }


Pattern 7

            if (classLoader != null) {
                return classLoader.getResource(resource);
            }
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();


Pattern 8

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL nonManifestResource = cl.getResource("example2.txt");


Pattern 9

    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    URL url = cl.getResource("test/check/icons/" + iconName + ".gif");
    if (url != null)
      return new ImageIcon(url);


Pattern 10

                    url = clazzLoader.getResource(resourceName);
                        clazzLoader = Thread.currentThread().getContextClassLoader();
                        url = clazzLoader.getResource(resourceName);


Pattern 11

        URL url = jarLoader.getResource(pathname);
        if (url == nullreturn null;
        return new ImageIcon(url);


Pattern 12

          collectionIcon = new ImageIcon(loader.getResource("images/CollectionNodeImage.gif"));
          fileIcon = new ImageIcon(loader.getResource("images/ServiceNodeImage.gif"));


Pattern 13

          workspaceIcon = new ImageIcon(loader.getResource("images/WorkspaceNodeImage.gif"));
          serviceIcon = new ImageIcon(loader.getResource("images/ServiceNodeImage.gif"));
          fileIcon = new ImageIcon(loader.getResource("images/ServiceNodeImage.gif"));


Pattern 14

          serviceIcon = new ImageIcon(loader.getResource("images/ServiceNodeImage.gif"));
          collectionIcon = new ImageIcon(loader.getResource("images/CollectionNodeImage.gif"));
          fileIcon = new ImageIcon(loader.getResource("images/ServiceNodeImage.gif"));


Pattern 15

          serviceIcon = new ImageIcon(loader.getResource("images/ServiceNodeImage.gif"));
          fileIcon = new ImageIcon(loader.getResource("images/ServiceNodeImage.gif"));


Pattern 16

        URL resource = classLoader.getResource(pathAsString);
        if (resource==null)
          throw new FileNotFoundOnClasspathException("Couldn't find resource on classpath. URI was '"+classpathUri+"'");
        URI fileUri = URI.createURI(resource.toString(),true);


Pattern 17

    if (isReflectivePath(path)) return getReflectiveIcon(path, classLoader);
    final URL url = classLoader.getResource(path.substring(1));


Pattern 18

            if (loader != null) {
                URL url = loader.getResource(resource);
                if (url != null) {
                    return url;
                }
            }


Pattern 19

    URL url = cl.getResource("test/check/icons/" + iconName + ".gif");
    if (url != null)
      return new ImageIcon(url);
    if (url != null)
      return new ImageIcon(url);


Pattern 20

    if (fileName == null) {
      throw new IllegalArgumentException("null fileName");
    }
    if (loader == null) {
      throw new IllegalArgumentException("null loader");
    }
    return loader.getResource(fileName);


Pattern 21

    for (ClassLoader delegate : delegateClassLoaders) {
      resource = delegate.getResource(name);
      if (resource != null)
        break;
    }


Pattern 22

        URL url = classLoader.getResource(DEFAULT_CATALOG_WEB);
        url = classLoader.getResource(DEFAULT_CATALOG_EJB);
        return url == nullnull: url.toString();


Pattern 23

    URL url = cl.getResource("test/check/icons/" + iconName + ".gif");
    if (url != null)
      return new ImageIcon(url);
    url = cl.getResource("test/check/icons/" + iconName + ".png");


Pattern 24

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
                new File(cl.getResource(name).toURI()));


Pattern 25

    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    url = cl.getResource(fileName);
    if url==null ) {
      cl = this.getClass().getClassLoader();
      url = cl.getResource(fileName);
    }


Pattern 26

        final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
        if (tccl != null) {
            return tccl.getResource(name);
        else {
            return getClass().getResource(name);
        }


Pattern 27

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        return new File(cl.getResource(name).toURI());


Pattern 28

        ClassLoader tcl = Thread.currentThread().getContextClassLoader();
        URL url = tcl.getResource(name);
        return url != null ? url.toString() null;