@Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { provider.delete(file); return FileVisitResult.CONTINUE; }
@Override public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException { provider.delete(dir); return FileVisitResult.CONTINUE; }
@Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { try { provider.delete(file); } catch (IOException ioException) { exception.addSuppressed(ioException); } return FileVisitResult.CONTINUE; }
@Override public void delete(Path path) throws IOException { delegate.delete(resolveRelative(path)); }
@Override public void delete(Path path) throws IOException { Path r = unroot(path); if (log.isTraceEnabled()) { log.trace("delete({}): {}", path, r); } FileSystemProvider p = provider(r); p.delete(r); }
@Override public void delete(Path path) throws IOException { Path r = unroot(path); if (log.isTraceEnabled()) { log.trace("delete({}): {}", path, r); } FileSystemProvider p = provider(r); p.delete(r); }
@Override public void delete(Path path) throws IOException { BundleFileSystem fs = (BundleFileSystem) path.getFileSystem(); origProvider(path).delete(fs.unwrap(path)); }
@Override public void delete(Path path) throws IOException { Path r = unroot(path); FileSystemProvider p = provider(r); p.delete(r); }
@Override public void forceDelete(RepositoryFileReference ref) throws IOException { Path relativePath = this.fileSystem.getPath(BackendUtils.getPathInsideRepo(ref)); Path fileToDelete = this.makeAbsolute(relativePath); try { this.provider.delete(fileToDelete); // Quick hack for deletion of the mime type information // Alternative: superclass: protected void deleteMimeTypeInformation(RepositoryFileReference ref) throws IOException // However, this would again call this method, where we would have to check for the extension, too. // Therefore, we directly delete the information file Path mimeTypeFile = fileToDelete.getParent().resolve(ref.getFileName() + Constants.SUFFIX_MIMETYPE); this.provider.delete(mimeTypeFile); } catch (IOException e) { if (!(e instanceof NoSuchFileException)) { // only if file did exist and something else went wrong: complain :) // (otherwise, silently ignore the error) FilebasedRepository.LOGGER.debug("Could not delete file", e); throw e; } } }
@Override public void delete(final Path path) throws IOException {wrapped().delete(unwrap(path));}
@Override public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException { if (exc != null) { exception.addSuppressed(exc); return FileVisitResult.CONTINUE; } try { provider.delete(dir); } catch (IOException ioException) { exception.addSuppressed(ioException); } return FileVisitResult.CONTINUE; } }
private boolean invokeDelete(final O ioTask) throws IOException { final String dstPath = ioTask.getDstPath(); final I fileItem = ioTask.getItem(); FS_PROVIDER.delete(dstPath == null ? Paths.get(fileItem.getName()) : Paths.get(dstPath, fileItem.getName())); return true; }
@Test @Category( { Delete.class, Writable.class } ) public void testDeleteOtherProvider() throws IOException { assertThatThrownBy( () -> FS.provider().delete( otherProviderAbsA() ) ).isInstanceOf( ProviderMismatchException.class ); }
private void invokeDelete(final O ioTask) throws IOException { final String dstPath = ioTask.getDstPath(); final I fileItem = ioTask.getItem(); FS_PROVIDER.delete( dstPath == null ? Paths.get(fileItem.getName()) : Paths.get(dstPath, fileItem.getName()) ); finishIoTask(ioTask); }
@Test( expected = ClosedFileSystemException.class ) @Category( Closable.class ) public void testClosedFSDelete() throws IOException { getClosedFSProvider().delete( getClosedFileA() ); }
@BeforeEach @SuppressWarnings("unchecked") void prepareFileSystem() throws Exception { FileSystemProvider provider = mock(FileSystemProvider.class); when(provider.readAttributes(any(), any(Class.class), any())) // .thenAnswer(invocation -> mock(invocation.getArgument(1))); doThrow(new IOException("Simulated deletion failure")).when(provider).delete(any()); when(fileSystem.provider()).thenReturn(provider); when(fileSystem.getPath(any())).thenAnswer(invocation -> { Path path = mock(Path.class, Arrays.toString(invocation.getArguments())); when(path.getFileSystem()).thenReturn(fileSystem); when(path.toAbsolutePath()).thenReturn(path); when(path.resolve(any(Path.class))).thenAnswer(invocation1 -> invocation1.getArgument(0)); when(path.toFile()).thenThrow(UnsupportedOperationException.class); when(path.relativize(any(Path.class))).thenAnswer(invocation1 -> invocation1.getArgument(0)); return path; }); }
@Test @Category( { Delete.class, Writable.class } ) public void testDeleteUnnormalizedPath() throws IOException { FS.provider().delete( unnormalize( fileTAC() ) ); assertThat( absTAC() ).doesNotExist(); }
if (null!=absoluteFileNames[selectedFile]) { provider.delete(fileSystem.getPath(oldName = absoluteFileNames[selectedFile]));