Returns the location where the given Class is loaded from.
543868
private static String which(Class clazz) {
        try {
            String classnameAsResource = clazz.getName().replace('.', '/') + ".class";

            ClassLoader loader = clazz.getClassLoader();

            URL it;

            if (loader != null) {
                it = loader.getResource(classnameAsResource);
            } else {
                it = ClassLoader.getSystemResource(classnameAsResource);
            }

            if (it != null) {
                return it.toString();
            }
        }
        // The VM ran out of memory or there was some other serious problem. Re-throw.
        catch (VirtualMachineError vme) {
            throw vme;
        }
        // ThreadDeath should always be re-thrown
        catch (ThreadDeath td) {
            throw td;
        }
        catch (Throwable t) {
            // work defensively.
            if (debug) {
                t.printStackTrace();
            }
        }
        return "unknown location";
    }
499615
public static @CheckForNull Class<?> _findLoadedClass(ClassLoader cl, String name) {
        synchronized (getClassLoadingLock(cl, name)) {
            return (Class) invoke(FIND_LOADED_CLASS, RuntimeException.class, cl, name);
        }
    }
10876
public static URL codeLocationFromClass(Class<?> codeLocationClass) {
        String pathOfClass = codeLocationClass.getName().replace(".", "/") + ".class";
        URL classResource = codeLocationClass.getClassLoader().getResource(pathOfClass);
        String codeLocationPath = removeEnd(getPathFromURL(classResource), pathOfClass);
        if(codeLocationPath.endsWith(".jar!/")) {
            codeLocationPath=removeEnd(codeLocationPath,"!/");
        }
        return codeLocationFromPath(codeLocationPath);
    }
1307025
public static int getIdOrAllocateFor(String slashedClassName) {
		int id = getIdFor(slashedClassName);
		if (id == -1) {
			id = allocateId(slashedClassName);
		}
		return id;
	}
1294914
def __getLocation(self, web):
        
        try:
            self.location = web.find("span", {"class": "p-label"}).text
        except AttributeError as error:
            print("There was an error with the user " + self.name)
            print(error)
975002
private static ClassDescriptor findInheritanceRoot(ClassDescriptor cld)
    {
        ClassDescriptor result = cld;
        if(cld.getSuperClassDescriptor() != null)
        {
            result = findInheritanceRoot(cld.getSuperClassDescriptor());
        }
        return result;
    }
1294763
private <T, U> T[] locateAll(final ClassLocator locator, final Class<T> clazz, final Consumer<T> bootstrapper) {
        Set<Class<? extends T>> set = locator.subtypeOf(clazz);
        if (!set.isEmpty()) {
            
            @SuppressWarnings("unchecked")
            T[] all =   (T[]) Array.newInstance(clazz, set.size());
            int index = 0;
            
            Iterator<Class<? extends T>> iterator = set.iterator();
            while (iterator.hasNext()) {
                Class<? extends T> c = iterator.next();
                
                try {
                    T locatedImplementation = DynamicClassFactory.createInstance(c, clazz);
                    bootstrapper.accept(locatedImplementation);
                    logger.debug("Loaded configuration from: " + c);
                    all[index++] = locatedImplementation;
                    
                } catch (IllegalArgumentException e) {
                    throw e;
                } catch (Exception e) {
                    logger.debug("Error reading custom configuration. Going with built in defaults. The error was: " + getCauseMessage(e));
                }
            }
            return all;
        } else {
            logger.debug("Did not find custom configuration for {}. Going with built in defaults ", clazz);
        }
        return null;
    }
767185
private ZooClassDef locateClassDefinition(Class<?> cls, Node node) {
		ZooClassDef def = cache.getSchema(cls, node);
		if (def == null || def.jdoZooIsDeleted()) {
			return null;
		}
		return def;
	}
765414
public static Class<?> classFind(String name) {
        try {
            return Class.forName(name);
        } catch (ClassNotFoundException e) {
            return findType(name).type;
        }
    }
125718
def __locate(self):
        """"""
        if self.ns[1] != self.schema.tns[1]:
            return self.schema.locate(self.ns)
343667
public Class<?> findLoadedClass(ClassLoader classLoader, String className)
    {
        try
        {
            Method findLoadedClassMethod = svFindLoadedClassMethod;
            if (findLoadedClassMethod == null)
            {
                try
                {
                    findLoadedClassMethod = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class);
                } catch (NoSuchMethodException ex)
                {
                    throw new IllegalStateException(ex);
                }

                findLoadedClassMethod.setAccessible(true);
                svFindLoadedClassMethod = findLoadedClassMethod;
            }

            return (Class<?>) findLoadedClassMethod.invoke(classLoader, className);
        } catch (IllegalAccessException ex)
        {
            throw new IllegalStateException(ex);
        } catch (InvocationTargetException ex)
        {
            Throwable cause = ex.getCause();
            if (cause instanceof Error)
            {
                throw (Error) cause;
            }
            if (cause instanceof RuntimeException)
            {
                throw (RuntimeException) cause;
            }
            throw new IllegalStateException(cause);
        }
    }
28599
public static ClassLoader getClassLoader(Class<?> cls) {
        ClassLoader cl = cls.getClassLoader();
        if (cl == null) {
            cl = getClassLoader();
        }
        return cl;
    }
615265
private function loadLocation(): ?Location
    {
        if (!$this->context->has('ez_location_id')) {
            return null;
        }

        return $this->locationService->loadLocation(
            (int) $this->context->get('ez_location_id')
        );
    }
1568
def get_source_class(self, _class):
        
        if not _class.get_name() in self.classes:
            return ""
        return self.classes[_class.get_name()]
433335
protected ClassLocator getClassLocator() {
    ClassLocator  	result;

    result = ClassLocator.getSingleton(m_ClassTraversal);
    if (result.isOnlyDefaultConstructor() != isOnlyDefaultConstructor())
      result.setOnlyDefaultConstructor(isOnlyDefaultConstructor());
    if (result.isOnlySerializable() != isOnlySerializable())
      result.setOnlySerializable(isOnlySerializable());

    return result;
  }
85461
def _get_location(package, location):
    """"""
    for region in package['regions']:
        if region['location']['location']['name'] == location:
            return region

    raise SoftLayer.SoftLayerError("Could not find valid location for: '%s'" % location)
1124756
private void mapClassResourceEntry(String fileName, Object location) {
		Object previouslyFoundLocation = mixedResourceLocations.get(fileName);
		if (previouslyFoundLocation != null && !previouslyFoundLocation.equals(location)) {
			//this may indicate a conflict
			//it occurs frequently for "/MANIFEST.MF" which shouldn't be a problem
			//it may occur for other resources
			//log those occurrences that seem suspicious
			registerMultipleLocations(fileName, location);
			return;
		}
		if (fileName.endsWith(".properties")) {
			String className = convertFileNameToClassName(fileName);
			propertiesResourceLocations.put(className, fileName);
		} else if (fileName.endsWith(".class")) {
			String className = convertFileNameToClassName(fileName);
			classResourceLocations.put(className, location);
		}
		mixedResourceLocations.put(fileName, location);
	}