Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java Thu Sep 14 19:26:39 2017 @@ -47,10 +47,9 @@ import org.apache.commons.vfs2.util.Rand /** * An FTP file. */ -public class FtpFileObject extends AbstractFileObject<FtpFileSystem> -{ - private static final Map<String, FTPFile> EMPTY_FTP_FILE_MAP = - Collections.unmodifiableMap(new TreeMap<String, FTPFile>()); +public class FtpFileObject extends AbstractFileObject<FtpFileSystem> { + private static final Map<String, FTPFile> EMPTY_FTP_FILE_MAP = Collections + .unmodifiableMap(new TreeMap<String, FTPFile>()); private static final FTPFile UNKNOWN = new FTPFile(); private static final Log log = LogFactory.getLog(FtpFileObject.class); @@ -63,23 +62,17 @@ public class FtpFileObject extends Abstr private boolean inRefresh; - protected FtpFileObject(final AbstractFileName name, - final FtpFileSystem fileSystem, - final FileName rootName) - throws FileSystemException - { + protected FtpFileObject(final AbstractFileName name, final FtpFileSystem fileSystem, final FileName rootName) + throws FileSystemException { super(name, fileSystem); final String relPath = UriParser.decode(rootName.getRelativeName(name)); - if (".".equals(relPath)) - { + if (".".equals(relPath)) { // do not use the "." as path against the ftp-server // e.g. the uu.net ftp-server do a recursive listing then // this.relPath = UriParser.decode(rootName.getPath()); // this.relPath = "."; this.relPath = null; - } - else - { + } else { this.relPath = relPath; } } @@ -87,18 +80,16 @@ public class FtpFileObject extends Abstr /** * Called by child file objects, to locate their ftp file info. * - * @param name the filename in its native form ie. without uri stuff (%nn) + * @param name the filename in its native form ie. without uri stuff (%nn) * @param flush recreate children cache */ - private FTPFile getChildFile(final String name, final boolean flush) throws IOException - { - /* If we should flush cached children, clear our children map unless - * we're in the middle of a refresh in which case we've just recently - * refreshed our children. No need to do it again when our children are - * refresh()ed, calling getChildFile() for themselves from within - * getInfo(). See getChildren(). */ - if (flush && !inRefresh) - { + private FTPFile getChildFile(final String name, final boolean flush) throws IOException { + /* + * If we should flush cached children, clear our children map unless we're in the middle of a refresh in which + * case we've just recently refreshed our children. No need to do it again when our children are refresh()ed, + * calling getChildFile() for themselves from within getInfo(). See getChildren(). + */ + if (flush && !inRefresh) { children = null; } @@ -106,8 +97,7 @@ public class FtpFileObject extends Abstr doGetChildren(); // VFS-210 - if (children == null) - { + if (children == null) { return null; } @@ -119,52 +109,39 @@ public class FtpFileObject extends Abstr /** * Fetches the children of this file, if not already cached. */ - private void doGetChildren() throws IOException - { - if (children != null) - { + private void doGetChildren() throws IOException { + if (children != null) { return; } final FtpClient client = getAbstractFileSystem().getClient(); - try - { + try { final String path = fileInfo != null && fileInfo.isSymbolicLink() - ? getFileSystem().getFileSystemManager(). - resolveName(getParent().getName(), fileInfo.getLink()).getPath() - : relPath; + ? getFileSystem().getFileSystemManager().resolveName(getParent().getName(), fileInfo.getLink()) + .getPath() + : relPath; final FTPFile[] tmpChildren = client.listFiles(path); - if (tmpChildren == null || tmpChildren.length == 0) - { + if (tmpChildren == null || tmpChildren.length == 0) { children = EMPTY_FTP_FILE_MAP; - } - else - { + } else { children = new TreeMap<>(); // Remove '.' and '..' elements - for (int i = 0; i < tmpChildren.length; i++) - { + for (int i = 0; i < tmpChildren.length; i++) { final FTPFile child = tmpChildren[i]; - if (child == null) - { - if (log.isDebugEnabled()) - { + if (child == null) { + if (log.isDebugEnabled()) { log.debug(Messages.getString("vfs.provider.ftp/invalid-directory-entry.debug", Integer.valueOf(i), relPath)); } continue; } - if (!".".equals(child.getName()) - && !"..".equals(child.getName())) - { + if (!".".equals(child.getName()) && !"..".equals(child.getName())) { children.put(child.getName(), child); } } } - } - finally - { + } finally { getAbstractFileSystem().putClient(client); } } @@ -173,9 +150,7 @@ public class FtpFileObject extends Abstr * Attaches this file object to its file resource. */ @Override - protected void doAttach() - throws IOException - { + protected void doAttach() throws IOException { // Get the parent folder to find the info for this file // VFS-210 getInfo(false); } @@ -183,27 +158,20 @@ public class FtpFileObject extends Abstr /** * Fetches the info for this file. */ - private void getInfo(final boolean flush) throws IOException - { + private void getInfo(final boolean flush) throws IOException { final FtpFileObject parent = (FtpFileObject) FileObjectUtils.getAbstractFileObject(getParent()); FTPFile newFileInfo; - if (parent != null) - { + if (parent != null) { newFileInfo = parent.getChildFile(UriParser.decode(getName().getBaseName()), flush); - } - else - { + } else { // Assume the root is a directory and exists newFileInfo = new FTPFile(); newFileInfo.setType(FTPFile.DIRECTORY_TYPE); } - if (newFileInfo == null) - { + if (newFileInfo == null) { this.fileInfo = UNKNOWN; - } - else - { + } else { this.fileInfo = newFileInfo; } } @@ -212,34 +180,21 @@ public class FtpFileObject extends Abstr * @throws FileSystemException if an error occurs. */ @Override - public void refresh() throws FileSystemException - { - if (!inRefresh) - { - try - { + public void refresh() throws FileSystemException { + if (!inRefresh) { + try { inRefresh = true; super.refresh(); - synchronized (getFileSystem()) - { + synchronized (getFileSystem()) { this.fileInfo = null; } - /* VFS-210 - try - { - // this will tell the parent to recreate its children collection - getInfo(true); - } - catch (IOException e) - { - throw new FileSystemException(e); - } - */ - } - finally - { + /* + * VFS-210 try { // this will tell the parent to recreate its children collection getInfo(true); } catch + * (IOException e) { throw new FileSystemException(e); } + */ + } finally { inRefresh = false; } } @@ -249,10 +204,8 @@ public class FtpFileObject extends Abstr * Detaches this file object from its file resource. */ @Override - protected void doDetach() - { - synchronized (getFileSystem()) - { + protected void doDetach() { + synchronized (getFileSystem()) { this.fileInfo = null; children = null; } @@ -262,21 +215,14 @@ public class FtpFileObject extends Abstr * Called when the children of this file change. */ @Override - protected void onChildrenChanged(final FileName child, final FileType newType) - { - if (children != null && newType.equals(FileType.IMAGINARY)) - { - try - { + protected void onChildrenChanged(final FileName child, final FileType newType) { + if (children != null && newType.equals(FileType.IMAGINARY)) { + try { children.remove(UriParser.decode(child.getBaseName())); - } - catch (final FileSystemException e) - { + } catch (final FileSystemException e) { throw new RuntimeException(e.getMessage()); } - } - else - { + } else { // if child was added we have to rescan the children // TODO - get rid of this children = null; @@ -287,15 +233,12 @@ public class FtpFileObject extends Abstr * Called when the type or content of this file changes. */ @Override - protected void onChange() throws IOException - { + protected void onChange() throws IOException { children = null; - if (getType().equals(FileType.IMAGINARY)) - { + if (getType().equals(FileType.IMAGINARY)) { // file is deleted, avoid server lookup - synchronized (getFileSystem()) - { + synchronized (getFileSystem()) { this.fileInfo = UNKNOWN; } return; @@ -305,39 +248,26 @@ public class FtpFileObject extends Abstr } /** - * Determines the type of the file, returns null if the file does not - * exist. + * Determines the type of the file, returns null if the file does not exist. */ @Override - protected FileType doGetType() - throws Exception - { + protected FileType doGetType() throws Exception { // VFS-210 - synchronized (getFileSystem()) - { - if (this.fileInfo == null) - { + synchronized (getFileSystem()) { + if (this.fileInfo == null) { getInfo(false); } - if (this.fileInfo == UNKNOWN) - { + if (this.fileInfo == UNKNOWN) { return FileType.IMAGINARY; - } - else if (this.fileInfo.isDirectory()) - { + } else if (this.fileInfo.isDirectory()) { return FileType.FOLDER; - } - else if (this.fileInfo.isFile()) - { + } else if (this.fileInfo.isFile()) { return FileType.FILE; - } - else if (this.fileInfo.isSymbolicLink()) - { + } else if (this.fileInfo.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: We need to check if the symbolic link links back to the symbolic link itself - if (this.isCircular(linkDest)) - { + if (this.isCircular(linkDest)) { // If the symbolic link links back to itself, treat it as an imaginary file to prevent following // this link. If the user tries to access the link as a file or directory, the user will end up with // a FileSystemException warning that the file cannot be accessed. This is to prevent the infinite @@ -351,18 +281,14 @@ public class FtpFileObject extends Abstr throw new FileSystemException("vfs.provider.ftp/get-type.error", getName()); } - private FileObject getLinkDestination() throws FileSystemException - { - if (linkDestination == null) - { + private FileObject getLinkDestination() throws FileSystemException { + if (linkDestination == null) { final String path; - synchronized (getFileSystem()) - { + synchronized (getFileSystem()) { path = this.fileInfo.getLink(); } FileName relativeTo = getName().getParent(); - if (relativeTo == null) - { + if (relativeTo == null) { relativeTo = getName(); } final FileName linkDestinationName = getFileSystem().getFileSystemManager().resolveName(relativeTo, path); @@ -373,16 +299,12 @@ public class FtpFileObject extends Abstr } @Override - protected FileObject[] doListChildrenResolved() throws Exception - { - synchronized (getFileSystem()) - { - if (this.fileInfo != null && this.fileInfo.isSymbolicLink()) - { + protected FileObject[] doListChildrenResolved() throws Exception { + synchronized (getFileSystem()) { + if (this.fileInfo != null && this.fileInfo.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: Try to avoid a recursion loop. - if (this.isCircular(linkDest)) - { + if (this.isCircular(linkDest)) { return null; } return linkDest.getChildren(); @@ -400,34 +322,26 @@ public class FtpFileObject extends Abstr * @since 2.0 */ @Override - public FileObject[] getChildren() throws FileSystemException - { - try - { - if (doGetType() != FileType.FOLDER) - { + public FileObject[] getChildren() throws FileSystemException { + try { + if (doGetType() != FileType.FOLDER) { throw new FileNotFolderException(getName()); } - } - catch (final Exception ex) - { + } catch (final Exception ex) { throw new FileNotFolderException(getName(), ex); } - try - { - /* Wrap our parent implementation, noting that we're refreshing so - * that we don't refresh() ourselves and each of our parents for - * each children. Note that refresh() will list children. Meaning, - * if if this file has C children, P parents, there will be (C * P) - * listings made with (C * (P + 1)) refreshes, when there should - * really only be 1 listing and C refreshes. */ + try { + /* + * Wrap our parent implementation, noting that we're refreshing so that we don't refresh() ourselves and + * each of our parents for each children. Note that refresh() will list children. Meaning, if if this file + * has C children, P parents, there will be (C * P) listings made with (C * (P + 1)) refreshes, when there + * should really only be 1 listing and C refreshes. + */ this.inRefresh = true; return super.getChildren(); - } - finally - { + } finally { this.inRefresh = false; } } @@ -436,15 +350,12 @@ public class FtpFileObject extends Abstr * Lists the children of the file. */ @Override - protected String[] doListChildren() - throws Exception - { + protected String[] doListChildren() throws Exception { // List the children of this file doGetChildren(); // VFS-210 - if (children == null) - { + if (children == null) { return null; } @@ -452,8 +363,7 @@ public class FtpFileObject extends Abstr final String[] childNames = new String[children.size()]; int childNum = -1; final Iterator<FTPFile> iterChildren = children.values().iterator(); - while (iterChildren.hasNext()) - { + while (iterChildren.hasNext()) { childNum++; final FTPFile child = iterChildren.next(); childNames[childNum] = child.getName(); @@ -466,30 +376,21 @@ public class FtpFileObject extends Abstr * Deletes the file. */ @Override - protected void doDelete() throws Exception - { - synchronized (getFileSystem()) - { + protected void doDelete() throws Exception { + synchronized (getFileSystem()) { final boolean ok; final FtpClient ftpClient = getAbstractFileSystem().getClient(); - try - { - if (this.fileInfo.isDirectory()) - { + try { + if (this.fileInfo.isDirectory()) { ok = ftpClient.removeDirectory(relPath); - } - else - { + } else { ok = ftpClient.deleteFile(relPath); } - } - finally - { + } finally { getAbstractFileSystem().putClient(ftpClient); } - if (!ok) - { + if (!ok) { throw new FileSystemException("vfs.provider.ftp/delete-file.error", getName()); } this.fileInfo = null; @@ -501,27 +402,20 @@ public class FtpFileObject extends Abstr * Renames the file */ @Override - protected void doRename(final FileObject newFile) throws Exception - { - synchronized (getFileSystem()) - { + protected void doRename(final FileObject newFile) throws Exception { + synchronized (getFileSystem()) { final boolean ok; final FtpClient ftpClient = getAbstractFileSystem().getClient(); - try - { + try { final String oldName = relPath; final String newName = ((FtpFileObject) FileObjectUtils.getAbstractFileObject(newFile)).getRelPath(); ok = ftpClient.rename(oldName, newName); - } - finally - { + } finally { getAbstractFileSystem().putClient(ftpClient); } - if (!ok) - { - throw new FileSystemException("vfs.provider.ftp/rename-file.error", - getName().toString(), newFile); + if (!ok) { + throw new FileSystemException("vfs.provider.ftp/rename-file.error", getName().toString(), newFile); } this.fileInfo = null; children = EMPTY_FTP_FILE_MAP; @@ -532,22 +426,16 @@ public class FtpFileObject extends Abstr * Creates this file as a folder. */ @Override - protected void doCreateFolder() - throws Exception - { + protected void doCreateFolder() throws Exception { final boolean ok; final FtpClient client = getAbstractFileSystem().getClient(); - try - { + try { ok = client.makeDirectory(relPath); - } - finally - { + } finally { getAbstractFileSystem().putClient(client); } - if (!ok) - { + if (!ok) { throw new FileSystemException("vfs.provider.ftp/create-folder.error", getName()); } } @@ -556,16 +444,12 @@ public class FtpFileObject extends Abstr * Returns the size of the file content (in bytes). */ @Override - protected long doGetContentSize() throws Exception - { - synchronized (getFileSystem()) - { - if (this.fileInfo.isSymbolicLink()) - { + protected long doGetContentSize() throws Exception { + synchronized (getFileSystem()) { + if (this.fileInfo.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: Try to avoid a recursion loop. - if (this.isCircular(linkDest)) - { + if (this.isCircular(linkDest)) { return this.fileInfo.getSize(); } return linkDest.getContent().getSize(); @@ -580,16 +464,12 @@ public class FtpFileObject extends Abstr * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetLastModifiedTime() */ @Override - protected long doGetLastModifiedTime() throws Exception - { - synchronized (getFileSystem()) - { - if (this.fileInfo.isSymbolicLink()) - { + protected long doGetLastModifiedTime() throws Exception { + synchronized (getFileSystem()) { + if (this.fileInfo.isSymbolicLink()) { final FileObject linkDest = getLinkDestination(); // VFS-437: Try to avoid a recursion loop. - if (this.isCircular(linkDest)) - { + if (this.isCircular(linkDest)) { return getTimestamp(); } return linkDest.getContent().getLastModifiedTime(); @@ -602,29 +482,23 @@ public class FtpFileObject extends Abstr * Creates an input stream to read the file content from. */ @Override - protected InputStream doGetInputStream() throws Exception - { + protected InputStream doGetInputStream() throws Exception { final FtpClient client = getAbstractFileSystem().getClient(); - try - { + try { final InputStream instr = client.retrieveFileStream(relPath); // VFS-210 - if (instr == null) - { + if (instr == null) { throw new FileNotFoundException(getName().toString()); } return new FtpInputStream(client, instr); - } - catch (final Exception e) - { + } catch (final Exception e) { getAbstractFileSystem().putClient(client); throw e; } } @Override - protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception - { + protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception { return new FtpRandomAccessContent(this, mode); } @@ -632,45 +506,33 @@ public class FtpFileObject extends Abstr * Creates an output stream to write the file content to. */ @Override - protected OutputStream doGetOutputStream(final boolean bAppend) - throws Exception - { + protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception { final FtpClient client = getAbstractFileSystem().getClient(); - try - { + try { OutputStream out = null; - if (bAppend) - { + if (bAppend) { out = client.appendFileStream(relPath); - } - else - { + } else { out = client.storeFileStream(relPath); } - if (out == null) - { - throw new FileSystemException("vfs.provider.ftp/output-error.debug", - this.getName(), + if (out == null) { + throw new FileSystemException("vfs.provider.ftp/output-error.debug", this.getName(), client.getReplyString()); } return new FtpOutputStream(client, out); - } - catch (final Exception e) - { + } catch (final Exception e) { getAbstractFileSystem().putClient(client); throw e; } } - String getRelPath() - { + String getRelPath() { return relPath; } - private long getTimestamp() - { + private long getTimestamp() { final Calendar timestamp = this.fileInfo.getTimestamp(); return timestamp == null ? 0L : timestamp.getTime().getTime(); } @@ -678,27 +540,20 @@ public class FtpFileObject extends Abstr /** * This is an over simplistic implementation for VFS-437. */ - private boolean isCircular(final FileObject linkDest) throws FileSystemException - { + private boolean isCircular(final FileObject linkDest) throws FileSystemException { return linkDest.getName().getPathDecoded().equals(this.getName().getPathDecoded()); } - FtpInputStream getInputStream(final long filePointer) throws IOException - { + FtpInputStream getInputStream(final long filePointer) throws IOException { final FtpClient client = getAbstractFileSystem().getClient(); - try - { + try { final InputStream instr = client.retrieveFileStream(relPath, filePointer); - if (instr == null) - { - throw new FileSystemException("vfs.provider.ftp/input-error.debug", - this.getName(), + if (instr == null) { + throw new FileSystemException("vfs.provider.ftp/input-error.debug", this.getName(), client.getReplyString()); } return new FtpInputStream(client, instr); - } - catch (final IOException e) - { + } catch (final IOException e) { getAbstractFileSystem().putClient(client); throw e; } @@ -707,19 +562,15 @@ public class FtpFileObject extends Abstr /** * An InputStream that monitors for end-of-file. */ - class FtpInputStream - extends MonitorInputStream - { + class FtpInputStream extends MonitorInputStream { private final FtpClient client; - public FtpInputStream(final FtpClient client, final InputStream in) - { + public FtpInputStream(final FtpClient client, final InputStream in) { super(in); this.client = client; } - void abort() throws IOException - { + void abort() throws IOException { client.abort(); close(); } @@ -728,20 +579,15 @@ public class FtpFileObject extends Abstr * Called after the stream has been closed. */ @Override - protected void onClose() throws IOException - { + protected void onClose() throws IOException { final boolean ok; - try - { + try { ok = client.completePendingCommand(); - } - finally - { + } finally { getAbstractFileSystem().putClient(client); } - if (!ok) - { + if (!ok) { throw new FileSystemException("vfs.provider.ftp/finish-get.error", getName()); } } @@ -750,13 +596,10 @@ public class FtpFileObject extends Abstr /** * An OutputStream that monitors for end-of-file. */ - private class FtpOutputStream - extends MonitorOutputStream - { + private class FtpOutputStream extends MonitorOutputStream { private final FtpClient client; - public FtpOutputStream(final FtpClient client, final OutputStream outstr) - { + public FtpOutputStream(final FtpClient client, final OutputStream outstr) { super(outstr); this.client = client; } @@ -765,20 +608,15 @@ public class FtpFileObject extends Abstr * Called after this stream is closed. */ @Override - protected void onClose() throws IOException - { + protected void onClose() throws IOException { final boolean ok; - try - { + try { ok = client.completePendingCommand(); - } - finally - { + } finally { getAbstractFileSystem().putClient(client); } - if (!ok) - { + if (!ok) { throw new FileSystemException("vfs.provider.ftp/finish-put.error", getName()); } }
Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java Thu Sep 14 19:26:39 2017 @@ -33,9 +33,7 @@ import org.apache.commons.vfs2.provider. /** * A provider for FTP file systems. */ -public class FtpFileProvider - extends AbstractOriginatingFileProvider -{ +public class FtpFileProvider extends AbstractOriginatingFileProvider { /** * File Entry Parser. */ @@ -44,31 +42,18 @@ public class FtpFileProvider /** * Authenticator types. */ - public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[] - { - UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD - }; - - static final Collection<Capability> capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[] - { - Capability.CREATE, - Capability.DELETE, - Capability.RENAME, - Capability.GET_TYPE, - Capability.LIST_CHILDREN, - Capability.READ_CONTENT, - Capability.GET_LAST_MODIFIED, - Capability.URI, - Capability.WRITE_CONTENT, - Capability.APPEND_CONTENT, - Capability.RANDOM_ACCESS_READ, - })); + public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[] { + UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD }; + + static final Collection<Capability> capabilities = Collections.unmodifiableCollection(Arrays + .asList(new Capability[] { Capability.CREATE, Capability.DELETE, Capability.RENAME, Capability.GET_TYPE, + Capability.LIST_CHILDREN, Capability.READ_CONTENT, Capability.GET_LAST_MODIFIED, Capability.URI, + Capability.WRITE_CONTENT, Capability.APPEND_CONTENT, Capability.RANDOM_ACCESS_READ, })); /** * Constructs a new provider. */ - public FtpFileProvider() - { + public FtpFileProvider() { super(); setFileNameParser(FtpFileNameParser.getInstance()); } @@ -78,33 +63,26 @@ public class FtpFileProvider */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; final FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions); /* - FTPClient ftpClient = FtpClientFactory.createConnection(rootName.getHostName(), - rootName.getPort(), - rootName.getUserName(), - rootName.getPassword(), - rootName.getPath(), - fileSystemOptions); - */ + * FTPClient ftpClient = FtpClientFactory.createConnection(rootName.getHostName(), rootName.getPort(), + * rootName.getUserName(), rootName.getPassword(), rootName.getPath(), fileSystemOptions); + */ return new FtpFileSystem(rootName, ftpClient, fileSystemOptions); } @Override - public FileSystemConfigBuilder getConfigBuilder() - { + public FileSystemConfigBuilder getConfigBuilder() { return FtpFileSystemConfigBuilder.getInstance(); } @Override - public Collection<Capability> getCapabilities() - { + public Collection<Capability> getCapabilities() { return capabilities; } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java Thu Sep 14 19:26:39 2017 @@ -34,14 +34,13 @@ import org.apache.commons.vfs2.provider. /** * An FTP file system. */ -public class FtpFileSystem extends AbstractFileSystem -{ +public class FtpFileSystem extends AbstractFileSystem { private static final Log LOG = LogFactory.getLog(FtpFileSystem.class); -// private final String hostname; -// private final int port; -// private final String username; -// private final String password; + // private final String hostname; + // private final int port; + // private final String username; + // private final String password; // An idle client private final AtomicReference<FtpClient> idleClient = new AtomicReference<>(); @@ -51,10 +50,9 @@ public class FtpFileSystem extends Abstr * @param ftpClient The FtpClient. * @param fileSystemOptions The FileSystemOptions. * @since 2.0 (was protected) - * */ + */ public FtpFileSystem(final GenericFileName rootName, final FtpClient ftpClient, - final FileSystemOptions fileSystemOptions) - { + final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); // hostname = rootName.getHostName(); // port = rootName.getPort(); @@ -63,12 +61,10 @@ public class FtpFileSystem extends Abstr } @Override - protected void doCloseCommunicationLink() - { + protected void doCloseCommunicationLink() { final FtpClient idle = idleClient.getAndSet(null); // Clean up the connection - if (idle != null) - { + if (idle != null) { closeConnection(idle); } } @@ -77,27 +73,22 @@ public class FtpFileSystem extends Abstr * Adds the capabilities of this file system. */ @Override - protected void addCapabilities(final Collection<Capability> caps) - { + protected void addCapabilities(final Collection<Capability> caps) { caps.addAll(FtpFileProvider.capabilities); } /** * Cleans up the connection to the server. + * * @param client The FtpClient. */ - private void closeConnection(final FtpClient client) - { - try - { + private void closeConnection(final FtpClient client) { + try { // Clean up - if (client.isConnected()) - { + if (client.isConnected()) { client.disconnect(); } - } - catch (final IOException e) - { + } catch (final IOException e) { // getLogger().warn("vfs.provider.ftp/close-connection.error", e); VfsLog.warn(getLogger(), LOG, "vfs.provider.ftp/close-connection.error", e); } @@ -105,15 +96,14 @@ public class FtpFileSystem extends Abstr /** * Creates an FTP client to use. + * * @return An FTPCleint. * @throws FileSystemException if an error occurs. */ - public FtpClient getClient() throws FileSystemException - { + public FtpClient getClient() throws FileSystemException { FtpClient client = idleClient.getAndSet(null); - if (client == null || !client.isConnected()) - { + if (client == null || !client.isConnected()) { client = createWrapper(); } @@ -122,37 +112,33 @@ public class FtpFileSystem extends Abstr /** * Get the wrapper to access this file system. + * * @return new instance. * @throws FileSystemException if any error occurs. * @since 2.1 */ - protected FTPClientWrapper createWrapper() throws FileSystemException - { + protected FTPClientWrapper createWrapper() throws FileSystemException { return new FTPClientWrapper((GenericFileName) getRoot().getName(), getFileSystemOptions()); } /** * Returns an FTP client after use. + * * @param client The FTPClient. */ - public void putClient(final FtpClient client) - { + public void putClient(final FtpClient client) { // Save client for reuse if none is idle. - if (!idleClient.compareAndSet(null, client)) - { + if (!idleClient.compareAndSet(null, client)) { // An idle client is already present so close the connection. closeConnection(client); } } - /** * Creates a file object. */ @Override - protected FileObject createFile(final AbstractFileName name) - throws FileSystemException - { + protected FileObject createFile(final AbstractFileName name) throws FileSystemException { return new FtpFileObject(name, this, getRootName()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java Thu Sep 14 19:26:39 2017 @@ -26,8 +26,7 @@ import org.apache.commons.vfs2.FileSyste /** * The config builder for various ftp configuration options. */ -public class FtpFileSystemConfigBuilder extends FileSystemConfigBuilder -{ +public class FtpFileSystemConfigBuilder extends FileSystemConfigBuilder { private static final String _PREFIX = FtpFileSystemConfigBuilder.class.getName(); private static final FtpFileSystemConfigBuilder BUILDER = new FtpFileSystemConfigBuilder(); @@ -48,18 +47,17 @@ public class FtpFileSystemConfigBuilder private static final String SO_TIMEOUT = _PREFIX + ".SO_TIMEOUT"; private static final String USER_DIR_IS_ROOT = _PREFIX + ".USER_DIR_IS_ROOT"; - private FtpFileSystemConfigBuilder() - { + private FtpFileSystemConfigBuilder() { super("ftp."); } /** * Create new config builder with specified prefix string. + * * @param prefix prefix string to use for parameters of this config builder. * @since 2.1 */ - protected FtpFileSystemConfigBuilder(final String prefix) - { + protected FtpFileSystemConfigBuilder(final String prefix) { super(prefix); } @@ -68,14 +66,12 @@ public class FtpFileSystemConfigBuilder * * @return the singleton instance. */ - public static FtpFileSystemConfigBuilder getInstance() - { + public static FtpFileSystemConfigBuilder getInstance() { return BUILDER; } @Override - protected Class<? extends FileSystem> getConfigClass() - { + protected Class<? extends FileSystem> getConfigClass() { return FtpFileSystem.class; } @@ -86,8 +82,7 @@ public class FtpFileSystemConfigBuilder * @return The timeout in milliseconds to use for the socket connection. * @since 2.1 */ - public Integer getConnectTimeout(final FileSystemOptions opts) - { + public Integer getConnectTimeout(final FileSystemOptions opts) { return getInteger(opts, CONNECT_TIMEOUT); } @@ -95,9 +90,8 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @return The encoding. * @since 2.0 - * */ - public String getControlEncoding(final FileSystemOptions opts) - { + */ + public String getControlEncoding(final FileSystemOptions opts) { return getString(opts, ENCODING); } @@ -106,20 +100,18 @@ public class FtpFileSystemConfigBuilder * @return The timeout for opening the data channel in milliseconds. * @see #setDataTimeout */ - public Integer getDataTimeout(final FileSystemOptions opts) - { + public Integer getDataTimeout(final FileSystemOptions opts) { return getInteger(opts, DATA_TIMEOUT); } /** - * Get the default date format used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} - * for details and examples. + * Get the default date format used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} for + * details and examples. * * @param opts The FileSystemOptions * @return The default date format. */ - public String getDefaultDateFormat(final FileSystemOptions opts) - { + public String getDefaultDateFormat(final FileSystemOptions opts) { return getString(opts, DEFAULT_DATE_FORMAT); } @@ -128,8 +120,7 @@ public class FtpFileSystemConfigBuilder * @see #setEntryParser * @return the key to the EntryParser. */ - public String getEntryParser(final FileSystemOptions opts) - { + public String getEntryParser(final FileSystemOptions opts) { return getString(opts, FACTORY_KEY); } @@ -138,8 +129,7 @@ public class FtpFileSystemConfigBuilder * @see #setEntryParserFactory * @return An FTPFileEntryParserFactory. */ - public FTPFileEntryParserFactory getEntryParserFactory(final FileSystemOptions opts) - { + public FTPFileEntryParserFactory getEntryParserFactory(final FileSystemOptions opts) { return (FTPFileEntryParserFactory) getParam(opts, FTPFileEntryParserFactory.class.getName()); } @@ -150,8 +140,7 @@ public class FtpFileSystemConfigBuilder * @return A FtpFileType * @since 2.1 */ - public FtpFileType getFileType(final FileSystemOptions opts) - { + public FtpFileType getFileType(final FileSystemOptions opts) { return getEnum(FtpFileType.class, opts, FILE_TYPE); } @@ -160,8 +149,7 @@ public class FtpFileSystemConfigBuilder * @return true if passive mode is set. * @see #setPassiveMode */ - public Boolean getPassiveMode(final FileSystemOptions opts) - { + public Boolean getPassiveMode(final FileSystemOptions opts) { return getBoolean(opts, PASSIVE_MODE); } @@ -172,8 +160,7 @@ public class FtpFileSystemConfigBuilder * @return the Proxy * @since 2.1 */ - public Proxy getProxy(final FileSystemOptions opts) - { + public Proxy getProxy(final FileSystemOptions opts) { return (Proxy) this.getParam(opts, PROXY); } @@ -183,8 +170,7 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @return The recent date format. */ - public String getRecentDateFormat(final FileSystemOptions opts) - { + public String getRecentDateFormat(final FileSystemOptions opts) { return getString(opts, RECENT_DATE_FORMAT); } @@ -194,20 +180,18 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @return True if remote verification should be done. */ - public Boolean getRemoteVerification(final FileSystemOptions opts) - { + public Boolean getRemoteVerification(final FileSystemOptions opts) { return getBoolean(opts, REMOTE_VERIFICATION); } /** - * Get the language code used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} - * for details and examples. + * Get the language code used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} for details and + * examples. * * @param opts The FilesystemOptions. * @return The language code of the server. */ - public String getServerLanguageCode(final FileSystemOptions opts) - { + public String getServerLanguageCode(final FileSystemOptions opts) { return getString(opts, SERVER_LANGUAGE_CODE); } @@ -217,8 +201,7 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @return The server timezone id. */ - public String getServerTimeZoneId(final FileSystemOptions opts) - { + public String getServerTimeZoneId(final FileSystemOptions opts) { return getString(opts, SERVER_TIME_ZONE_ID); } @@ -228,8 +211,7 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @return An array of short month names. */ - public String[] getShortMonthNames(final FileSystemOptions opts) - { + public String[] getShortMonthNames(final FileSystemOptions opts) { return (String[]) getParam(opts, SHORT_MONTH_NAMES); } @@ -239,8 +221,7 @@ public class FtpFileSystemConfigBuilder * @see #getDataTimeout * @since 2.0 */ - public Integer getSoTimeout(final FileSystemOptions opts) - { + public Integer getSoTimeout(final FileSystemOptions opts) { return getInteger(opts, SO_TIMEOUT); } @@ -249,13 +230,11 @@ public class FtpFileSystemConfigBuilder * <code>Boolean.TRUE</code> if the method {@link #setUserDirIsRoot(FileSystemOptions, boolean)} has not been * invoked. * - * @param opts - * The FileSystemOptions. + * @param opts The FileSystemOptions. * @return <code>Boolean.TRUE</code> if VFS treats the user directory as the root directory. * @see #setUserDirIsRoot */ - public Boolean getUserDirIsRoot(final FileSystemOptions opts) - { + public Boolean getUserDirIsRoot(final FileSystemOptions opts) { return getBoolean(opts, USER_DIR_IS_ROOT, Boolean.TRUE); } @@ -268,8 +247,7 @@ public class FtpFileSystemConfigBuilder * @param connectTimeout the timeout value in milliseconds * @since 2.1 */ - public void setConnectTimeout(final FileSystemOptions opts, final Integer connectTimeout) - { + public void setConnectTimeout(final FileSystemOptions opts, final Integer connectTimeout) { setParam(opts, CONNECT_TIMEOUT, connectTimeout); } @@ -280,49 +258,43 @@ public class FtpFileSystemConfigBuilder * @param encoding the encoding to use * @since 2.0 */ - public void setControlEncoding(final FileSystemOptions opts, final String encoding) - { + public void setControlEncoding(final FileSystemOptions opts, final String encoding) { setParam(opts, ENCODING, encoding); } /** * Set the data timeout for the ftp client. * <p> - * If you set the {@code dataTimeout} to {@code null}, no dataTimeout will be set on the - * ftp client. + * If you set the {@code dataTimeout} to {@code null}, no dataTimeout will be set on the ftp client. * * @param opts The FileSystemOptions. * @param dataTimeout The timeout value. */ - public void setDataTimeout(final FileSystemOptions opts, final Integer dataTimeout) - { + public void setDataTimeout(final FileSystemOptions opts, final Integer dataTimeout) { setParam(opts, DATA_TIMEOUT, dataTimeout); } /** - * Set the default date format used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} - * for details and examples. + * Set the default date format used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} for + * details and examples. * * @param opts The FileSystemOptions. * @param defaultDateFormat The default date format. */ - public void setDefaultDateFormat(final FileSystemOptions opts, final String defaultDateFormat) - { + public void setDefaultDateFormat(final FileSystemOptions opts, final String defaultDateFormat) { setParam(opts, DEFAULT_DATE_FORMAT, defaultDateFormat); } /** * Set the FQCN of your FileEntryParser used to parse the directory listing from your server. * <p> - * If you do not use the default commons-net FTPFileEntryParserFactory e.g. by using - * {@link #setEntryParserFactory} this is the "key" parameter passed as argument into your - * custom factory. + * If you do not use the default commons-net FTPFileEntryParserFactory e.g. by using {@link #setEntryParserFactory} + * this is the "key" parameter passed as argument into your custom factory. * * @param opts The FileSystemOptions. * @param key The key. */ - public void setEntryParser(final FileSystemOptions opts, final String key) - { + public void setEntryParser(final FileSystemOptions opts, final String key) { setParam(opts, FACTORY_KEY, key); } @@ -332,8 +304,7 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @param factory instance of your factory */ - public void setEntryParserFactory(final FileSystemOptions opts, final FTPFileEntryParserFactory factory) - { + public void setEntryParserFactory(final FileSystemOptions opts, final FTPFileEntryParserFactory factory) { setParam(opts, FTPFileEntryParserFactory.class.getName(), factory); } @@ -344,8 +315,7 @@ public class FtpFileSystemConfigBuilder * @param ftpFileType A FtpFileType * @since 2.1 */ - public void setFileType(final FileSystemOptions opts, final FtpFileType ftpFileType) - { + public void setFileType(final FileSystemOptions opts, final FtpFileType ftpFileType) { setParam(opts, FILE_TYPE, ftpFileType); } @@ -355,23 +325,20 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @param passiveMode true if passive mode should be used. */ - public void setPassiveMode(final FileSystemOptions opts, final boolean passiveMode) - { + public void setPassiveMode(final FileSystemOptions opts, final boolean passiveMode) { setParam(opts, PASSIVE_MODE, passiveMode ? Boolean.TRUE : Boolean.FALSE); } /** * Sets the Proxy. * <p> - * You might need to make sure that {@link #setPassiveMode(FileSystemOptions, boolean) passive mode} - * is activated. + * You might need to make sure that {@link #setPassiveMode(FileSystemOptions, boolean) passive mode} is activated. * * @param opts the FileSystem options. * @param proxy the Proxy * @since 2.1 */ - public void setProxy(final FileSystemOptions opts, final Proxy proxy) - { + public void setProxy(final FileSystemOptions opts, final Proxy proxy) { setParam(opts, PROXY, proxy); } @@ -381,8 +348,7 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @param recentDateFormat The recent date format. */ - public void setRecentDateFormat(final FileSystemOptions opts, final String recentDateFormat) - { + public void setRecentDateFormat(final FileSystemOptions opts, final String recentDateFormat) { setParam(opts, RECENT_DATE_FORMAT, recentDateFormat); } @@ -392,20 +358,18 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @param remoteVerification True if verification should be done. */ - public void setRemoteVerification(final FileSystemOptions opts, final boolean remoteVerification) - { + public void setRemoteVerification(final FileSystemOptions opts, final boolean remoteVerification) { setParam(opts, REMOTE_VERIFICATION, remoteVerification); } /** - * Set the language code used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} - * for details and examples. + * Set the language code used by the server. See {@link org.apache.commons.net.ftp.FTPClientConfig} for details and + * examples. * * @param opts The FileSystemOptions. * @param serverLanguageCode The servers language code. */ - public void setServerLanguageCode(final FileSystemOptions opts, final String serverLanguageCode) - { + public void setServerLanguageCode(final FileSystemOptions opts, final String serverLanguageCode) { setParam(opts, SERVER_LANGUAGE_CODE, serverLanguageCode); } @@ -415,8 +379,7 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @param serverTimeZoneId The server timezone id. */ - public void setServerTimeZoneId(final FileSystemOptions opts, final String serverTimeZoneId) - { + public void setServerTimeZoneId(final FileSystemOptions opts, final String serverTimeZoneId) { setParam(opts, SERVER_TIME_ZONE_ID, serverTimeZoneId); } @@ -426,11 +389,9 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @param shortMonthNames an array of short month name Strings. */ - public void setShortMonthNames(final FileSystemOptions opts, final String[] shortMonthNames) - { + public void setShortMonthNames(final FileSystemOptions opts, final String[] shortMonthNames) { String[] clone = null; - if (shortMonthNames != null) - { + if (shortMonthNames != null) { clone = new String[shortMonthNames.length]; System.arraycopy(shortMonthNames, 0, clone, 0, shortMonthNames.length); } @@ -441,15 +402,13 @@ public class FtpFileSystemConfigBuilder /** * Sets the socket timeout for the FTP client. * <p> - * If you set the {@code soTimeout} to {@code null}, no socket timeout will be set on the - * ftp client. + * If you set the {@code soTimeout} to {@code null}, no socket timeout will be set on the ftp client. * * @param opts The FileSystem options. * @param soTimeout The timeout value in milliseconds. * @since 2.0 */ - public void setSoTimeout(final FileSystemOptions opts, final Integer soTimeout) - { + public void setSoTimeout(final FileSystemOptions opts, final Integer soTimeout) { setParam(opts, SO_TIMEOUT, soTimeout); } @@ -459,8 +418,7 @@ public class FtpFileSystemConfigBuilder * @param opts The FileSystemOptions. * @param userDirIsRoot true if the user directory should be treated as the root. */ - public void setUserDirIsRoot(final FileSystemOptions opts, final boolean userDirIsRoot) - { + public void setUserDirIsRoot(final FileSystemOptions opts, final boolean userDirIsRoot) { setParam(opts, USER_DIR_IS_ROOT, userDirIsRoot ? Boolean.TRUE : Boolean.FALSE); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileType.java Thu Sep 14 19:26:39 2017 @@ -23,8 +23,7 @@ import org.apache.commons.net.ftp.FTP; * * @since 2.1 */ -public enum FtpFileType -{ +public enum FtpFileType { /** * The ASCII file type. */ @@ -53,11 +52,9 @@ public enum FtpFileType /** * Constructs a file type. * - * @param fileType - * The Apache Commons Net FTP file type. + * @param fileType The Apache Commons Net FTP file type. */ - private FtpFileType(final int fileType) - { + private FtpFileType(final int fileType) { this.value = fileType; } @@ -66,8 +63,7 @@ public enum FtpFileType * * @return The Apache Commons Net FTP file type. */ - int getValue() - { + int getValue() { return this.value; } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java Thu Sep 14 19:26:39 2017 @@ -27,16 +27,14 @@ import org.apache.commons.vfs2.util.Rand /** * Implements FTP stream-based random access. */ -class FtpRandomAccessContent extends AbstractRandomAccessStreamContent -{ +class FtpRandomAccessContent extends AbstractRandomAccessStreamContent { protected long filePointer; private final FtpFileObject fileObject; private DataInputStream dis; private FtpFileObject.FtpInputStream mis; - FtpRandomAccessContent(final FtpFileObject fileObject, final RandomAccessMode mode) - { + FtpRandomAccessContent(final FtpFileObject fileObject, final RandomAccessMode mode) { super(mode); this.fileObject = fileObject; @@ -44,27 +42,21 @@ class FtpRandomAccessContent extends Abs } @Override - public long getFilePointer() throws IOException - { + public long getFilePointer() throws IOException { return filePointer; } @Override - public void seek(final long pos) throws IOException - { - if (pos == filePointer) - { + public void seek(final long pos) throws IOException { + if (pos == filePointer) { // no change return; } - if (pos < 0) - { - throw new FileSystemException("vfs.provider/random-access-invalid-position.error", - Long.valueOf(pos)); + if (pos < 0) { + throw new FileSystemException("vfs.provider/random-access-invalid-position.error", Long.valueOf(pos)); } - if (dis != null) - { + if (dis != null) { close(); } @@ -72,53 +64,43 @@ class FtpRandomAccessContent extends Abs } @Override - protected DataInputStream getDataInputStream() throws IOException - { - if (dis != null) - { + protected DataInputStream getDataInputStream() throws IOException { + if (dis != null) { return dis; } // FtpClient client = fileSystem.getClient(); mis = fileObject.getInputStream(filePointer); - dis = new DataInputStream(new FilterInputStream(mis) - { + dis = new DataInputStream(new FilterInputStream(mis) { @Override - public int read() throws IOException - { + public int read() throws IOException { final int ret = super.read(); - if (ret > -1) - { + if (ret > -1) { filePointer++; } return ret; } @Override - public int read(final byte[] b) throws IOException - { + public int read(final byte[] b) throws IOException { final int ret = super.read(b); - if (ret > -1) - { + if (ret > -1) { filePointer += ret; } return ret; } @Override - public int read(final byte[] b, final int off, final int len) throws IOException - { + public int read(final byte[] b, final int off, final int len) throws IOException { final int ret = super.read(b, off, len); - if (ret > -1) - { + if (ret > -1) { filePointer += ret; } return ret; } @Override - public void close() throws IOException - { + public void close() throws IOException { FtpRandomAccessContent.this.close(); } }); @@ -126,12 +108,9 @@ class FtpRandomAccessContent extends Abs return dis; } - @Override - public void close() throws IOException - { - if (dis != null) - { + public void close() throws IOException { + if (dis != null) { mis.abort(); // this is to avoid recursive close @@ -143,8 +122,7 @@ class FtpRandomAccessContent extends Abs } @Override - public long length() throws IOException - { + public long length() throws IOException { return fileObject.getContent().getSize(); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java Thu Sep 14 19:26:39 2017 @@ -16,7 +16,6 @@ */ package org.apache.commons.vfs2.provider.ftps; - import java.io.IOException; import javax.net.ssl.KeyManager; @@ -33,14 +32,13 @@ import org.apache.commons.vfs2.provider. * * @since 2.0 */ -public final class FtpsClientFactory -{ - private FtpsClientFactory() - { +public final class FtpsClientFactory { + private FtpsClientFactory() { } /** * Creates a new connection to the server. + * * @param hostname The host name. * @param port The port. * @param username The user name for authentication. @@ -51,46 +49,36 @@ public final class FtpsClientFactory * @throws FileSystemException if an error occurs. */ public static FTPSClient createConnection(final String hostname, final int port, final char[] username, - final char[] password, final String workingDirectory, - final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + final char[] password, final String workingDirectory, final FileSystemOptions fileSystemOptions) + throws FileSystemException { final FtpsConnectionFactory factory = new FtpsConnectionFactory(FtpsFileSystemConfigBuilder.getInstance()); return factory.createConnection(hostname, port, username, password, workingDirectory, fileSystemOptions); } /** Connection Factory for FTPS case. */ private static final class FtpsConnectionFactory - extends FtpClientFactory.ConnectionFactory<FTPSClient, FtpsFileSystemConfigBuilder> - { + extends FtpClientFactory.ConnectionFactory<FTPSClient, FtpsFileSystemConfigBuilder> { - private FtpsConnectionFactory(final FtpsFileSystemConfigBuilder builder) - { + private FtpsConnectionFactory(final FtpsFileSystemConfigBuilder builder) { super(builder); } @Override - protected FTPSClient createClient(final FileSystemOptions fileSystemOptions) throws FileSystemException - { + protected FTPSClient createClient(final FileSystemOptions fileSystemOptions) throws FileSystemException { final FTPSClient client; - if (builder.getFtpsMode(fileSystemOptions) == FtpsMode.IMPLICIT) - { + if (builder.getFtpsMode(fileSystemOptions) == FtpsMode.IMPLICIT) { client = new FTPSClient(true); - } - else - { + } else { client = new FTPSClient(); } final TrustManager trustManager = builder.getTrustManager(fileSystemOptions); - if (trustManager != null) - { + if (trustManager != null) { client.setTrustManager(trustManager); } final KeyManager keyManager = builder.getKeyManager(fileSystemOptions); - if (keyManager != null) - { + if (keyManager != null) { client.setKeyManager(keyManager); } return client; @@ -98,19 +86,14 @@ public final class FtpsClientFactory @Override protected void setupOpenConnection(final FTPSClient client, final FileSystemOptions fileSystemOptions) - throws IOException - { + throws IOException { final FtpsDataChannelProtectionLevel level = builder.getDataChannelProtectionLevel(fileSystemOptions); - if (level != null) - { + if (level != null) { // '0' means streaming, that's what we do! - try - { + try { client.execPBSZ(0); client.execPROT(level.name()); - } - catch (final SSLException e) - { + } catch (final SSLException e) { throw new FileSystemException("vfs.provider.ftps/data-channel.level", e, level.toString()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientWrapper.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientWrapper.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientWrapper.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientWrapper.java Thu Sep 14 19:26:39 2017 @@ -16,7 +16,6 @@ */ package org.apache.commons.vfs2.provider.ftps; - import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemOptions; @@ -25,33 +24,28 @@ import org.apache.commons.vfs2.provider. import org.apache.commons.vfs2.provider.ftp.FTPClientWrapper; import org.apache.commons.vfs2.util.UserAuthenticatorUtils; - /** * A wrapper to the FTPSClient to allow automatic reconnect on connection loss. * <p> - * The only difference to the {@link FTPClientWrapper} is the creation of a {@link FTPSClient} - * instead of a {@link FTPClient}. + * The only difference to the {@link FTPClientWrapper} is the creation of a {@link FTPSClient} instead of a + * {@link FTPClient}. * * @since 2.0 */ -class FtpsClientWrapper extends FTPClientWrapper -{ - FtpsClientWrapper(final GenericFileName root, final FileSystemOptions fileSystemOptions) throws FileSystemException - { +class FtpsClientWrapper extends FTPClientWrapper { + FtpsClientWrapper(final GenericFileName root, final FileSystemOptions fileSystemOptions) + throws FileSystemException { super(root, fileSystemOptions); } @Override protected FTPClient createClient(final GenericFileName rootName, final UserAuthenticationData authData) - throws FileSystemException - { - return FtpsClientFactory.createConnection( - rootName.getHostName(), - rootName.getPort(), - UserAuthenticatorUtils.getData( - authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName())), - UserAuthenticatorUtils.getData( - authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword())), - rootName.getPath(), getFileSystemOptions()); + throws FileSystemException { + return FtpsClientFactory.createConnection(rootName.getHostName(), rootName.getPort(), + UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, + UserAuthenticatorUtils.toChar(rootName.getUserName())), + UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, + UserAuthenticatorUtils.toChar(rootName.getPassword())), + rootName.getPath(), getFileSystemOptions()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsDataChannelProtectionLevel.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsDataChannelProtectionLevel.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsDataChannelProtectionLevel.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsDataChannelProtectionLevel.java Thu Sep 14 19:26:39 2017 @@ -22,7 +22,6 @@ package org.apache.commons.vfs2.provider * @see <a href="http://tools.ietf.org/html/rfc2228#section-3">RFC 2228, section 3</a> * @since 2.1 */ -public enum FtpsDataChannelProtectionLevel -{ +public enum FtpsDataChannelProtectionLevel { C, S, E, P } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java Thu Sep 14 19:26:39 2017 @@ -27,15 +27,13 @@ import org.apache.commons.vfs2.provider. /** * A provider for FTP file systems. * - * NOTE: Most of the heavy lifting for FTPS is done by the org.apache.commons.vfs2.provider.ftp package since - * they both use commons-net package + * NOTE: Most of the heavy lifting for FTPS is done by the org.apache.commons.vfs2.provider.ftp package since they both + * use commons-net package * * @since 2.0 */ -public class FtpsFileProvider extends FtpFileProvider -{ - public FtpsFileProvider() - { +public class FtpsFileProvider extends FtpFileProvider { + public FtpsFileProvider() { super(); } @@ -44,8 +42,7 @@ public class FtpsFileProvider extends Ft */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; @@ -55,8 +52,7 @@ public class FtpsFileProvider extends Ft } @Override - public FileSystemConfigBuilder getConfigBuilder() - { + public FileSystemConfigBuilder getConfigBuilder() { return FtpsFileSystemConfigBuilder.getInstance(); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystem.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystem.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystem.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystem.java Thu Sep 14 19:26:39 2017 @@ -22,14 +22,12 @@ import org.apache.commons.vfs2.provider. import org.apache.commons.vfs2.provider.ftp.FtpClient; import org.apache.commons.vfs2.provider.ftp.FtpFileSystem; - /** * A FTPS file system. * * @since 2.1 */ -public class FtpsFileSystem extends FtpFileSystem -{ +public class FtpsFileSystem extends FtpFileSystem { /** * Create a new FtpsFileSystem. * @@ -38,15 +36,13 @@ public class FtpsFileSystem extends FtpF * @param fileSystemOptions The FileSystemOptions. * @since 2.1 */ - public FtpsFileSystem( - final GenericFileName rootName, final FtpClient ftpClient, final FileSystemOptions fileSystemOptions) - { + public FtpsFileSystem(final GenericFileName rootName, final FtpClient ftpClient, + final FileSystemOptions fileSystemOptions) { super(rootName, ftpClient, fileSystemOptions); } @Override - protected FtpsClientWrapper createWrapper() throws FileSystemException - { + protected FtpsClientWrapper createWrapper() throws FileSystemException { return new FtpsClientWrapper((GenericFileName) getRoot().getName(), getFileSystemOptions()); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java Thu Sep 14 19:26:39 2017 @@ -28,8 +28,7 @@ import org.apache.commons.vfs2.provider. * * @since 2.0 */ -public final class FtpsFileSystemConfigBuilder extends FtpFileSystemConfigBuilder -{ +public final class FtpsFileSystemConfigBuilder extends FtpFileSystemConfigBuilder { private static final String _PREFIX = FtpsFileSystemConfigBuilder.class.getName(); private static final FtpsFileSystemConfigBuilder BUILDER = new FtpsFileSystemConfigBuilder(); @@ -39,8 +38,7 @@ public final class FtpsFileSystemConfigB private static final String KEY_MANAGER = _PREFIX + ".KEY_MANAGER"; private static final String TRUST_MANAGER = _PREFIX + ".TRUST_MANAGER"; - private FtpsFileSystemConfigBuilder() - { + private FtpsFileSystemConfigBuilder() { super("ftps."); } @@ -49,25 +47,25 @@ public final class FtpsFileSystemConfigB * * @return the singleton builder. */ - public static FtpsFileSystemConfigBuilder getInstance() - { + public static FtpsFileSystemConfigBuilder getInstance() { return BUILDER; } /** * Set FTPS mode, either "implicit" or "explicit". * - * <p>Note, that implicit mode is not standardized and considered as deprecated. Some unit tests for VFS fail with + * <p> + * Note, that implicit mode is not standardized and considered as deprecated. Some unit tests for VFS fail with * implicit mode and it is not yet clear if its a problem with Commons VFS/Commons Net or our test server Apache - * FTP/SSHD.</p> + * FTP/SSHD. + * </p> * * @param opts The FileSystemOptions. * @param ftpsMode The mode to establish a FTPS connection. * @see <a href="http://en.wikipedia.org/wiki/FTPS#Implicit">Wikipedia: FTPS/Implicit</a> * @since 2.1 */ - public void setFtpsMode(final FileSystemOptions opts, final FtpsMode ftpsMode) - { + public void setFtpsMode(final FileSystemOptions opts, final FtpsMode ftpsMode) { setParam(opts, FTPS_MODE, ftpsMode); } @@ -78,8 +76,7 @@ public final class FtpsFileSystemConfigB * @return The file type. * @see #setFtpsType */ - public FtpsMode getFtpsMode(final FileSystemOptions opts) - { + public FtpsMode getFtpsMode(final FileSystemOptions opts) { return getEnum(FtpsMode.class, opts, FTPS_MODE, FtpsMode.EXPLICIT); } @@ -97,19 +94,14 @@ public final class FtpsFileSystemConfigB * @deprecated As of 2.1, use {@link #setFtpsMode(FileSystemOptions, FtpsMode)} */ @Deprecated - public void setFtpsType(final FileSystemOptions opts, final String ftpsType) - { + public void setFtpsType(final FileSystemOptions opts, final String ftpsType) { final FtpsMode mode; - if (ftpsType != null) - { + if (ftpsType != null) { mode = FtpsMode.valueOf(ftpsType.toUpperCase()); - if (mode == null) - { + if (mode == null) { throw new IllegalArgumentException("Not a proper FTPS mode: " + ftpsType); } - } - else - { + } else { mode = null; } setFtpsMode(opts, mode); @@ -124,8 +116,7 @@ public final class FtpsFileSystemConfigB * @deprecated As of 2.1, use {@link #getFtpsMode(FileSystemOptions)} */ @Deprecated - public String getFtpsType(final FileSystemOptions opts) - { + public String getFtpsType(final FileSystemOptions opts) { return getFtpsMode(opts).name().toLowerCase(); } @@ -137,8 +128,7 @@ public final class FtpsFileSystemConfigB * @see org.apache.commons.net.ftp.FTPSClient#execPROT(String) * @since 2.1 */ - public FtpsDataChannelProtectionLevel getDataChannelProtectionLevel(final FileSystemOptions opts) - { + public FtpsDataChannelProtectionLevel getDataChannelProtectionLevel(final FileSystemOptions opts) { return getEnum(FtpsDataChannelProtectionLevel.class, opts, PROT); } @@ -150,8 +140,7 @@ public final class FtpsFileSystemConfigB * @see org.apache.commons.net.ftp.FTPSClient#execPROT(String) * @since 2.1 */ - public void setDataChannelProtectionLevel(final FileSystemOptions opts, final FtpsDataChannelProtectionLevel prot) - { + public void setDataChannelProtectionLevel(final FileSystemOptions opts, final FtpsDataChannelProtectionLevel prot) { setParam(opts, PROT, prot); } @@ -163,8 +152,7 @@ public final class FtpsFileSystemConfigB * @see org.apache.commons.net.ftp.FTPSClient#setKeyManager(KeyManager) * @since 2.1 */ - public KeyManager getKeyManager(final FileSystemOptions opts) - { + public KeyManager getKeyManager(final FileSystemOptions opts) { return (KeyManager) getParam(opts, KEY_MANAGER); } @@ -176,8 +164,7 @@ public final class FtpsFileSystemConfigB * @see org.apache.commons.net.ftp.FTPSClient#setKeyManager(KeyManager) * @since 2.1 */ - public void setKeyManager(final FileSystemOptions opts, final KeyManager keyManager) - { + public void setKeyManager(final FileSystemOptions opts, final KeyManager keyManager) { setParam(opts, KEY_MANAGER, keyManager); } @@ -193,15 +180,11 @@ public final class FtpsFileSystemConfigB * @see org.apache.commons.net.ftp.FTPSClient#setTrustManager(TrustManager) * @since 2.1 */ - public TrustManager getTrustManager(final FileSystemOptions opts) - { + public TrustManager getTrustManager(final FileSystemOptions opts) { final TrustManager trustManager; - if (hasParam(opts, TRUST_MANAGER)) - { + if (hasParam(opts, TRUST_MANAGER)) { trustManager = (TrustManager) getParam(opts, TRUST_MANAGER); - } - else - { + } else { trustManager = TrustManagerUtils.getValidateServerCertificateTrustManager(); } return trustManager; @@ -215,8 +198,7 @@ public final class FtpsFileSystemConfigB * @see org.apache.commons.net.ftp.FTPSClient#setTrustManager(TrustManager) * @since 2.1 */ - public void setTrustManager(final FileSystemOptions opts, final TrustManager trustManager) - { + public void setTrustManager(final FileSystemOptions opts, final TrustManager trustManager) { setParam(opts, TRUST_MANAGER, trustManager); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsMode.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsMode.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsMode.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsMode.java Thu Sep 14 19:26:39 2017 @@ -19,14 +19,15 @@ package org.apache.commons.vfs2.provider /** * Mode of the FTPS connection. * - * <p>Note, that 'implicit' mode is not standardized and considered as deprecated. Some unit tests for VFS fail with + * <p> + * Note, that 'implicit' mode is not standardized and considered as deprecated. Some unit tests for VFS fail with * 'implicit' mode and it is not yet clear if its a problem with Commons VFS/Commons Net or our test server Apache - * FTP/SSHD.</p> + * FTP/SSHD. + * </p> * * @see <a href="http://en.wikipedia.org/wiki/FTPS#Implicit">Wikipedia: FTPS/Implicit</a> * @since 2.1 */ -public enum FtpsMode -{ +public enum FtpsMode { IMPLICIT, EXPLICIT } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java Thu Sep 14 19:26:39 2017 @@ -29,33 +29,30 @@ import org.apache.commons.vfs2.provider. /** * the gzip file. */ -public class GzipFileObject extends CompressedFileFileObject<GzipFileSystem> -{ +public class GzipFileObject extends CompressedFileFileObject<GzipFileSystem> { /** - * Deprecated since 2.1. + * Deprecated since 2.1. * * @deprecated Use {@link #GzipFileObject(AbstractFileName, FileObject, GzipFileSystem)} instead. */ @Deprecated - protected GzipFileObject(final AbstractFileName name, final FileObject container, final CompressedFileFileSystem fs) { + protected GzipFileObject(final AbstractFileName name, final FileObject container, + final CompressedFileFileSystem fs) { super(name, container, cast(fs)); } - protected GzipFileObject(final AbstractFileName name, final FileObject container, final GzipFileSystem fs) - { + protected GzipFileObject(final AbstractFileName name, final FileObject container, final GzipFileSystem fs) { super(name, container, fs); } @Override - protected InputStream doGetInputStream() throws Exception - { + protected InputStream doGetInputStream() throws Exception { final InputStream is = getContainer().getContent().getInputStream(); return new GZIPInputStream(is); } @Override - protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception - { + protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception { final OutputStream os = getContainer().getContent().getOutputStream(false); return new GZIPOutputStream(os); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileProvider.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileProvider.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileProvider.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileProvider.java Thu Sep 14 19:26:39 2017 @@ -31,39 +31,26 @@ import org.apache.commons.vfs2.provider. /** * Provides access to the content of gzip compressed files. */ -public class GzipFileProvider extends CompressedFileFileProvider -{ +public class GzipFileProvider extends CompressedFileFileProvider { /** * Capabilities. */ - protected static final Collection<Capability> capabilities = - Collections.unmodifiableCollection(Arrays.asList(new Capability[] - { - Capability.GET_LAST_MODIFIED, - Capability.GET_TYPE, - Capability.LIST_CHILDREN, - Capability.WRITE_CONTENT, - Capability.READ_CONTENT, - Capability.URI, - Capability.COMPRESS - })); + protected static final Collection<Capability> capabilities = Collections.unmodifiableCollection(Arrays + .asList(new Capability[] { Capability.GET_LAST_MODIFIED, Capability.GET_TYPE, Capability.LIST_CHILDREN, + Capability.WRITE_CONTENT, Capability.READ_CONTENT, Capability.URI, Capability.COMPRESS })); - public GzipFileProvider() - { + public GzipFileProvider() { super(); } @Override protected FileSystem createFileSystem(final FileName name, final FileObject file, - final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + final FileSystemOptions fileSystemOptions) throws FileSystemException { return new GzipFileSystem(name, file, fileSystemOptions); } @Override - public Collection<Capability> getCapabilities() - { + public Collection<Capability> getCapabilities() { return capabilities; } }
