Author: rgoers Date: Thu Nov 18 06:10:09 2010 New Revision: 1036327 URL: http://svn.apache.org/viewvc?rev=1036327&view=rev Log: More checkstyle fixes
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java Thu Nov 18 06:10:09 2010 @@ -47,6 +47,12 @@ public enum VcsStatus private int status; + + private VcsStatus(int status) + { + this.status = status; + } + /** * * @return the status of FileObject @@ -55,9 +61,4 @@ public enum VcsStatus { return status; } - - private VcsStatus(int status) - { - this.status = status; - } } Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java Thu Nov 18 06:10:09 2010 @@ -28,8 +28,7 @@ import org.apache.commons.vfs2.VFS; * @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a> * @version $Revision$ $Date$ */ -public abstract class AbstractFileName - implements FileName +public abstract class AbstractFileName implements FileName { private final String scheme; Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java Thu Nov 18 06:10:09 2010 @@ -36,24 +36,26 @@ import java.io.IOException; public final class FtpClientFactory { private static final int BUFSZ = 40; + private FtpClientFactory() { } /** * Creates a new connection to the server. - * @param hostname The host name of the server. - * @param port The port to connect to. - * @param username The name of the user for authentication. - * @param password The user's password. - * @param workingDirectory The base directory. + * + * @param hostname The host name of the server. + * @param port The port to connect to. + * @param username The name of the user for authentication. + * @param password The user's password. + * @param workingDirectory The base directory. * @param fileSystemOptions The FileSystemOptions. * @return An FTPClient. * @throws FileSystemException if an error occurs while connecting. */ public static FTPClient createConnection(String hostname, int port, char[] username, char[] password, String workingDirectory, FileSystemOptions fileSystemOptions) - throws FileSystemException + throws FileSystemException { // Determine the username and password to use if (username == null) @@ -70,56 +72,10 @@ public final class FtpClientFactory { final FTPClient client = new FTPClient(); - String key = FtpFileSystemConfigBuilder.getInstance().getEntryParser(fileSystemOptions); - if (key != null) - { - FTPClientConfig config = new FTPClientConfig(key); - - String serverLanguageCode = - FtpFileSystemConfigBuilder.getInstance().getServerLanguageCode(fileSystemOptions); - if (serverLanguageCode != null) - { - config.setServerLanguageCode(serverLanguageCode); - } - String defaultDateFormat = - FtpFileSystemConfigBuilder.getInstance().getDefaultDateFormat(fileSystemOptions); - if (defaultDateFormat != null) - { - config.setDefaultDateFormatStr(defaultDateFormat); - } - String recentDateFormat = - FtpFileSystemConfigBuilder.getInstance().getRecentDateFormat(fileSystemOptions); - if (recentDateFormat != null) - { - config.setRecentDateFormatStr(recentDateFormat); - } - String serverTimeZoneId = - FtpFileSystemConfigBuilder.getInstance().getServerTimeZoneId(fileSystemOptions); - if (serverTimeZoneId != null) - { - config.setServerTimeZoneId(serverTimeZoneId); - } - String[] shortMonthNames = - FtpFileSystemConfigBuilder.getInstance().getShortMonthNames(fileSystemOptions); - if (shortMonthNames != null) - { - StringBuilder shortMonthNamesStr = new StringBuilder(BUFSZ); - for (int i = 0; i < shortMonthNames.length; i++) - { - if (shortMonthNamesStr.length() > 0) - { - shortMonthNamesStr.append("|"); - } - shortMonthNamesStr.append(shortMonthNames[i]); - } - config.setShortMonthNames(shortMonthNamesStr.toString()); - } - - client.configure(config); - } + configureClient(fileSystemOptions, client); FTPFileEntryParserFactory myFactory = - FtpFileSystemConfigBuilder.getInstance().getEntryParserFactory(fileSystemOptions); + FtpFileSystemConfigBuilder.getInstance().getEntryParserFactory(fileSystemOptions); if (myFactory != null) { client.setParserFactory(myFactory); @@ -141,7 +97,7 @@ public final class FtpClientFactory UserAuthenticatorUtils.toString(password))) { throw new FileSystemException("vfs.provider.ftp/login.error", - new Object[]{hostname, UserAuthenticatorUtils.toString(username)}, null); + new Object[]{hostname, UserAuthenticatorUtils.toString(username)}, null); } // Set binary mode @@ -187,8 +143,6 @@ public final class FtpClientFactory { client.setControlEncoding(controlEncoding); } - - } catch (final IOException e) { @@ -206,4 +160,55 @@ public final class FtpClientFactory throw new FileSystemException("vfs.provider.ftp/connect.error", new Object[]{hostname}, exc); } } + + private static void configureClient(FileSystemOptions fileSystemOptions, FTPClient client) + { + String key = FtpFileSystemConfigBuilder.getInstance().getEntryParser(fileSystemOptions); + if (key != null) + { + FTPClientConfig config = new FTPClientConfig(key); + + String serverLanguageCode = + FtpFileSystemConfigBuilder.getInstance().getServerLanguageCode(fileSystemOptions); + if (serverLanguageCode != null) + { + config.setServerLanguageCode(serverLanguageCode); + } + String defaultDateFormat = + FtpFileSystemConfigBuilder.getInstance().getDefaultDateFormat(fileSystemOptions); + if (defaultDateFormat != null) + { + config.setDefaultDateFormatStr(defaultDateFormat); + } + String recentDateFormat = + FtpFileSystemConfigBuilder.getInstance().getRecentDateFormat(fileSystemOptions); + if (recentDateFormat != null) + { + config.setRecentDateFormatStr(recentDateFormat); + } + String serverTimeZoneId = + FtpFileSystemConfigBuilder.getInstance().getServerTimeZoneId(fileSystemOptions); + if (serverTimeZoneId != null) + { + config.setServerTimeZoneId(serverTimeZoneId); + } + String[] shortMonthNames = + FtpFileSystemConfigBuilder.getInstance().getShortMonthNames(fileSystemOptions); + if (shortMonthNames != null) + { + StringBuilder shortMonthNamesStr = new StringBuilder(BUFSZ); + for (int i = 0; i < shortMonthNames.length; i++) + { + if (shortMonthNamesStr.length() > 0) + { + shortMonthNamesStr.append("|"); + } + shortMonthNamesStr.append(shortMonthNames[i]); + } + config.setShortMonthNames(shortMonthNamesStr.toString()); + } + + client.configure(config); + } + } } Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystem.java Thu Nov 18 06:10:09 2010 @@ -48,7 +48,12 @@ public class FtpFileSystem extends Abstr // An idle client private FtpClient idleClient; - /** @since 2.0 (was protected) */ + /** + * @param rootName The root of the file system. + * @param ftpClient The FtpClient. + * @param fileSystemOptions The FileSystemOptions. + * @since 2.0 (was protected) + * */ public FtpFileSystem(final GenericFileName rootName, final FtpClient ftpClient, final FileSystemOptions fileSystemOptions) { @@ -81,6 +86,7 @@ public class FtpFileSystem extends Abstr /** * Cleans up the connection to the server. + * @param client The FtpClient. */ private void closeConnection(final FtpClient client) { Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java Thu Nov 18 06:10:09 2010 @@ -324,7 +324,11 @@ public final class FtpFileSystemConfigBu setParam(opts, ENCODING, encoding); } - /** @since 2.0 */ + /** + * @param opts The FileSystemOptions. + * @return The encoding. + * @since 2.0 + * */ public String getControlEncoding(FileSystemOptions opts) { return (String) getParam(opts, ENCODING); Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java Thu Nov 18 06:10:09 2010 @@ -42,6 +42,14 @@ public final class FtpsClientFactory /** * Creates a new connection to the server. + * @param hostname The host name. + * @param port The port. + * @param username The user name for authentication. + * @param password The user's password. + * @param workingDirectory The directory to use. + * @param fileSystemOptions The FileSystemOptions. + * @return The FTPSClient. + * @throws FileSystemException if an error occurs. */ public static FTPSClient createConnection(String hostname, int port, char[] username, char[] password, String workingDirectory, FileSystemOptions fileSystemOptions) Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java Thu Nov 18 06:10:09 2010 @@ -68,7 +68,7 @@ public final class FtpsFileSystemConfigB /** * FTPFileEntryParserFactory which will be used for ftp-entry parsing. * - * @param opts + * @param opts The FileSystemOptions. * @param factory instance of your factory */ public void setEntryParserFactory(FileSystemOptions opts, FTPFileEntryParserFactory factory) @@ -77,7 +77,8 @@ public final class FtpsFileSystemConfigB } /** - * @param opts + * @param opts The FileSystemOptions + * @return The FTPFileEntryParserFactory. * @see #setEntryParserFactory */ public FTPFileEntryParserFactory getEntryParserFactory(FileSystemOptions opts) @@ -92,8 +93,8 @@ public final class FtpsFileSystemConfigB * {...@link #setEntryParserFactory} * this is the "key" parameter passed as argument into your custom factory</i> * - * @param opts - * @param key + * @param opts The FileSystemOptions. + * @param key The key. */ public void setEntryParser(FileSystemOptions opts, String key) { @@ -101,7 +102,8 @@ public final class FtpsFileSystemConfigB } /** - * @param opts + * @param opts The FileSystemOptions. + * @return The key. * @see #setEntryParser */ public String getEntryParser(FileSystemOptions opts) @@ -118,8 +120,8 @@ public final class FtpsFileSystemConfigB /** * Enter into passive mode. * - * @param opts - * @param passiveMode + * @param opts The FileSystemOptions. + * @param passiveMode true if passive mode should be used, false otherwise. */ public void setPassiveMode(FileSystemOptions opts, boolean passiveMode) { @@ -127,7 +129,8 @@ public final class FtpsFileSystemConfigB } /** - * @param opts + * @param opts The FileSystemOptions. + * @return true if passive mode is being used. * @see #setPassiveMode */ public Boolean getPassiveMode(FileSystemOptions opts) @@ -138,8 +141,8 @@ public final class FtpsFileSystemConfigB /** * use user directory as root (do not change to fs root). * - * @param opts - * @param userDirIsRoot + * @param opts The FileSystemOptions. + * @param userDirIsRoot true if the user directory should be the root. */ public void setUserDirIsRoot(FileSystemOptions opts, boolean userDirIsRoot) { @@ -148,7 +151,8 @@ public final class FtpsFileSystemConfigB } /** - * @param opts + * @param opts The FileSystemOptions. + * @return true if the user directory is the root. * @see #setUserDirIsRoot */ public Boolean getUserDirIsRoot(FileSystemOptions opts) @@ -159,8 +163,8 @@ public final class FtpsFileSystemConfigB /** * Set FTPS security mode, either "implicit" or "explicit". * - * @param opts - * @param ftpsType + * @param opts The FileSystemOptions. + * @param ftpsType The file type. */ public void setFtpsType(FileSystemOptions opts, String ftpsType) { @@ -170,7 +174,8 @@ public final class FtpsFileSystemConfigB /** * Return the FTPS security mode. Defaults to "explicit" if not defined. * - * @param opts + * @param opts The FileSystemOptions. + * @return The file type. * @see #setFtpsType */ public String getFtpsType(FileSystemOptions opts) @@ -179,7 +184,8 @@ public final class FtpsFileSystemConfigB } /** - * @param opts + * @param opts The FileSystemOptions. + * @return The timeout value. * @see #setDataTimeout */ public Integer getDataTimeout(FileSystemOptions opts) @@ -192,8 +198,8 @@ public final class FtpsFileSystemConfigB * If you set the dataTimeout to <code>null</code> no dataTimeout will be set on the * ftp client. * - * @param opts - * @param dataTimeout + * @param opts The FileSystemOptions. + * @param dataTimeout The timeout value. */ public void setDataTimeout(FileSystemOptions opts, Integer dataTimeout) { @@ -203,6 +209,8 @@ public final class FtpsFileSystemConfigB /** * 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. */ public String getServerLanguageCode(FileSystemOptions opts) { @@ -212,6 +220,8 @@ public final class FtpsFileSystemConfigB /** * 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 language code. */ public void setServerLanguageCode(FileSystemOptions opts, String serverLanguageCode) @@ -222,6 +232,8 @@ public final class FtpsFileSystemConfigB /** * 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 default date format. */ public String getDefaultDateFormat(FileSystemOptions opts) { @@ -231,6 +243,8 @@ public final class FtpsFileSystemConfigB /** * 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 defaultDateFormat The default date format. */ public void setDefaultDateFormat(FileSystemOptions opts, String defaultDateFormat) @@ -240,6 +254,8 @@ public final class FtpsFileSystemConfigB /** * see {...@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples. + * @param opts The FileSystemOptions. + * @return The recent date format. */ public String getRecentDateFormat(FileSystemOptions opts) { @@ -248,6 +264,8 @@ public final class FtpsFileSystemConfigB /** * see {...@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples. + * @param opts The FileSystemOptions + * @param recentDateFormat The recent date format. */ public void setRecentDateFormat(FileSystemOptions opts, String recentDateFormat) @@ -257,6 +275,8 @@ public final class FtpsFileSystemConfigB /** * see {...@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples. + * @param opts The FileSystemOptions. + * @return The server timezone id. */ public String getServerTimeZoneId(FileSystemOptions opts) { @@ -265,6 +285,8 @@ public final class FtpsFileSystemConfigB /** * see {...@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples. + * @param opts The FileSystemOptions. + * @param serverTimeZoneId The server's timezone id. */ public void setServerTimeZoneId(FileSystemOptions opts, String serverTimeZoneId) @@ -274,6 +296,8 @@ public final class FtpsFileSystemConfigB /** * see {...@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples. + * @param opts The FileSystemOptions. + * @return An array of short month names. */ public String[] getShortMonthNames(FileSystemOptions opts) { @@ -282,6 +306,8 @@ public final class FtpsFileSystemConfigB /** * see {...@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples. + * @param opts The FileSystemOptions. + * @param shortMonthNames An array of short month names. */ public void setShortMonthNames(FileSystemOptions opts, String[] shortMonthNames) Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/MonitorOutputStream.java Thu Nov 18 06:10:09 2010 @@ -80,7 +80,11 @@ public class MonitorOutputStream } - /** @since 2.0 */ + /** + * @param b The character to write. + * @throws IOException if an error occurs. + * @since 2.0 + */ @Override public synchronized void write(int b) throws IOException { @@ -88,7 +92,13 @@ public class MonitorOutputStream super.write(b); } - /** @since 2.0 */ + /** + * @param b The byte array. + * @param off The offset into the array. + * @param len The number of bytes to write. + * @throws IOException if an error occurs. + * @since 2.0 + */ @Override public synchronized void write(byte[] b, int off, int len) throws IOException { @@ -96,7 +106,10 @@ public class MonitorOutputStream super.write(b, off, len); } - /** @since 2.0 */ + /** + * @throws IOException if an error occurs. + * @since 2.0 + */ @Override public synchronized void flush() throws IOException { @@ -104,7 +117,11 @@ public class MonitorOutputStream super.flush(); } - /** @since 2.0 */ + /** + * @param b The byte array. + * @throws IOException if an error occurs. + * @since 2.0 + */ @Override public void write(byte[] b) throws IOException { @@ -116,6 +133,7 @@ public class MonitorOutputStream * check if file is still open. <br /> * This is a workaround for an oddity with Java's BufferedOutputStream where you can write to * even if the stream has been closed + * @throws FileSystemException if an error occurs. * @since 2.0 */ protected void assertOpen() throws FileSystemException @@ -128,6 +146,7 @@ public class MonitorOutputStream /** * Called after this stream is closed. This implementation does nothing. + * @throws IOException if an error occurs. */ @SuppressWarnings("unused") // IOException is needed because subclasses may need to throw it protected void onClose() throws IOException Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java?rev=1036327&r1=1036326&r2=1036327&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java Thu Nov 18 06:10:09 2010 @@ -54,7 +54,10 @@ public enum RandomAccessMode return write; } - /** @since 2.0 */ + /** + * @return The mode String. + * @since 2.0 + * */ public String getModeString() { if (requestRead())