public class ClassLoaderUtil extends Object
Modifier and Type | Field and Description |
---|---|
(package private) static Logger |
logger
Configure logger
|
Modifier | Constructor and Description |
---|---|
private |
ClassLoaderUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
displayClassLoaderTree(ClassLoader classloader)
Utility method that displays the class loader delegation tree for
the given class loader.
|
static void |
displayContextClassLoaderTree()
Utility method that displays the class loader delegation tree for
the current context class loader.
|
private static ArrayList |
getClassLoaderTree(ClassLoader classloader)
Utility method that retrieves the components making up the class loader
delegation tree for the given
classloader parameter and
returns them via an ArrayList . |
static URL[] |
getClasspathURLs(String classpath)
Utility method that converts the components of a
String
representing a classpath into file URL (s). |
static URL[] |
getCodebaseURLs(String codebase)
Utility method that converts the components of a
String
representing a codebase into standard URL (s). |
private static ArrayList |
getContextClassLoaderTree()
Utility method that retrieves the components making up the class loader
delegation tree for the current context class loader and returns each
in an
ArrayList . |
static URL[] |
getImportCodebaseURLs(String importCodebase)
Utility method that converts the components of a
String
representing a codebase or classpath into URL (s). |
static final Logger logger
public static URL[] getClasspathURLs(String classpath) throws IOException, MalformedURLException
String
representing a classpath into file URL
(s).classpath
- String
containing components separated
by path separators that represent the components
making up a classpathURL[]
where
each element of the array corresponds to one of the components
in the classpath
parameter. The path components
are (potentially) expanded via
File.getCanonicalFile()
before converting to a
URL
format.MalformedURLException
- If the path cannot be parsed as a URLjava.net.IOException
- If an I/O error occurs,
which is possible because the construction of
the canonical pathname may require filesystem queriesIOException
public static URL[] getCodebaseURLs(String codebase) throws MalformedURLException
String
representing a codebase into standard URL
(s).codebase
- String
containing components separated
by spaces in which each component is in
URL
format.URL[]
where
each element of the array corresponds to one of the components
in the codebase
parameterMalformedURLException
public static URL[] getImportCodebaseURLs(String importCodebase) throws IOException, MalformedURLException
String
representing a codebase or classpath into URL
(s).importCodebase
- String
assumed (in order) to be either
1) a space delimited set of URL
(s)
representing a codebase or
2) a File.pathSeparator
delimited set
of class paths.URL[]
where
each element of the array corresponds to one of the components
in the importCodebase
parameterMalformedURLException
- If the path cannot be parsed as a URLjava.net.IOException
- If an I/O error occurs,
which is possible because the construction of
the canonical pathname may require filesystem queriesIOException
private static ArrayList getContextClassLoaderTree()
ArrayList
.ArrayList
instance in which each element of the
list is one of the components making up the current delegation
tree.private static ArrayList getClassLoaderTree(ClassLoader classloader)
classloader
parameter and
returns them via an ArrayList
.classloader
- ClassLoader
instance whose delegation
tree is to be retrieved and returnedArrayList
instance in which each element of the
list is one of the components making up the delegation tree
of the given class loader.public static void displayContextClassLoaderTree()
This method can be useful when debugging problems related to the
receipt of exceptions such as ClassNotFoundException
.
public static void displayClassLoaderTree(ClassLoader classloader)
This method can be useful when debugging problems related to the
receipt of exceptions such as ClassNotFoundException
.
classloader
- ClassLoader
instance whose delegation
tree is to be displayedCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.