private void addDirectory(File directory) throws IOException { if (!directory.isDirectory()) { throw new IllegalStateException("Not a directory: " + directory); } File[] files = directory.listFiles(); if (files == null) { throw new IllegalStateException("No files found in " + directory); } for (File file : files) { if (file.isDirectory()) { addDirectory(file); } else if (file.getName().endsWith(".jar")) { try { addResource0(file.toURI().toURL()); } catch (IOException e) { throw new IllegalStateException(e); } } else { try { String relativeName = directory.toURI().relativize(file.toURI()).getPath(); FileInputStream fileInputStream = new FileInputStream(file); addClassIfClass(fileInputStream, relativeName); resources.put(relativeName, file.toURI().toURL()); fileInputStream.close(); } catch (MalformedURLException | FileNotFoundException e) { throw new IllegalStateException(e); } } } }
private void addDirectory(File directory) throws IOException { if (!directory.isDirectory()) { throw new IllegalStateException("Not a directory: " + directory); } File[] files = directory.listFiles(); if (files == null) { throw new IllegalStateException("No files found in " + directory); } for (File file : files) { if (file.isDirectory()) { addDirectory(file); } else if (file.getName().endsWith(".jar")) { try { addResource0(file.toURI().toURL()); } catch (IOException e) { throw new IllegalStateException(e); } } else { try { String relativeName = directory.toURI().relativize(file.toURI()).getPath(); FileInputStream fileInputStream = new FileInputStream(file); addClassIfClass(fileInputStream, relativeName); resources.put(relativeName, file.toURI().toURL()); fileInputStream.close(); } catch (MalformedURLException | FileNotFoundException e) { throw new IllegalStateException(e); } } } }
addClassIfClass(jarInputStream, jarEntry.getName()); if (logger != null) logger.trace("Added resource " + jarEntry.getName() + " to ClassLoader"); if (jarEntry.getName().endsWith(".jar")) {
addClassIfClass(jarInputStream, jarEntry.getName()); logger.trace("Added resource " + jarEntry.getName() + " to ClassLoader"); if (jarEntry.getName().endsWith(".jar")) {