/** * Initialize with a root directory to walk. * * @param rootDir the root directory. * @throws NotDirectoryException if the root directory is not a directory. */ public DirectoryWalker(Path rootDir) throws NotDirectoryException { if (!Files.isDirectory(rootDir)) { throw new NotDirectoryException(rootDir + " is not a directory"); } this.rootDir = rootDir; }
throw new NotDirectoryException(outDir + " is not a valid directory"); System.err.println(e.getMessage()); formatter.printHelp("DiseaseMappingPreProcessor", toolOptions, true);
private JavaContainerBuilder addDirectory( Path directory, AbsoluteUnixPath destination, LayerType layerType, Predicate<Path> pathFilter) throws IOException { if (!Files.exists(directory)) { throw new NoSuchFileException(directory.toString()); } if (!Files.isDirectory(directory)) { throw new NotDirectoryException(directory.toString()); } layerConfigurationsBuilder.addDirectoryContents(layerType, directory, pathFilter, destination); classpath.add(destination.toString()); return this; } }
/** * Checks that this entry exists and links to a directory, throwing an exception if not. * * @return this * @throws NoSuchFileException if this entry does not exist * @throws NotDirectoryException if this entry does not link to a directory */ public DirectoryEntry requireDirectory(Path pathForException) throws NoSuchFileException, NotDirectoryException { requireExists(pathForException); if (!file().isDirectory()) { throw new NotDirectoryException(pathForException.toString()); } return this; }
public static MavenArtifactFinder create(final Path localMavenRepositoryPath) throws MavenRepositoryNotFoundException { final Path absolutePath; try { absolutePath = localMavenRepositoryPath.normalize().toAbsolutePath(); } catch (IOError ex) { throw new MavenRepositoryNotFoundException(localMavenRepositoryPath, ex); } catch (SecurityException ex) { throw new MavenRepositoryNotFoundException(localMavenRepositoryPath, ex); } if (!Files.exists(absolutePath)) { throw new MavenRepositoryNotFoundException(localMavenRepositoryPath, absolutePath, new NoSuchFileException(absolutePath.toString())); } if (!Files.isDirectory(absolutePath)) { throw new MavenRepositoryNotFoundException(localMavenRepositoryPath, absolutePath, new NotDirectoryException(absolutePath.toString())); } final RepositorySystem repositorySystem = createRepositorySystem(); return new MavenArtifactFinder(localMavenRepositoryPath, absolutePath, repositorySystem, createRepositorySystemSession(repositorySystem, absolutePath)); }
/** * Ensures configured directory {@code path} exists. * @throws IOException if {@code path} exists, but is not a directory, not accessible, or broken symbolic link. */ static void ensureDirectoryExists(Path path) throws IOException { // this isn't atomic, but neither is createDirectories. if (Files.isDirectory(path)) { // verify access, following links (throws exception if something is wrong) // we only check READ as a sanity test path.getFileSystem().provider().checkAccess(path.toRealPath(), AccessMode.READ); } else { // doesn't exist, or not a directory try { Files.createDirectories(path); } catch (FileAlreadyExistsException e) { // convert optional specific exception so the context is clear IOException e2 = new NotDirectoryException(path.toString()); e2.addSuppressed(e); throw e2; } } }
void guardRegisterWatchDirectory() throws NotDirectoryException { if (!Files.isDirectory(this)) { throw new NotDirectoryException("GlusterWatchService can only watch directories. Not a directory: " + this); } }
/** * Initialize with a root directory to walk. * * @param rootDir the root directory. * @throws NotDirectoryException if the root directory is not a directory. */ public DirectoryWalker(Path rootDir) throws NotDirectoryException { if (!Files.isDirectory(rootDir)) { throw new NotDirectoryException(rootDir + " is not a directory"); } this.rootDir = rootDir; }
/** * Initialize with a root directory to walk. * * @param rootDir the root directory. * @throws NotDirectoryException if the root directory is not a directory. */ public DirectoryWalker(Path rootDir) throws NotDirectoryException { if (!Files.isDirectory(rootDir)) { throw new NotDirectoryException(rootDir + " is not a directory"); } this.rootDir = rootDir; }
@Override public Optional<CatalogNodeType> onFile(final CatalogFileNode f) throws NotDirectoryException { if (iter.hasNext()) { throw new NotDirectoryException(name); } return Optional.of(f); }
private void validateSessionUserDir(Path sessionUserDir) throws NotDirectoryException { if (!Files.isDirectory(sessionUserDir)) { throw new NotDirectoryException(sessionUserDir.toString()); } } }
public FilesystemJobSpecDAO(Path jobSpecsDir) throws IOException { requireNonNull(jobSpecsDir); if (!jobSpecsDir.toFile().exists()) throw new FileNotFoundException(jobSpecsDir.toString() + ": No such directory"); if (!jobSpecsDir.toFile().isDirectory()) throw new NotDirectoryException(jobSpecsDir.toString() + ": Is not a directory"); this.jobSpecsDir = jobSpecsDir; }
@Override public DirectoryStream<Path> value(MemoryEntry entry) throws IOException { if (!(entry instanceof MemoryDirectory)) { throw new NotDirectoryException(abstractPath.toString()); } MemoryDirectory directory = (MemoryDirectory) entry; return directory.newDirectoryStream(abstractPath, filter); } });
@Override public R value(MemoryEntry entry) throws IOException { if (!(entry instanceof MemoryDirectory)) { throw new NotDirectoryException(path.toString()); } return callback.value((MemoryDirectory) entry); } });
@Nonnull private static DirectoryNode asDirectory(@Nullable Node node, GitPath path) throws NotDirectoryException { if(node instanceof DirectoryNode) return (DirectoryNode) node; throw new NotDirectoryException(path.toString()); }
@Nonnull private static DirectoryNode asDirectory(@Nullable Node node, GitPath path) throws NotDirectoryException { if(node instanceof DirectoryNode) return (DirectoryNode) node; throw new NotDirectoryException(path.toString()); }
@Override public R value(MemoryEntry entry) throws IOException { if (!(entry instanceof MemoryDirectory)) { throw new NotDirectoryException(path.toString()); } return callback.value((MemoryDirectory) entry); } });
break; case 1: exception = new NotDirectoryException(file); break; case 2:
private JavaContainerBuilder addDirectory( Path directory, AbsoluteUnixPath destination, LayerType layerType, Predicate<Path> pathFilter) throws IOException { if (!Files.exists(directory)) { throw new NoSuchFileException(directory.toString()); } if (!Files.isDirectory(directory)) { throw new NotDirectoryException(directory.toString()); } layerConfigurationsBuilder.addDirectoryContents(layerType, directory, pathFilter, destination); classpath.add(destination.toString()); return this; } }
private JavaContainerBuilder addDirectory( Path directory, AbsoluteUnixPath destination, LayerType layerType, Predicate<Path> pathFilter) throws IOException { if (!Files.exists(directory)) { throw new NoSuchFileException(directory.toString()); } if (!Files.isDirectory(directory)) { throw new NotDirectoryException(directory.toString()); } layerConfigurationsBuilder.addDirectoryContents(layerType, directory, pathFilter, destination); classpath.add(destination.toString()); return this; } }