From 1666bb7e3a85a0aec2e5a8609d33aef59690f2ba Mon Sep 17 00:00:00 2001 From: Khalid Shakir Date: Wed, 12 Feb 2014 00:48:58 +0800 Subject: [PATCH] Patched PluginManager to ignore null classes, that will allow gatkdocs to build successfully when running from the source root directory, due to its hardcoded paths. --- .../sting/utils/classloader/PluginManager.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/classloader/PluginManager.java b/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/classloader/PluginManager.java index 38bd9bdcc..de071fa7b 100644 --- a/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/classloader/PluginManager.java +++ b/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/classloader/PluginManager.java @@ -154,6 +154,17 @@ public class PluginManager { @SuppressWarnings("unchecked") Set> allTypes = reflections.getSubTypesOf(pluginType); for( Class type: allTypes ) { + // Depending on the root directories/URLs fed to org.reflections, the scanner may pick up classes that are + // NOT actually in the classpath. When this happens, Class.forName() returns null, and the allTypes ends up + // containing null elements. + // This happens for example when the gatkdocs generator is invoked from the root of the source tree. + // In this case, ignore the null types, as they were most likely NOT supposed to be scanned, and continue. + // TODO: Fix location that the GATKDocs scans, since it currently runs from the source code root, due to + // TODO: hardcoded paths! + + if (type == null) + continue; + // The plugin manager does not support anonymous classes; to be a plugin, a class must have a name. if(JVMUtils.isAnonymous(type)) continue;