Index: exectck/src/main/java/org/apache/jdo/exectck/Utilities.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- exectck/src/main/java/org/apache/jdo/exectck/Utilities.java (revision 1866146) +++ exectck/src/main/java/org/apache/jdo/exectck/Utilities.java (date 1567177637000) @@ -90,27 +90,38 @@ //Get the System Classloader ClassLoader loader = ClassLoader.getSystemClassLoader(); - - //Get the URLs - URL[] urls = ((URLClassLoader) loader).getURLs(); - - for (int i = 0; i < urls.length; i++) { - System.out.println(" " + urls[i].getFile()); + if(loader != null) { + printClasspath((URLClassLoader) loader); + }else { + throw new RuntimeException("System classloader is null"); } //Get the System Classloader loader = Thread.currentThread().getContextClassLoader(); + + if(loader != null) { + //Get the URLs + printClasspath(loader); + }else{ + throw new RuntimeException("Context classloader is null"); + } + + } + + /** + * @param loader the loader is not null + */ + private void printClasspath(URLClassLoader loader) { //Get the URLs - urls = ((URLClassLoader) loader).getURLs(); + URL[] urls = loader.getURLs(); for (int i = 0; i < urls.length; i++) { System.out.println(" " + urls[i].getFile()); } - } - static String readFile( String fileName ) throws IOException { + static String readFile( String fileName ) throws IOException { BufferedReader reader = new BufferedReader( new FileReader (fileName)); String line = null; StringBuffer stringBuf = new StringBuffer();