@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "input files are specified by admin, not unchecked user input") @Override public File replicateFile(FileObject srcFile, FileSelector selector) throws FileSystemException { String baseName = srcFile.getName().getBaseName(); try { String safeBasename = UriParser.encode(baseName, TMP_RESERVED_CHARS).replace('%', '_'); File file = File.createTempFile("vfsr_", "_" + safeBasename, tempDir); file.deleteOnExit(); final FileObject destFile = context.toFileObject(file); destFile.copyFrom(srcFile, selector); return file; } catch (IOException e) { throw new FileSystemException(e); } }
@Override public File replicateFile(FileObject srcFile, FileSelector selector) throws FileSystemException { String baseName = srcFile.getName().getBaseName(); try { String safeBasename = UriParser.encode(baseName, TMP_RESERVED_CHARS).replace('%', '_'); File file = File.createTempFile("vfsr_", "_" + safeBasename, tempDir); file.deleteOnExit(); final FileObject destFile = context.toFileObject(file); destFile.copyFrom(srcFile, selector); return file; } catch (IOException e) { throw new FileSystemException(e); } }
/** * Physically deletes the file from the filesystem. * * @param file The File to delete. */ protected void deleteFile(final File file) { try { final FileObject fileObject = getContext().toFileObject(file); fileObject.deleteAll(); } catch (final FileSystemException e) { final String message = Messages.getString("vfs.impl/delete-temp.warn", file.getName()); VfsLog.warn(getLogger(), log, message, e); } }
/** * Physically deletes the file from the filesystem. * * @param file The File to delete. */ protected void deleteFile(final File file) { try { final FileObject fileObject = getContext().toFileObject(file); fileObject.deleteAll(); } catch (final FileSystemException e) { final String message = Messages.getString("vfs.impl/delete-temp.warn", file.getName()); VfsLog.warn(getLogger(), log, message, e); } }
/** * Physically deletes the file from the filesystem. * * @param file The File to delete. */ protected void deleteFile(final File file) { try { final FileObject fileObject = getContext().toFileObject(file); fileObject.deleteAll(); } catch (final FileSystemException e) { final String message = Messages.getString("vfs.impl/delete-temp.warn", file.getName()); VfsLog.warn(getLogger(), log, message, e); } }
/** * Physically deletes the file from the filesystem. * * @param file The File to delete. */ protected void deleteFile(final File file) { try { final FileObject fileObject = getContext().toFileObject(file); fileObject.deleteAll(); } catch (final FileSystemException e) { final String message = Messages.getString("vfs.impl/delete-temp.warn", file.getName()); VfsLog.warn(getLogger(), log, message, e); } }
/** * Creates a local copy of the file, and all its descendants. * * @param srcFile The file to copy. * @param selector The FileSelector. * @return the created File. * @throws FileSystemException if an error occurs copying the file. */ @Override public File replicateFile(final FileObject srcFile, final FileSelector selector) throws FileSystemException { final String basename = srcFile.getName().getBaseName(); final File file = allocateFile(basename); // Copy from the source file final FileObject destFile = getContext().toFileObject(file); destFile.copyFrom(srcFile, selector); return file; } }
/** * Creates a local copy of the file, and all its descendants. * * @param srcFile The file to copy. * @param selector The FileSelector. * @return the created File. * @throws FileSystemException if an error occurs copying the file. */ @Override public File replicateFile(final FileObject srcFile, final FileSelector selector) throws FileSystemException { final String basename = srcFile.getName().getBaseName(); final File file = allocateFile(basename); // Copy from the source file final FileObject destFile = getContext().toFileObject(file); destFile.copyFrom(srcFile, selector); return file; } }
/** * Creates a local copy of the file, and all its descendants. * * @param srcFile The file to copy. * @param selector The FileSelector. * @return the created File. * @throws FileSystemException if an error occurs copying the file. */ @Override public File replicateFile(final FileObject srcFile, final FileSelector selector) throws FileSystemException { final String basename = srcFile.getName().getBaseName(); final File file = allocateFile(basename); // Copy from the source file final FileObject destFile = getContext().toFileObject(file); destFile.copyFrom(srcFile, selector); return file; } }
/** * Creates a local copy of the file, and all its descendants. * * @param srcFile The file to copy. * @param selector The FileSelector. * @return the created File. * @throws FileSystemException if an error occurs copying the file. */ @Override public File replicateFile(final FileObject srcFile, final FileSelector selector) throws FileSystemException { final String basename = srcFile.getName().getBaseName(); final File file = allocateFile(basename); // Copy from the source file final FileObject destFile = getContext().toFileObject(file); destFile.copyFrom(srcFile, selector); return file; } }