On Fri, Feb 17, 2012 at 11:33 AM, Ralph Goers <[email protected]>wrote:
> I'm confused as to why you are having to fix so many checkstyle issues. I
> had thought I had them down to just a couple of classes. In fact, putting
> the curly brace on the next line should cause a checkstyle error. Are you
> using the checktyle configuration that is in the project which is used to
> build the checkstyle report for the web site?
>
Yes, all I am doing it: "m3 site".
I do not like the stype of { on a line by iteself but all of VFS is coded
that way.
Gary
>
> Ralph
>
> On Feb 16, 2012, at 12:38 PM, [email protected] wrote:
>
> > Author: ggregory
> > Date: Thu Feb 16 20:38:04 2012
> > New Revision: 1245166
> >
> > URL: http://svn.apache.org/viewvc?rev=1245166&view=rev
> > Log:
> > Fix Checkstyle issues.
> >
> > Modified:
> >
>
> 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/AbstractFileObject.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java
> >
>
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/Messages.java
> >
> > 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=1245166&r1=1245165&r2=1245166&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 Feb 16 20:38:04 2012
> > @@ -454,7 +454,8 @@ public abstract class AbstractFileName i
> > * @see #getType()
> > * @see FileType#FILE
> > */
> > - public boolean isFile() throws FileSystemException {
> > + public boolean isFile() throws FileSystemException
> > + {
> > // Use equals instead of == to avoid any class loader worries.
> > return FileType.FILE.equals(this.getType());
> > }
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
> Thu Feb 16 20:38:04 2012
> > @@ -518,7 +518,8 @@ public abstract class AbstractFileObject
> > * @see #getType()
> > * @see FileType#FILE
> > */
> > - public boolean isFile() throws FileSystemException {
> > + public boolean isFile() throws FileSystemException
> > + {
> > // Use equals instead of == to avoid any class loader worries.
> > return FileType.FILE.equals(this.getType());
> > }
> > @@ -531,7 +532,8 @@ public abstract class AbstractFileObject
> > * @see #getType()
> > * @see FileType#FOLDER
> > */
> > - public boolean isFolder() throws FileSystemException {
> > + public boolean isFolder() throws FileSystemException
> > + {
> > // Use equals instead of == to avoid any class loader worries.
> > return FileType.FOLDER.equals(this.getType());
> > }
> > @@ -623,7 +625,8 @@ public abstract class AbstractFileObject
> > try
> > {
> > return listFiles(Selectors.SELECT_ALL).iterator();
> > - } catch (FileSystemException e)
> > + }
> > + catch (FileSystemException e)
> > {
> > throw new IllegalStateException(e);
> > }
> > @@ -929,7 +932,7 @@ public abstract class AbstractFileObject
> > }
> >
> > /**
> > - * Deletes this file, and all children matching the {@code selector}
> > + * Deletes this file, and all children matching the {@code
> selector}.
> > *
> > * @param selector The FileSelector.
> > * @return the number of deleted files.
> > @@ -1079,11 +1082,12 @@ public abstract class AbstractFileObject
> > }
> >
> > /**
> > - * Compares two FileObjects (ignores case)
> > + * Compares two FileObjects (ignores case).
> > */
> > public int compareTo(FileObject fo)
> > {
> > - if (fo == null) {
> > + if (fo == null)
> > + {
> > return 1;
> > }
> > return this.toString().compareToIgnoreCase(fo.toString());
> > @@ -1091,6 +1095,7 @@ public abstract class AbstractFileObject
> >
> > /**
> > * Copies another file to this file.
> > + *
> > * @param file The FileObject to copy.
> > * @param selector The FileSelector.
> > * @throws FileSystemException if an error occurs.
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
> Thu Feb 16 20:38:04 2012
> > @@ -310,7 +310,7 @@ public final class DefaultFileContent im
> > }
> > catch (final Exception e)
> > {
> > - throw new
> FileSystemException("vfs.provider/set-attribute.error", e,attrName,
> fileObject);
> > + throw new
> FileSystemException("vfs.provider/set-attribute.error", e, attrName,
> fileObject);
> > }
> >
> > if (attrs != null)
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java
> Thu Feb 16 20:38:04 2012
> > @@ -26,7 +26,7 @@ import org.apache.commons.vfs2.provider.
> > public class HttpFileNameParser extends URLFileNameParser
> > {
> > private static final int DEFAULT_PORT = 80;
> > -
> > +
> > private static final HttpFileNameParser INSTANCE = new
> HttpFileNameParser();
> >
> > public HttpFileNameParser()
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java
> Thu Feb 16 20:38:04 2012
> > @@ -26,7 +26,7 @@ import org.apache.commons.vfs2.provider.
> > public class HttpsFileNameParser extends URLFileNameParser
> > {
> > private static final int DEFAULT_PORT = 443;
> > -
> > +
> > private static final HttpsFileNameParser INSTANCE = new
> HttpsFileNameParser();
> >
> > public HttpsFileNameParser()
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
> Thu Feb 16 20:38:04 2012
> > @@ -136,7 +136,7 @@ public class RamFileObject extends Abstr
> > protected void doDelete() throws Exception
> > {
> >
> > - if (this.isContentOpen())
> > + if (this.isContentOpen())
> > {
> > throw new FileSystemException(this.getName() + " cannot be
> deleted while the file is openg");
> > }
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
> Thu Feb 16 20:38:04 2012
> > @@ -296,7 +296,8 @@ public final class SftpClientFactory
> >
> > private static class JSchLogger implements Logger
> > {
> > - public boolean isEnabled(int level) {
> > + public boolean isEnabled(int level)
> > + {
> > switch (level)
> > {
> > case FATAL:
> > @@ -315,7 +316,8 @@ public final class SftpClientFactory
> > }
> > }
> >
> > - public void log(int level, String msg) {
> > + public void log(int level, String msg)
> > + {
> > switch (level)
> > {
> > case FATAL:
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
> Thu Feb 16 20:38:04 2012
> > @@ -53,6 +53,8 @@ import com.jcraft.jsch.SftpException;
> > */
> > public class SftpFileObject extends AbstractFileObject
> > {
> > + private static final long MOD_TIME_FACTOR = 1000L;
> > +
> > private final SftpFileSystem fileSystem;
> > private SftpATTRS attrs;
> > private final String relPath;
> > @@ -75,7 +77,10 @@ public class SftpFileObject extends Abst
> > attrs = null;
> > }
> >
> > - /** @since 2.0 */
> > + /**
> > + * @throws FileSystemException if error occurs.
> > + * @since 2.0
> > + */
> > @Override
> > public void refresh() throws FileSystemException
> > {
> > @@ -223,7 +228,7 @@ public class SftpFileObject extends Abst
> > throw new FileSystemException(
> > "vfs.provider.sftp/unknown-modtime.error");
> > }
> > - return attrs.getMTime() * 1000L;
> > + return attrs.getMTime() * MOD_TIME_FACTOR;
> > }
> >
> > /**
> > @@ -241,7 +246,7 @@ public class SftpFileObject extends Abst
> > final ChannelSftp channel = fileSystem.getChannel();
> > try
> > {
> > - int newMTime = (int) (modtime / 1000L);
> > + int newMTime = (int) (modtime / MOD_TIME_FACTOR);
> >
> > attrs.setACMODTIME(attrs.getATime(), newMTime);
> > channel.setStat(relPath, attrs);
> > @@ -301,7 +306,8 @@ public class SftpFileObject extends Abst
> > protected FileObject[] doListChildrenResolved() throws Exception
> > {
> > // should not require a round-trip because type is already set.
> > - if (this.isFile()) {
> > + if (this.isFile())
> > + {
> > return null;
> > }
> > // List the contents of the folder
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
> Thu Feb 16 20:38:04 2012
> > @@ -45,6 +45,8 @@ public class SftpFileSystem
> > implements FileSystem
> > {
> >
> > + private static final long LAST_MOD_TIME_ACCURACY = 1000L;
> > +
> > private Session session;
> > // private final JSch jSch;
> > private ChannelSftp idleChannel;
> > @@ -196,13 +198,13 @@ public class SftpFileSystem
> > }
> >
> > /**
> > - * last mod time is only a int and in seconds, thus can be off by
> 999.
> > + * Last mod time is only a int and in seconds, thus can be off by
> 999.
> > *
> > * @return 1000
> > */
> > @Override
> > public double getLastModTimeAccuracy()
> > {
> > - return 1000L;
> > + return LAST_MOD_TIME_ACCURACY;
> > }
> > }
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
> Thu Feb 16 20:38:04 2012
> > @@ -96,7 +96,10 @@ public final class SftpFileSystemConfigB
> > return true;
> > }
> >
> > - /** @since 2.0 */
> > + /**
> > + * @return a hash code value for this object.
> > + * @since 2.0
> > + */
> > @Override
> > public int hashCode()
> > {
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java
> Thu Feb 16 20:38:04 2012
> > @@ -48,6 +48,8 @@ import org.apache.commons.vfs2.provider.
> > */
> > public class TarFileSystem extends AbstractFileSystem implements
> FileSystem
> > {
> > + private static final int DEFAULT_INDEX_SIZE = 100;
> > +
> > private static final Log LOG =
> LogFactory.getLog(TarFileSystem.class);
> >
> > private final File file;
> > @@ -82,7 +84,7 @@ public class TarFileSystem extends Abstr
> > // Build the index
> > try
> > {
> > - List<TarFileObject> strongRef = new
> ArrayList<TarFileObject>(100);
> > + List<TarFileObject> strongRef = new
> ArrayList<TarFileObject>(DEFAULT_INDEX_SIZE);
> > TarArchiveEntry entry;
> > while ((entry = getTarFile().getNextTarEntry()) != null)
> > {
> >
> > Modified:
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/Messages.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/Messages.java?rev=1245166&r1=1245165&r2=1245166&view=diff
> >
> ==============================================================================
> > ---
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/Messages.java
> (original)
> > +++
> commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/Messages.java
> Thu Feb 16 20:38:04 2012
> > @@ -32,9 +32,8 @@ public final class Messages
> > /**
> > * Map from message code to MessageFormat object for the message.
> > */
> > - private static ConcurrentMap<String, MessageFormat> messages =
> > - new ConcurrentHashMap<String, MessageFormat>();
> > - private static final ResourceBundle resources = new
> CombinedResources("org.apache.commons.vfs2.Resources");
> > + private static ConcurrentMap<String, MessageFormat> MessageMap =
> new ConcurrentHashMap<String, MessageFormat>();
> > + private static final ResourceBundle RESOURCES = new
> CombinedResources("org.apache.commons.vfs2.Resources");
> >
> > private Messages()
> > {
> > @@ -53,7 +52,7 @@ public final class Messages
> >
> > /**
> > * Formats a message.
> > - *
> > + *
> > * @param code
> > * The message code.
> > * @param param
> > @@ -100,15 +99,15 @@ public final class Messages
> > throws MissingResourceException
> > {
> > // Check if the message is cached
> > - MessageFormat msg = messages.get(code);
> > + MessageFormat msg = MessageMap.get(code);
> > if (msg != null)
> > {
> > return msg;
> > }
> >
> > - final String msgText = resources.getString(code);
> > + final String msgText = RESOURCES.getString(code);
> > msg = new MessageFormat(msgText);
> > - messages.putIfAbsent(code, msg);
> > - return messages.get(code);
> > + MessageMap.putIfAbsent(code, msg);
> > + return MessageMap.get(code);
> > }
> > }
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
E-Mail: [email protected] | [email protected]
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory