You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/12/03 14:40:56 UTC
svn commit: r1416511 - in
/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2: ./
provider/mime/ provider/smb/ util/
Author: ggregory
Date: Mon Dec 3 13:40:55 2012
New Revision: 1416511
URL: http://svn.apache.org/viewvc?rev=1416511&view=rev
Log:
Use final where possible.
Modified:
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/RACRandomAccessFile.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java
commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/RACRandomAccessFile.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/RACRandomAccessFile.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/RACRandomAccessFile.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/RACRandomAccessFile.java Mon Dec 3 13:40:55 2012
@@ -34,13 +34,13 @@ public class RACRandomAccessFile extends
return File.createTempFile("fraf", "");
}
- private void deleteTempFile(File tempFile)
+ private void deleteTempFile(final File tempFile)
{
try
{
super.close();
}
- catch (IOException ex)
+ catch (final IOException ex)
{
throw new RuntimeException(ex);
}
@@ -50,13 +50,13 @@ public class RACRandomAccessFile extends
}
}
- public RACRandomAccessFile(RandomAccessContent rac) throws IOException
+ public RACRandomAccessFile(final RandomAccessContent rac) throws IOException
{
this(createTempFile());
this.rac = rac;
}
- private RACRandomAccessFile(File tempFile) throws IOException
+ private RACRandomAccessFile(final File tempFile) throws IOException
{
super(tempFile, "r");
deleteTempFile(tempFile);
@@ -69,13 +69,13 @@ public class RACRandomAccessFile extends
}
@Override
- public void seek(long pos) throws IOException
+ public void seek(final long pos) throws IOException
{
this.rac.seek(pos);
}
@Override
- public int skipBytes(int n) throws IOException
+ public int skipBytes(final int n) throws IOException
{
return this.rac.skipBytes(n);
}
@@ -90,7 +90,7 @@ public class RACRandomAccessFile extends
* @see org.ecc.base.io.FilterRandomAccessFile#setLength(long)
*/
@Override
- public void setLength(long newLength) throws IOException
+ public void setLength(final long newLength) throws IOException
{
throw new IOException("Underlying RandomAccessContent instance length cannot be modified.");
}
@@ -111,7 +111,7 @@ public class RACRandomAccessFile extends
* @see java.io.RandomAccessFile#read(byte[])
*/
@Override
- public final int read(byte[] b) throws IOException
+ public final int read(final byte[] b) throws IOException
{
return read(b, 0, b.length);
}
@@ -123,12 +123,12 @@ public class RACRandomAccessFile extends
public final int read() throws IOException
{
final byte[] buf = this.singleByteBuf;
- int count = read(buf, 0, 1);
+ final int count = read(buf, 0, 1);
return count < 0 ? -1 : (buf[0] & 0xFF);
}
@Override
- public int read(byte[] b, int off, int len) throws IOException
+ public int read(final byte[] b, final int off, final int len) throws IOException
{
this.rac.readFully(b, off, len);
return len;
@@ -138,7 +138,7 @@ public class RACRandomAccessFile extends
* @see java.io.RandomAccessFile#write(int)
*/
@Override
- public final void write(int b) throws IOException
+ public final void write(final int b) throws IOException
{
final byte[] buf = this.singleByteBuf;
buf[0] = (byte) b;
@@ -149,7 +149,7 @@ public class RACRandomAccessFile extends
* @see java.io.RandomAccessFile#write(byte[])
*/
@Override
- public final void write(byte[] b) throws IOException
+ public final void write(final byte[] b) throws IOException
{
write(b, 0, b.length);
}
@@ -158,7 +158,7 @@ public class RACRandomAccessFile extends
* @see java.io.RandomAccessFile#write(byte[],int,int)
*/
@Override
- public void write(byte[] b, int off, int len) throws IOException
+ public void write(final byte[] b, final int off, final int len) throws IOException
{
this.rac.write(b, off, len);
}
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java Mon Dec 3 13:40:55 2012
@@ -43,7 +43,7 @@ import org.apache.commons.logging.LogFac
*/
public class MimeAttributesMap implements Map<String, Object>
{
- private Log log = LogFactory.getLog(MimeAttributesMap.class);
+ private final Log log = LogFactory.getLog(MimeAttributesMap.class);
private final static String OBJECT_PREFIX = "obj.";
@@ -52,16 +52,16 @@ public class MimeAttributesMap implement
private final Map<String, Method> mimeMessageGetters = new TreeMap<String, Method>();
- public MimeAttributesMap(Part part)
+ public MimeAttributesMap(final Part part)
{
this.part = part;
addMimeMessageMethod(part.getClass().getMethods());
addMimeMessageMethod(part.getClass().getDeclaredMethods());
}
- private void addMimeMessageMethod(Method[] methods)
+ private void addMimeMessageMethod(final Method[] methods)
{
- for (Method method : methods) {
+ for (final Method method : methods) {
if (!Modifier.isPublic(method.getModifiers()))
{
continue;
@@ -95,16 +95,17 @@ public class MimeAttributesMap implement
private Map<String, Object> createMap()
{
// Object is either a String, or a List of Strings
- Map<String, Object> ret = new TreeMap<String, Object>();
+ final Map<String, Object> ret = new TreeMap<String, Object>();
Enumeration<Header> headers;
try
{
@SuppressWarnings("unchecked") // Javadoc say Part returns Header
+ final
Enumeration<Header> allHeaders = part.getAllHeaders();
headers = allHeaders;
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
throw new RuntimeException(e);
}
@@ -112,10 +113,10 @@ public class MimeAttributesMap implement
// add all headers
while (headers.hasMoreElements())
{
- Header header = headers.nextElement();
- String headerName = header.getName();
+ final Header header = headers.nextElement();
+ final String headerName = header.getName();
- Object values = ret.get(headerName);
+ final Object values = ret.get(headerName);
if (values == null)
{
@@ -123,7 +124,7 @@ public class MimeAttributesMap implement
}
else if (values instanceof String)
{
- ArrayList<String> newValues = new ArrayList<String>();
+ final ArrayList<String> newValues = new ArrayList<String>();
newValues.add((String) values);
newValues.add(header.getValue());
ret.put(headerName, newValues);
@@ -131,29 +132,30 @@ public class MimeAttributesMap implement
else if (values instanceof List)
{
@SuppressWarnings("unchecked") // we only add Strings to the Lists
+ final
List<String> list = (List<String>) values;
list.add(header.getValue());
}
}
// add all simple get/is results (with obj. prefix)
- Iterator<Entry<String, Method>> iterEntries = mimeMessageGetters.entrySet().iterator();
+ final Iterator<Entry<String, Method>> iterEntries = mimeMessageGetters.entrySet().iterator();
while (iterEntries.hasNext())
{
- Map.Entry<String, Method> entry = iterEntries.next();
- String name = entry.getKey();
- Method method = entry.getValue();
+ final Map.Entry<String, Method> entry = iterEntries.next();
+ final String name = entry.getKey();
+ final Method method = entry.getValue();
try
{
- Object value = method.invoke(part);
+ final Object value = method.invoke(part);
ret.put(OBJECT_PREFIX + name, value);
}
- catch (IllegalAccessException e)
+ catch (final IllegalAccessException e)
{
log.debug(e.getLocalizedMessage(), e);
}
- catch (InvocationTargetException e)
+ catch (final InvocationTargetException e)
{
log.debug(e.getLocalizedMessage(), e);
}
@@ -162,40 +164,40 @@ public class MimeAttributesMap implement
// add extended fields (with obj. prefix too)
if (part instanceof MimeMessage)
{
- MimeMessage message = (MimeMessage) part;
+ final MimeMessage message = (MimeMessage) part;
try
{
- Address[] address = message.getRecipients(MimeMessage.RecipientType.BCC);
+ final Address[] address = message.getRecipients(MimeMessage.RecipientType.BCC);
ret.put(OBJECT_PREFIX + "Recipients.BCC", address);
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
log.debug(e.getLocalizedMessage(), e);
}
try
{
- Address[] address = message.getRecipients(MimeMessage.RecipientType.CC);
+ final Address[] address = message.getRecipients(MimeMessage.RecipientType.CC);
ret.put(OBJECT_PREFIX + "Recipients.CC", address);
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
log.debug(e.getLocalizedMessage(), e);
}
try
{
- Address[] address = message.getRecipients(MimeMessage.RecipientType.TO);
+ final Address[] address = message.getRecipients(MimeMessage.RecipientType.TO);
ret.put(OBJECT_PREFIX + "Recipients.TO", address);
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
log.debug(e.getLocalizedMessage(), e);
}
try
{
- Address[] address = message.getRecipients(MimeMessage.RecipientType.NEWSGROUPS);
+ final Address[] address = message.getRecipients(MimeMessage.RecipientType.NEWSGROUPS);
ret.put(OBJECT_PREFIX + "Recipients.NEWSGROUPS", address);
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
log.debug(e.getLocalizedMessage(), e);
}
@@ -214,32 +216,32 @@ public class MimeAttributesMap implement
return getMap().size() < 1;
}
- public boolean containsKey(Object key)
+ public boolean containsKey(final Object key)
{
return getMap().containsKey(key);
}
- public boolean containsValue(Object value)
+ public boolean containsValue(final Object value)
{
return getMap().containsValue(value);
}
- public Object get(Object key)
+ public Object get(final Object key)
{
return getMap().get(key);
}
- public Object put(String key, Object value)
+ public Object put(final String key, final Object value)
{
throw new UnsupportedOperationException();
}
- public Object remove(Object key)
+ public Object remove(final Object key)
{
throw new UnsupportedOperationException();
}
- public void putAll(Map<? extends String, ? extends Object> t)
+ public void putAll(final Map<? extends String, ? extends Object> t)
{
throw new UnsupportedOperationException();
}
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java Mon Dec 3 13:40:55 2012
@@ -31,10 +31,10 @@ import org.apache.commons.vfs2.impl.Defa
*/
public class MimeFileContentInfoFactory implements FileContentInfoFactory
{
- public FileContentInfo create(FileContent fileContent) throws FileSystemException
+ public FileContentInfo create(final FileContent fileContent) throws FileSystemException
{
- MimeFileObject mimeFile = (MimeFileObject) fileContent.getFile();
- Part part = mimeFile.getPart();
+ final MimeFileObject mimeFile = (MimeFileObject) fileContent.getFile();
+ final Part part = mimeFile.getPart();
String contentTypeString = null;
String charset = null;
@@ -52,7 +52,7 @@ public class MimeFileContentInfoFactory
charset = MimeFileSystem.PREAMBLE_CHARSET;
}
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
throw new FileSystemException(e);
}
@@ -64,7 +64,7 @@ public class MimeFileContentInfoFactory
{
contentTypeString = part.getContentType();
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
throw new FileSystemException(e);
}
@@ -75,7 +75,7 @@ public class MimeFileContentInfoFactory
{
contentType = new ContentType(contentTypeString);
}
- catch (MessagingException e)
+ catch (final MessagingException e)
{
throw new FileSystemException(e);
}
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java Mon Dec 3 13:40:55 2012
@@ -68,7 +68,7 @@ public class MimeFileObject
{
if (!getName().equals(getFileSystem().getRootName()))
{
- MimeFileObject foParent = (MimeFileObject) FileObjectUtils.getAbstractFileObject(getParent());
+ final MimeFileObject foParent = (MimeFileObject) FileObjectUtils.getAbstractFileObject(getParent());
setPart(foParent.findPart(getName().getBaseName()));
return;
}
@@ -77,7 +77,7 @@ public class MimeFileObject
}
}
- private Part findPart(String partName) throws Exception
+ private Part findPart(final String partName) throws Exception
{
if (getType() == FileType.IMAGINARY)
{
@@ -87,10 +87,10 @@ public class MimeFileObject
if (isMultipart())
{
- Multipart multipart = (Multipart) part.getContent();
+ final Multipart multipart = (Multipart) part.getContent();
if (partName.startsWith(MimeFileSystem.NULL_BP_NAME))
{
- int partNumber = Integer.parseInt(partName.substring(MimeFileSystem.NULL_BP_NAME.length()), 10);
+ final int partNumber = Integer.parseInt(partName.substring(MimeFileSystem.NULL_BP_NAME.length()), 10);
if (partNumber < 0 || partNumber+1 > multipart.getCount())
{
// non existent
@@ -102,7 +102,7 @@ public class MimeFileObject
for (int i = 0; i<multipart.getCount(); i++)
{
- Part childPart = multipart.getBodyPart(i);
+ final Part childPart = multipart.getBodyPart(i);
if (partName.equals(childPart.getFileName()))
{
return childPart;
@@ -157,17 +157,17 @@ public class MimeFileObject
return null;
}
- List<MimeFileObject> vfs = new ArrayList<MimeFileObject>();
+ final List<MimeFileObject> vfs = new ArrayList<MimeFileObject>();
if (isMultipart())
{
- Object container = part.getContent();
+ final Object container = part.getContent();
if (container instanceof Multipart)
{
- Multipart multipart = (Multipart) container;
+ final Multipart multipart = (Multipart) container;
for (int i = 0; i<multipart.getCount(); i++)
{
- Part part = multipart.getBodyPart(i);
+ final Part part = multipart.getBodyPart(i);
String filename = UriParser.encode(part.getFileName());
if (filename == null)
@@ -175,7 +175,7 @@ public class MimeFileObject
filename = MimeFileSystem.NULL_BP_NAME + i;
}
- MimeFileObject fo = (MimeFileObject) FileObjectUtils.getAbstractFileObject(getFileSystem().resolveFile(
+ final MimeFileObject fo = (MimeFileObject) FileObjectUtils.getAbstractFileObject(getFileSystem().resolveFile(
getFileSystem().getFileSystemManager().resolveName(
getName(),
filename,
@@ -189,7 +189,7 @@ public class MimeFileObject
return vfs.toArray(new MimeFileObject[vfs.size()]);
}
- private void setPart(Part part)
+ private void setPart(final Part part)
{
this.part = part;
this.attributeMap = null;
@@ -211,7 +211,7 @@ public class MimeFileObject
protected long doGetLastModifiedTime()
throws Exception
{
- Message mm = getMessage();
+ final Message mm = getMessage();
if (mm == null)
{
return -1;
@@ -247,7 +247,7 @@ public class MimeFileObject
{
// deliver the preamble as the only content
- String preamble = ((MimeMultipart) part.getContent()).getPreamble();
+ final String preamble = ((MimeMultipart) part.getContent()).getPreamble();
if (preamble == null)
{
return new ByteArrayInputStream(new byte[]{});
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java Mon Dec 3 13:40:55 2012
@@ -57,7 +57,7 @@ public class MimeFileProvider
* Creates the filesystem.
*/
@Override
- protected FileSystem doCreateFileSystem(String scheme, final FileObject file, final FileSystemOptions fileSystemOptions)
+ protected FileSystem doCreateFileSystem(final String scheme, final FileObject file, final FileSystemOptions fileSystemOptions)
throws FileSystemException
{
final FileName name =
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java Mon Dec 3 13:40:55 2012
@@ -41,7 +41,7 @@ import org.apache.commons.vfs2.util.Shar
public class MimeFileSystem
extends AbstractFileSystem
{
- private Log log = LogFactory.getLog(MimeFileSystem.class);
+ private final Log log = LogFactory.getLog(MimeFileSystem.class);
public final static String NULL_BP_NAME = "_body_part_";
public final static String CONTENT_NAME = "_content";
@@ -86,7 +86,7 @@ public class MimeFileSystem
closeMimeStream();
mimeStream = null;
}
- catch (IOException e)
+ catch (final IOException e)
{
log.warn(e.getLocalizedMessage(), e);
}
@@ -111,7 +111,7 @@ public class MimeFileSystem
closeMimeStream();
}
- FileObject parentLayer = getParentLayer();
+ final FileObject parentLayer = getParentLayer();
if (!parentLayer.exists())
{
return null;
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java Mon Dec 3 13:40:55 2012
@@ -60,7 +60,7 @@ public class SmbFileName extends Generic
* Builds the root URI for this file name.
*/
@Override
- protected void appendRootUri(final StringBuilder buffer, boolean addPassword)
+ protected void appendRootUri(final StringBuilder buffer, final boolean addPassword)
{
super.appendRootUri(buffer, addPassword);
buffer.append('/');
@@ -71,7 +71,7 @@ public class SmbFileName extends Generic
* put domain before username if both are set
*/
@Override
- protected void appendCredentials(StringBuilder buffer, boolean addPassword)
+ protected void appendCredentials(final StringBuilder buffer, final boolean addPassword)
{
if (getDomain() != null && getDomain().length() != 0 &&
getUserName() != null && getUserName().length() != 0)
@@ -86,7 +86,7 @@ public class SmbFileName extends Generic
* Factory method for creating name instances.
*/
@Override
- public FileName createName(final String path, FileType type)
+ public FileName createName(final String path, final FileType type)
{
return new SmbFileName(
getScheme(),
@@ -110,7 +110,7 @@ public class SmbFileName extends Generic
return uriWithoutAuth;
}
- StringBuilder sb = new StringBuilder(120);
+ final StringBuilder sb = new StringBuilder(120);
sb.append(getScheme());
sb.append("://");
sb.append(getHostName());
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java Mon Dec 3 13:40:55 2012
@@ -42,7 +42,7 @@ public class SmbFileNameParser extends U
}
@Override
- public FileName parseUri(final VfsComponentContext context, FileName base, final String filename) throws FileSystemException
+ public FileName parseUri(final VfsComponentContext context, final FileName base, final String filename) throws FileSystemException
{
final StringBuilder name = new StringBuilder();
@@ -51,7 +51,7 @@ public class SmbFileNameParser extends U
// extract domain
String username = auth.getUserName();
- String domain = extractDomain(username);
+ final String domain = extractDomain(username);
if (domain != null)
{
username = username.substring(domain.length() + 1);
@@ -70,7 +70,7 @@ public class SmbFileNameParser extends U
// Normalise the path. Do this after extracting the share name,
// to deal with things like smb://hostname/share/..
- FileType fileType = UriParser.normalisePath(name);
+ final FileType fileType = UriParser.normalisePath(name);
final String path = name.toString();
return new SmbFileName(
@@ -85,7 +85,7 @@ public class SmbFileNameParser extends U
fileType);
}
- private String extractDomain(String username)
+ private String extractDomain(final String username)
{
if (username == null)
{
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java Mon Dec 3 13:40:55 2012
@@ -75,11 +75,11 @@ public class SmbFileObject
file = null;
}
- private SmbFile createSmbFile(FileName fileName) throws MalformedURLException, SmbException, FileSystemException
+ private SmbFile createSmbFile(final FileName fileName) throws MalformedURLException, SmbException, FileSystemException
{
- SmbFileName smbFileName = (SmbFileName) fileName;
+ final SmbFileName smbFileName = (SmbFileName) fileName;
- String path = smbFileName.getUriWithoutAuth();
+ final String path = smbFileName.getUriWithoutAuth();
UserAuthenticationData authData = null;
SmbFile file;
@@ -178,7 +178,7 @@ public class SmbFileObject
}
@Override
- protected void doRename(FileObject newfile) throws Exception
+ protected void doRename(final FileObject newfile) throws Exception
{
file.renameTo(createSmbFile(newfile.getName()));
}
@@ -222,7 +222,7 @@ public class SmbFileObject
{
return new SmbFileInputStream(file);
}
- catch (SmbException e)
+ catch (final SmbException e)
{
if (e.getErrorCode() == SmbException.ERRbadfile)
{
@@ -241,7 +241,7 @@ public class SmbFileObject
* Creates an output stream to write the file content to.
*/
@Override
- protected OutputStream doGetOutputStream(boolean bAppend) throws Exception
+ protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception
{
return new SmbFileOutputStream(file, bAppend);
}
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java Mon Dec 3 13:40:55 2012
@@ -49,7 +49,7 @@ class SmbFileRandomAccessContent extends
@Override
public int available() throws IOException
{
- long available = raf.length() - raf.getFilePointer();
+ final long available = raf.length() - raf.getFilePointer();
if (available > Integer.MAX_VALUE)
{
return Integer.MAX_VALUE;
@@ -71,34 +71,34 @@ class SmbFileRandomAccessContent extends
}
@Override
- public int read(byte b[]) throws IOException
+ public int read(final byte b[]) throws IOException
{
return raf.read(b);
}
@Override
- public int read(byte b[], int off, int len) throws IOException
+ public int read(final byte b[], final int off, final int len) throws IOException
{
return raf.read(b, off, len);
}
@Override
- public long skip(long n) throws IOException
+ public long skip(final long n) throws IOException
{
raf.seek(raf.getFilePointer() + n);
return n;
}
};
}
- catch (MalformedURLException e)
+ catch (final MalformedURLException e)
{
throw new FileSystemException("vfs.provider/random-access-open-failed.error", smbFile, e);
}
- catch (SmbException e)
+ catch (final SmbException e)
{
throw new FileSystemException("vfs.provider/random-access-open-failed.error", smbFile, e);
}
- catch (UnknownHostException e)
+ catch (final UnknownHostException e)
{
throw new FileSystemException("vfs.provider/random-access-open-failed.error", smbFile, e);
}
@@ -149,12 +149,12 @@ class SmbFileRandomAccessContent extends
return raf.readFloat();
}
- public void readFully(byte b[]) throws IOException
+ public void readFully(final byte b[]) throws IOException
{
raf.readFully(b);
}
- public void readFully(byte b[], int off, int len) throws IOException
+ public void readFully(final byte b[], final int off, final int len) throws IOException
{
raf.readFully(b, off, len);
}
@@ -189,100 +189,100 @@ class SmbFileRandomAccessContent extends
return raf.readUTF();
}
- public void seek(long pos) throws IOException
+ public void seek(final long pos) throws IOException
{
raf.seek(pos);
}
- public void setLength(long newLength) throws IOException {
+ public void setLength(final long newLength) throws IOException {
raf.setLength(newLength);
}
- public int skipBytes(int n) throws IOException
+ public int skipBytes(final int n) throws IOException
{
return raf.skipBytes(n);
}
@Override
- public void write(byte b[]) throws IOException
+ public void write(final byte b[]) throws IOException
{
raf.write(b);
}
@Override
- public void write(byte b[], int off, int len) throws IOException
+ public void write(final byte b[], final int off, final int len) throws IOException
{
raf.write(b, off, len);
}
@Override
- public void write(int b) throws IOException
+ public void write(final int b) throws IOException
{
raf.write(b);
}
@Override
- public void writeBoolean(boolean v) throws IOException
+ public void writeBoolean(final boolean v) throws IOException
{
raf.writeBoolean(v);
}
@Override
- public void writeByte(int v) throws IOException
+ public void writeByte(final int v) throws IOException
{
raf.writeByte(v);
}
@Override
- public void writeBytes(String s) throws IOException
+ public void writeBytes(final String s) throws IOException
{
raf.writeBytes(s);
}
@Override
- public void writeChar(int v) throws IOException
+ public void writeChar(final int v) throws IOException
{
raf.writeChar(v);
}
@Override
- public void writeChars(String s) throws IOException
+ public void writeChars(final String s) throws IOException
{
raf.writeChars(s);
}
@Override
- public void writeDouble(double v) throws IOException
+ public void writeDouble(final double v) throws IOException
{
raf.writeDouble(v);
}
@Override
- public void writeFloat(float v) throws IOException
+ public void writeFloat(final float v) throws IOException
{
raf.writeFloat(v);
}
@Override
- public void writeInt(int v) throws IOException
+ public void writeInt(final int v) throws IOException
{
raf.writeInt(v);
}
@Override
- public void writeLong(long v) throws IOException
+ public void writeLong(final long v) throws IOException
{
raf.writeLong(v);
}
@Override
- public void writeShort(int v) throws IOException
+ public void writeShort(final int v) throws IOException
{
raf.writeShort(v);
}
@Override
- public void writeUTF(String str) throws IOException
+ public void writeUTF(final String str) throws IOException
{
raf.writeUTF(str);
}
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java Mon Dec 3 13:40:55 2012
@@ -32,7 +32,7 @@ public class FileObjectDataSource implem
{
private final FileObject fo;
- public FileObjectDataSource(FileObject fo)
+ public FileObjectDataSource(final FileObject fo)
{
this.fo = fo;
}
@@ -53,7 +53,7 @@ public class FileObjectDataSource implem
{
return fo.getContent().getContentInfo().getContentType();
}
- catch (FileSystemException e)
+ catch (final FileSystemException e)
{
throw new RuntimeException(e);
}
Modified: commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java?rev=1416511&r1=1416510&r2=1416511&view=diff
==============================================================================
--- commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java (original)
+++ commons/proper/vfs/trunk/sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java Mon Dec 3 13:40:55 2012
@@ -75,14 +75,14 @@ public class SharedRandomContentInputStr
{
return -1;
}
- int r = super.read();
+ final int r = super.read();
pos++;
resetCount++;
return r;
}
@Override
- public synchronized int read(byte b[], int off, int len) throws IOException
+ public synchronized int read(final byte b[], final int off, int len) throws IOException
{
if (checkEnd())
{
@@ -95,7 +95,7 @@ public class SharedRandomContentInputStr
len = (int) (fileEnd - getFilePosition());
}
- int nread = super.read(b, off, len);
+ final int nread = super.read(b, off, len);
pos+=nread;
resetCount+=nread;
return nread;
@@ -115,7 +115,7 @@ public class SharedRandomContentInputStr
n = fileEnd - getFilePosition();
}
- long nskip = super.skip(n);
+ final long nskip = super.skip(n);
pos+=nskip;
resetCount+=nskip;
return nskip;
@@ -155,13 +155,13 @@ public class SharedRandomContentInputStr
return fileStart + pos;
}
- protected long calcFilePosition(long nadd)
+ protected long calcFilePosition(final long nadd)
{
return getFilePosition()+nadd;
}
@Override
- public synchronized void mark(int readlimit)
+ public synchronized void mark(final int readlimit)
{
super.mark(readlimit);
resetCount = 0;
@@ -192,14 +192,14 @@ public class SharedRandomContentInputStr
}
}
- public InputStream newStream(long start, long end)
+ public InputStream newStream(final long start, final long end)
{
try
{
- long newFileStart = this.fileStart+start;
- long newFileEnd = end<0?this.fileEnd:this.fileStart+end;
+ final long newFileStart = this.fileStart+start;
+ final long newFileEnd = end<0?this.fileEnd:this.fileStart+end;
- RandomAccessContent rac = fo.getContent().getRandomAccessContent(RandomAccessMode.READ);
+ final RandomAccessContent rac = fo.getContent().getRandomAccessContent(RandomAccessMode.READ);
rac.seek(newFileStart);
return new SharedRandomContentInputStream(
createdStreams,
@@ -208,7 +208,7 @@ public class SharedRandomContentInputStr
newFileEnd,
rac.getInputStream());
}
- catch (IOException e)
+ catch (final IOException e)
{
throw new RuntimeException(e);
}
@@ -218,9 +218,9 @@ public class SharedRandomContentInputStr
{
synchronized(createdStreams)
{
- SharedRandomContentInputStream[] streams = new SharedRandomContentInputStream[createdStreams.size()];
+ final SharedRandomContentInputStream[] streams = new SharedRandomContentInputStream[createdStreams.size()];
createdStreams.toArray(streams);
- for (SharedRandomContentInputStream stream : streams) {
+ for (final SharedRandomContentInputStream stream : streams) {
stream.close();
}
}