@Test public void acceptZipFile() throws Exception { File zipFile = createZipFile(); zipFile.deleteOnExit(); FilesystemCodeBaseLocator locator = buildLocator(zipFile); assertHasCodeBase(ClassFactory.createFilesystemCodeBase(locator)); }
static IScannableCodeBase createFilesystemCodeBase(FilesystemCodeBaseLocator codeBaseLocator) throws IOException { String fileName = codeBaseLocator.getPathName(); File file = new File(fileName); if (!file.exists() || !file.canRead()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (file.isDirectory()) { return new DirectoryCodeBase(codeBaseLocator, file); } else if (!file.isFile()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (fileName.endsWith(".class")) { return new SingleFileCodeBase(codeBaseLocator, fileName); } else if (fileName.endsWith(File.separator + "jrt-fs.jar")) { return new JrtfsCodeBase(codeBaseLocator, fileName); } else { try { return ZipCodeBaseFactory.makeZipCodeBase(codeBaseLocator, file); } catch (IOException e) { return createEmptyCodeBase(codeBaseLocator, file); } } }
ClassFactory implements IClassFactory { static IScannableCodeBase createFilesystemCodeBase(FilesystemCodeBaseLocator codeBaseLocator) throws IOException { String fileName = codeBaseLocator.getPathName(); File file = new File(fileName); if (!file.exists() || !file.canRead()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (file.isDirectory()) { return new DirectoryCodeBase(codeBaseLocator, file); } else if (!file.isFile()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (fileName.endsWith(".class")) { return new SingleFileCodeBase(codeBaseLocator, fileName); } else if (fileName.endsWith(File.separator + "jrt-fs.jar")) { return new JrtfsCodeBase(codeBaseLocator, fileName); } else { try { return ZipCodeBaseFactory.makeZipCodeBase(codeBaseLocator, file); } catch (IOException e) { return createEmptyCodeBase(codeBaseLocator, file); } } } }
ClassFactory implements IClassFactory { static IScannableCodeBase createFilesystemCodeBase(FilesystemCodeBaseLocator codeBaseLocator) throws IOException { String fileName = codeBaseLocator.getPathName(); File file = new File(fileName); if (!file.exists() || !file.canRead()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (file.isDirectory()) { return new DirectoryCodeBase(codeBaseLocator, file); } else if (!file.isFile()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (fileName.endsWith(".class")) { return new SingleFileCodeBase(codeBaseLocator, fileName); } else if (fileName.endsWith(File.separator + "jrt-fs.jar")) { return new JrtfsCodeBase(codeBaseLocator, fileName); } else { try { return ZipCodeBaseFactory.makeZipCodeBase(codeBaseLocator, file); } catch (IOException e) { return createEmptyCodeBase(codeBaseLocator, file); } } } private  ClassFactory(); }
ClassFactory implements IClassFactory { static IScannableCodeBase createFilesystemCodeBase(FilesystemCodeBaseLocator codeBaseLocator) throws IOException { String fileName = codeBaseLocator.getPathName(); File file = new File(fileName); if (!file.exists() || !file.canRead()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (file.isDirectory()) { return new DirectoryCodeBase(codeBaseLocator, file); } else if (!file.isFile()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (fileName.endsWith(".class")) { return new SingleFileCodeBase(codeBaseLocator, fileName); } else if (fileName.endsWith(File.separator + "jrt-fs.jar")) { return new JrtfsCodeBase(codeBaseLocator, fileName); } else { try { return ZipCodeBaseFactory.makeZipCodeBase(codeBaseLocator, file); } catch (IOException e) { return createEmptyCodeBase(codeBaseLocator, file); } } } private  ClassFactory(); static IClassFactory instance(); @Override IClassPath createClassPath(); @Override IClassPathBuilder createClassPathBuilder(IErrorLogger errorLogger); @Override ICodeBaseLocator createFilesystemCodeBaseLocator(String pathName); @Override ICodeBaseLocator createNestedArchiveCodeBaseLocator(ICodeBase parentCodeBase, String path); @Override IAnalysisCache createAnalysisCache(IClassPath classPath, BugReporter errorLogger); }
ClassFactory implements IClassFactory { static IScannableCodeBase createFilesystemCodeBase(FilesystemCodeBaseLocator codeBaseLocator) throws IOException { String fileName = codeBaseLocator.getPathName(); File file = new File(fileName); if (!file.exists() || !file.canRead()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (file.isDirectory()) { return new DirectoryCodeBase(codeBaseLocator, file); } else if (!file.isFile()) { return createEmptyCodeBase(codeBaseLocator, file); } else if (fileName.endsWith(".class")) { return new SingleFileCodeBase(codeBaseLocator, fileName); } else if (fileName.endsWith(File.separator + "jrt-fs.jar")) { return new JrtfsCodeBase(codeBaseLocator, fileName); } else { try { return ZipCodeBaseFactory.makeZipCodeBase(codeBaseLocator, file); } catch (IOException e) { return createEmptyCodeBase(codeBaseLocator, file); } } } private  ClassFactory(); static IClassFactory instance(); @Override IClassPath createClassPath(); @Override IClassPathBuilder createClassPathBuilder(IErrorLogger errorLogger); @Override ICodeBaseLocator createFilesystemCodeBaseLocator(String pathName); @Override ICodeBaseLocator createNestedArchiveCodeBaseLocator(ICodeBase parentCodeBase, String path); @Override IAnalysisCache createAnalysisCache(IClassPath classPath, BugReporter errorLogger);  }