public abstract class DebugUtils
extends java.lang.Object
debugClassLoadingThrowable(Throwable, Bundle, Class[]) which will
try to determine the cause by trying to load the given interfaces using the
given bundle.
The debugging process can be potentially expensive.| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
COMMA |
private static java.lang.String |
DOUBLE_QUOTE |
private static java.lang.String |
EQUALS |
private static org.apache.commons.logging.Log |
log
use degradable logger
|
private static java.util.regex.Pattern |
PACKAGE_PATTERN |
private static java.lang.String |
PACKAGE_REGEX |
private static java.lang.String |
SEMI_COLON |
| Constructor and Description |
|---|
DebugUtils() |
| Modifier and Type | Method and Description |
|---|---|
private static org.osgi.framework.Version |
checkBundleForClass(org.osgi.framework.Bundle bundle,
java.lang.String name,
org.osgi.framework.Version iversion) |
private static java.net.URL |
checkBundleJarsForClass(org.osgi.framework.Bundle bundle,
java.lang.String name) |
static void |
debugClassLoading(org.osgi.framework.Bundle bundle,
java.lang.String className,
java.lang.String rootClassName)
Tries (through a best-guess attempt) to figure out why a given class
could not be found.
|
static void |
debugClassLoadingThrowable(java.lang.Throwable loadingThrowable,
org.osgi.framework.Bundle bundle,
java.lang.Class<?>[] classes)
Tries to debug the cause of the
Throwables that can appear when
loading classes in OSGi environments (for example when creating proxies). |
private static org.osgi.framework.Version |
getVersion(java.lang.String stmt,
java.lang.String packageName)
Get the version of a package name.
|
private static org.osgi.framework.Version |
hasExport(org.osgi.framework.Bundle bundle,
java.lang.String packageName) |
private static org.osgi.framework.Version |
hasImport(org.osgi.framework.Bundle bundle,
java.lang.String packageName)
Get the version of a package import from a bundle.
|
private static java.lang.String[] |
splitIntoPackages(java.lang.String stmt) |
private static final java.lang.String EQUALS
private static final java.lang.String DOUBLE_QUOTE
private static final java.lang.String SEMI_COLON
private static final java.lang.String COMMA
private static final org.apache.commons.logging.Log log
private static final java.lang.String PACKAGE_REGEX
private static final java.util.regex.Pattern PACKAGE_PATTERN
public static void debugClassLoadingThrowable(java.lang.Throwable loadingThrowable,
org.osgi.framework.Bundle bundle,
java.lang.Class<?>[] classes)
Throwables that can appear when
loading classes in OSGi environments (for example when creating proxies).
This method will try to determine the class that caused the problem
and to search for it in the given bundle or through the classloaders of
the given classes.
It will look at the classes are visible by the given bundle on debug
level and do a bundle discovery process on trace level.
The method accepts also an array of classes which will be used for
loading the 'problematic' class that caused the exception on debug level.loadingThrowable - class loading Throwable (such as
NoClassDefFoundError or ClassNotFoundException)bundle - bundle used for loading the classesclasses - (optional) array of classes that will be used for loading
the problematic classpublic static void debugClassLoading(org.osgi.framework.Bundle bundle,
java.lang.String className,
java.lang.String rootClassName)
NoClassDefFoundError caused by failure of loading transitive
classes (such as getting a NCDFE when loading foo.A
because bar.B cannot be found).bundle - the bundle to search for (and which should do the loading)className - the name of the class that failed to be loaded in dot
format (i.e. java.lang.Thread)rootClassName - the name of the class that triggered the loading
(i.e. java.lang.Runnable)private static org.osgi.framework.Version checkBundleForClass(org.osgi.framework.Bundle bundle,
java.lang.String name,
org.osgi.framework.Version iversion)
private static java.net.URL checkBundleJarsForClass(org.osgi.framework.Bundle bundle,
java.lang.String name)
private static org.osgi.framework.Version hasImport(org.osgi.framework.Bundle bundle,
java.lang.String packageName)
bundle - packageName - private static org.osgi.framework.Version hasExport(org.osgi.framework.Bundle bundle,
java.lang.String packageName)
private static org.osgi.framework.Version getVersion(java.lang.String stmt,
java.lang.String packageName)
stmt - packageName - private static java.lang.String[] splitIntoPackages(java.lang.String stmt)