Modifier and Type | Method and Description |
---|---|
static String |
formatURL(URL url)
Returns the interpretation of URL in string format.
|
static String |
getUserCodeClassLoaderInfo(ClassLoader loader)
Gets information about URL class loaders.
|
static boolean |
validateClassLoadable(ClassNotFoundException cnfe,
ClassLoader cl)
Checks, whether the class that was not found in the given exception, can be resolved through
the given class loader.
|
public static String getUserCodeClassLoaderInfo(ClassLoader loader)
NOTE: This method makes a best effort to provide information about the classloader, and never throws an exception.
NOTE: Passing ClassLoader.getSystemClassLoader()
on Java 9+ will not return
anything interesting.
loader
- The classloader to get the info string for.public static String formatURL(URL url) throws IOException
If the URL is null, it returns '(null)'.
If the URL protocol is file, prepend 'file:' flag before the formatted URL. Otherwise, use 'url: ' as the prefix instead.
Also, it checks whether the object that the URL directs to exists or not. If the object exists, some additional checks should be performed in order to determine that the object is a directory or a valid/invalid jar file. If the object does not exist, a missing flag should be appended.
url
- URL that should be formattedIOException
- When JarFile cannot be closedpublic static boolean validateClassLoadable(ClassNotFoundException cnfe, ClassLoader cl)
cnfe
- The ClassNotFoundException that defines the name of the class.cl
- The class loader to use for the class resolution.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.