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 2011/11/18 16:25:15 UTC
svn commit: r1203691 - in /commons/proper/vfs/trunk:
core/src/main/java/org/apache/commons/vfs2/
core/src/main/java/org/apache/commons/vfs2/impl/
core/src/main/java/org/apache/commons/vfs2/provider/
core/src/main/java/org/apache/commons/vfs2/provider/f...
Author: ggregory
Date: Fri Nov 18 15:25:14 2011
New Revision: 1203691
URL: http://svn.apache.org/viewvc?rev=1203691&view=rev
Log:
[VFS-389] Use variable argument lists in FileSystemException instead of Object[]s.
Modified:
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemException.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.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/AbstractFileSystem.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/ftp/FtpClientFactory.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.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/http/HttpClientFactory.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.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/SftpRandomAccessContent.java
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java
commons/proper/vfs/trunk/src/changes/changes.xml
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemException.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemException.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemException.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemException.java Fri Nov 18 15:25:14 2011
@@ -63,7 +63,7 @@ public class FileSystemException
*/
public FileSystemException(final String code)
{
- this(code, null, null);
+ this(code, null, (Object[])null);
}
/**
@@ -74,7 +74,7 @@ public class FileSystemException
*/
public FileSystemException(final String code, final Object info0)
{
- this(code, new Object[]{info0}, null);
+ this(code, null, new Object[]{info0});
}
/**
@@ -88,7 +88,7 @@ public class FileSystemException
final Object info0,
final Throwable throwable)
{
- this(code, new Object[]{info0}, throwable);
+ this(code, throwable, new Object[]{info0});
}
/**
@@ -97,9 +97,9 @@ public class FileSystemException
* @param code the error code of the message.
* @param info array of complementary info (context).
*/
- public FileSystemException(final String code, final Object[] info)
+ public FileSystemException(final String code, final Object... info)
{
- this(code, info, null);
+ this(code, null, info);
}
/**
@@ -110,7 +110,7 @@ public class FileSystemException
*/
public FileSystemException(final String code, final Throwable throwable)
{
- this(code, null, throwable);
+ this(code, throwable, (Object[])null);
}
/**
@@ -119,11 +119,27 @@ public class FileSystemException
* @param code the error code of the message.
* @param info array of complementary info (context).
* @param throwable the cause.
+ * @deprecated Use instead {@link #FileSystemException(String, Throwable, Object[])}. Will be removed in 3.0.
*/
+ @Deprecated
public FileSystemException(final String code,
final Object[] info,
final Throwable throwable)
{
+ this(code, throwable, info);
+ }
+
+ /**
+ * Constructs exception with the specified detail message.
+ *
+ * @param code the error code of the message.
+ * @param info array of complementary info (context).
+ * @param throwable the cause.
+ */
+ public FileSystemException(final String code,
+ final Throwable throwable,
+ final Object... info)
+ {
super(code);
if (info == null)
@@ -157,7 +173,7 @@ public class FileSystemException
*/
public FileSystemException(final Throwable throwable)
{
- this(throwable.getMessage(), null, throwable);
+ this(throwable.getMessage(), throwable, (Object[])null);
}
/**
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java Fri Nov 18 15:25:14 2011
@@ -700,8 +700,7 @@ public class DefaultFileSystemManager im
// An unknown scheme - hand it to the default provider
if (defaultProvider == null)
{
- throw new FileSystemException("vfs.impl/unknown-scheme.error",
- new Object[] {scheme, uri});
+ throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme, uri);
}
return defaultProvider.findFile(realBaseFile, uri, fileSystemOptions);
}
@@ -862,8 +861,7 @@ public class DefaultFileSystemManager im
// An unknown scheme - hand it to the default provider
if (defaultProvider == null)
{
- throw new FileSystemException("vfs.impl/unknown-scheme.error",
- new Object[] {scheme, uri});
+ throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme, uri);
}
return defaultProvider.parseUri(null, uri);
}
@@ -901,8 +899,7 @@ public class DefaultFileSystemManager im
final FileProvider provider = providers.get(scheme);
if (provider == null)
{
- throw new FileSystemException("vfs.impl/unknown-provider.error",
- new Object[] {scheme, file});
+ throw new FileSystemException("vfs.impl/unknown-provider.error", scheme, file);
}
return provider.createFileSystem(scheme, file, file.getFileSystem().getFileSystemOptions());
}
@@ -1058,8 +1055,7 @@ public class DefaultFileSystemManager im
FileProvider provider = providers.get(scheme);
if (provider == null)
{
- throw new FileSystemException("vfs.impl/unknown-scheme.error",
- new Object[] {scheme});
+ throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme);
}
return provider.getCapabilities();
@@ -1077,7 +1073,7 @@ public class DefaultFileSystemManager im
FileProvider provider = providers.get(scheme);
if (provider == null)
{
- throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object[] {scheme});
+ throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme);
}
return provider.getConfigBuilder();
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java Fri Nov 18 15:25:14 2011
@@ -93,7 +93,7 @@ public class PrivilegedFileReplicator
}
catch (final PrivilegedActionException e)
{
- throw new FileSystemException("vfs.impl/init-replicator.error", null, e);
+ throw new FileSystemException("vfs.impl/init-replicator.error", e);
}
}
}
@@ -126,7 +126,7 @@ public class PrivilegedFileReplicator
}
catch (final PrivilegedActionException e)
{
- throw new FileSystemException("vfs.impl/replicate-file.error", new Object[]{srcFile.getName()}, e);
+ throw new FileSystemException("vfs.impl/replicate-file.error", e, srcFile.getName());
}
}
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=1203691&r1=1203690&r2=1203691&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 Fri Nov 18 15:25:14 2011
@@ -503,7 +503,7 @@ public abstract class AbstractFileObject
}
catch (Exception e)
{
- throw new FileSystemException("vfs.provider/get-type.error", new Object[]{name}, e);
+ throw new FileSystemException("vfs.provider/get-type.error", e, name);
}
return type;
@@ -725,7 +725,7 @@ public abstract class AbstractFileObject
}
catch (Exception exc)
{
- throw new FileSystemException("vfs.provider/list-children.error", new Object[]{name}, exc);
+ throw new FileSystemException("vfs.provider/list-children.error", exc, name);
}
if (childrenObjects != null)
@@ -746,7 +746,7 @@ public abstract class AbstractFileObject
}
catch (Exception exc)
{
- throw new FileSystemException("vfs.provider/list-children.error", new Object[]{name}, exc);
+ throw new FileSystemException("vfs.provider/list-children.error", exc, name);
}
if (files == null)
@@ -909,7 +909,7 @@ public abstract class AbstractFileObject
}
catch (final Exception exc)
{
- throw new FileSystemException("vfs.provider/delete.error", new Object[]{name}, exc);
+ throw new FileSystemException("vfs.provider/delete.error", exc, name);
}
return true;
@@ -1144,7 +1144,7 @@ public abstract class AbstractFileObject
}
catch (final IOException e)
{
- throw new FileSystemException("vfs.provider/copy-file.error", new Object[]{srcFile, destFile}, e);
+ throw new FileSystemException("vfs.provider/copy-file.error", e, srcFile, destFile);
}
}
}
@@ -1160,8 +1160,9 @@ public abstract class AbstractFileObject
{
if (!getParent().isWriteable())
{
- throw new FileSystemException("vfs.provider/rename-parent-read-only.error", new FileName[]{getName(),
- getParent().getName()});
+ throw new FileSystemException("vfs.provider/rename-parent-read-only.error",
+ getName(),
+ getParent().getName());
}
}
else
@@ -1198,11 +1199,9 @@ public abstract class AbstractFileObject
}
catch (final Exception exc)
{
- throw new FileSystemException("vfs.provider/rename.error", new Object[]
- {
+ throw new FileSystemException("vfs.provider/rename.error", exc,
getName(),
- destFile.getName()
- }, exc);
+ destFile.getName());
}
}
else
@@ -1515,7 +1514,7 @@ public abstract class AbstractFileObject
}
catch (Exception exc)
{
- throw new FileSystemException("vfs.provider/write.error", new Object[]{name}, exc);
+ throw new FileSystemException("vfs.provider/write.error", exc, name);
}
}
@@ -1598,7 +1597,7 @@ public abstract class AbstractFileObject
}
catch (Exception exc)
{
- throw new FileSystemException("vfs.provider/get-type.error", new Object[]{name}, exc);
+ throw new FileSystemException("vfs.provider/get-type.error", exc, name);
}
// fs.fileAttached(this);
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java Fri Nov 18 15:25:14 2011
@@ -322,8 +322,7 @@ public abstract class AbstractFileSystem
if (!rootName.getRootURI().equals(name.getRootURI()))
{
throw new FileSystemException("vfs.provider/mismatched-fs-for-name.error",
- new Object[]{
- name, rootName, name.getRootURI()});
+ name, rootName, name.getRootURI());
}
// imario@apache.org ==> use getFileFromCache
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=1203691&r1=1203690&r2=1203691&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 Fri Nov 18 15:25:14 2011
@@ -148,7 +148,7 @@ public final class DefaultFileContent im
}
catch (final Exception exc)
{
- throw new FileSystemException("vfs.provider/get-size.error", new Object[]{fileObject}, exc);
+ throw new FileSystemException("vfs.provider/get-size.error", exc, fileObject);
}
}
@@ -302,7 +302,7 @@ public final class DefaultFileContent im
{
if (!fileObject.getType().hasAttributes())
{
- throw new FileSystemException("vfs.provider/set-attribute-no-exist.error", new Object[]{attrName, fileObject});
+ throw new FileSystemException("vfs.provider/set-attribute-no-exist.error", attrName, fileObject);
}
try
{
@@ -310,7 +310,7 @@ public final class DefaultFileContent im
}
catch (final Exception e)
{
- throw new FileSystemException("vfs.provider/set-attribute.error", new Object[]{attrName, fileObject}, e);
+ throw new FileSystemException("vfs.provider/set-attribute.error", e,attrName, fileObject);
}
if (attrs != null)
@@ -338,7 +338,7 @@ public final class DefaultFileContent im
}
catch (final Exception e)
{
- throw new FileSystemException("vfs.provider/remove-attribute.error", new Object[]{attrName, fileObject}, e);
+ throw new FileSystemException("vfs.provider/remove-attribute.error", e, attrName, fileObject);
}
if (attrs != null)
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=1203691&r1=1203690&r2=1203691&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 Fri Nov 18 15:25:14 2011
@@ -96,7 +96,7 @@ public final class FtpClientFactory
UserAuthenticatorUtils.toString(password)))
{
throw new FileSystemException("vfs.provider.ftp/login.error",
- new Object[]{hostname, UserAuthenticatorUtils.toString(username)}, null);
+ hostname, UserAuthenticatorUtils.toString(username));
}
// Set binary mode
@@ -156,7 +156,7 @@ public final class FtpClientFactory
}
catch (final Exception exc)
{
- throw new FileSystemException("vfs.provider.ftp/connect.error", new Object[]{hostname}, exc);
+ throw new FileSystemException("vfs.provider.ftp/connect.error", exc, hostname);
}
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java Fri Nov 18 15:25:14 2011
@@ -514,7 +514,7 @@ public class FtpFileObject extends Abstr
if (!ok)
{
throw new FileSystemException("vfs.provider.ftp/rename-file.error",
- new Object[]{getName().toString(), newfile});
+ getName().toString(), newfile);
}
this.fileInfo = null;
children = EMPTY_FTP_FILE_MAP;
@@ -645,11 +645,9 @@ public class FtpFileObject extends Abstr
if (out == null)
{
- throw new FileSystemException("vfs.provider.ftp/output-error.debug", new Object[]
- {
+ throw new FileSystemException("vfs.provider.ftp/output-error.debug",
this.getName(),
- client.getReplyString()
- });
+ client.getReplyString());
}
return new FtpOutputStream(client, out);
@@ -674,11 +672,9 @@ public class FtpFileObject extends Abstr
final InputStream instr = client.retrieveFileStream(relPath, filePointer);
if (instr == null)
{
- throw new FileSystemException("vfs.provider.ftp/input-error.debug", new Object[]
- {
+ throw new FileSystemException("vfs.provider.ftp/input-error.debug",
this.getName(),
- client.getReplyString()
- });
+ client.getReplyString());
}
return new FtpInputStream(client, instr);
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpRandomAccessContent.java Fri Nov 18 15:25:14 2011
@@ -59,10 +59,7 @@ class FtpRandomAccessContent extends Abs
if (pos < 0)
{
throw new FileSystemException("vfs.provider/random-access-invalid-position.error",
- new Object[]
- {
- new Long(pos)
- });
+ new Long(pos));
}
if (dis != null)
{
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=1203691&r1=1203690&r2=1203691&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 Fri Nov 18 15:25:14 2011
@@ -156,7 +156,7 @@ public final class FtpsClientFactory
UserAuthenticatorUtils.toString(password)))
{
throw new FileSystemException("vfs.provider.ftp/login.error",
- new Object[]{hostname, UserAuthenticatorUtils.toString(username)}, null);
+ hostname, UserAuthenticatorUtils.toString(username));
}
// Set binary mode
@@ -206,7 +206,7 @@ public final class FtpsClientFactory
}
catch (final Exception exc)
{
- throw new FileSystemException("vfs.provider.sftp/connect.error", new Object[]{hostname}, exc);
+ throw new FileSystemException("vfs.provider.sftp/connect.error", exc, hostname);
}
}
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java Fri Nov 18 15:25:14 2011
@@ -149,7 +149,7 @@ public final class HttpClientFactory
}
catch (final Exception exc)
{
- throw new FileSystemException("vfs.provider.http/connect.error", new Object[]{hostname}, exc);
+ throw new FileSystemException("vfs.provider.http/connect.error", exc, hostname);
}
return client;
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java Fri Nov 18 15:25:14 2011
@@ -91,7 +91,7 @@ public class HttpFileObject extends Abst
}
else
{
- throw new FileSystemException("vfs.provider.http/head.error", new Object[]{getName(), Integer.valueOf(status)});
+ throw new FileSystemException("vfs.provider.http/head.error", getName(), Integer.valueOf(status));
}
}
@@ -156,7 +156,7 @@ public class HttpFileObject extends Abst
}
if (status != HttpURLConnection.HTTP_OK)
{
- throw new FileSystemException("vfs.provider.http/get.error", new Object[]{getName(), Integer.valueOf(status)});
+ throw new FileSystemException("vfs.provider.http/get.error", getName(), Integer.valueOf(status));
}
return new HttpInputStream(getMethod);
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java Fri Nov 18 15:25:14 2011
@@ -65,10 +65,7 @@ class HttpRandomAccessContent extends Ab
if (pos < 0)
{
throw new FileSystemException("vfs.provider/random-access-invalid-position.error",
- new Object[]
- {
- new Long(pos)
- });
+ new Long(pos));
}
if (dis != null)
{
@@ -92,12 +89,10 @@ class HttpRandomAccessContent extends Ab
final int status = fileSystem.getClient().executeMethod(getMethod);
if (status != HttpURLConnection.HTTP_PARTIAL && status != HttpURLConnection.HTTP_OK)
{
- throw new FileSystemException("vfs.provider.http/get-range.error", new Object[]
- {
+ throw new FileSystemException("vfs.provider.http/get-range.error",
fileObject.getName(),
Long.valueOf(filePointer),
- Integer.valueOf(status)
- });
+ Integer.valueOf(status));
}
mis = new HttpFileObject.HttpInputStream(getMethod);
@@ -107,12 +102,10 @@ class HttpRandomAccessContent extends Ab
long skipped = mis.skip(filePointer);
if (skipped != filePointer)
{
- throw new FileSystemException("vfs.provider.http/get-range.error", new Object[]
- {
+ throw new FileSystemException("vfs.provider.http/get-range.error",
fileObject.getName(),
Long.valueOf(filePointer),
- Integer.valueOf(status)
- });
+ Integer.valueOf(status));
}
}
dis = new DataInputStream(new FilterInputStream(mis)
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java Fri Nov 18 15:25:14 2011
@@ -138,7 +138,7 @@ public class LocalFile extends AbstractF
if (!file.renameTo(newLocalFile.getLocalFile()))
{
throw new FileSystemException("vfs.provider.local/rename-file.error",
- new String[]{file.toString(), newfile.toString()});
+ file.toString(), newfile.toString());
}
}
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=1203691&r1=1203690&r2=1203691&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 Fri Nov 18 15:25:14 2011
@@ -236,7 +236,7 @@ public final class SftpClientFactory
}
catch (final Exception exc)
{
- throw new FileSystemException("vfs.provider.sftp/connect.error", new Object[]{hostname}, exc);
+ throw new FileSystemException("vfs.provider.sftp/connect.error", exc, hostname);
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpRandomAccessContent.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpRandomAccessContent.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpRandomAccessContent.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpRandomAccessContent.java Fri Nov 18 15:25:14 2011
@@ -62,10 +62,7 @@ class SftpRandomAccessContent extends Ab
if (pos < 0)
{
throw new FileSystemException("vfs.provider/random-access-invalid-position.error",
- new Object[]
- {
- new Long(pos)
- });
+ new Long(pos));
}
if (dis != null)
{
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilder.java Fri Nov 18 15:25:14 2011
@@ -198,11 +198,9 @@ public class DelegatingFileSystemOptions
// find all setter methods suitable for the given "name"
if (!fillConfigSetters(ctx))
{
- throw new FileSystemException("vfs.provider/config-key-invalid.error", new String[]
- {
+ throw new FileSystemException("vfs.provider/config-key-invalid.error",
ctx.scheme,
- ctx.name
- });
+ ctx.name);
}
// get the fileSystemConfigBuilder
@@ -219,12 +217,10 @@ public class DelegatingFileSystemOptions
}
}
- throw new FileSystemException("vfs.provider/config-value-invalid.error", new Object[]
- {
+ throw new FileSystemException("vfs.provider/config-value-invalid.error",
ctx.scheme,
ctx.name,
- ctx.values
- });
+ ctx.values);
}
/**
Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java (original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java Fri Nov 18 15:25:14 2011
@@ -34,8 +34,8 @@ public class FileSystemExceptionTest {
@Test
public void testMasksPasswordOfUrlsWithBasicAuthentication() {
final FileSystemException fse = new FileSystemException(
- "vfs.provider/rename.error", new String[]{
- "file://test.bin", "http://foo:bar@junit.org/test.bin"});
+ "vfs.provider/rename.error",
+ "file://test.bin", "http://foo:bar@junit.org/test.bin");
assertEquals("file://test.bin", fse.getInfo()[0]);
assertEquals("http://foo:***@junit.org/test.bin", fse.getInfo()[1]);
@@ -48,7 +48,7 @@ public class FileSystemExceptionTest {
@Test
public void testDoesNotModifyUrlsWithoutPassword() {
final FileSystemException fse = new FileSystemException(
- "vfs.provider/delete.error", new String[]{"http://foo@junit.org/test.bin"});
+ "vfs.provider/delete.error", "http://foo@junit.org/test.bin");
assertEquals("http://foo@junit.org/test.bin", fse.getInfo()[0]);
}
@@ -59,7 +59,7 @@ public class FileSystemExceptionTest {
@Test
public void testProperDetectionOfUrl() {
final FileSystemException fse = new FileSystemException(
- "vfs.provider/delete.error", new String[]{"zip:http://foo:bar@junit.org/test.bin"});
+ "vfs.provider/delete.error", "zip:http://foo:bar@junit.org/test.bin");
assertEquals("zip:http://foo:***@junit.org/test.bin", fse.getInfo()[0]);
}
Modified: commons/proper/vfs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1203691&r1=1203690&r2=1203691&view=diff
==============================================================================
--- commons/proper/vfs/trunk/src/changes/changes.xml (original)
+++ commons/proper/vfs/trunk/src/changes/changes.xml Fri Nov 18 15:25:14 2011
@@ -23,6 +23,9 @@
<body>
<release version="2.1" date="TBD" description="">
+ <action issue="VFS-389" dev="ggregory" type="update">
+ Use variable argument lists in FileSystemException instead of Object[]s.
+ </action>
<action issue="VFS-388" dev="ggregory" type="update">
Build tests SFTP file system with an embedded SFTP server (Apache MINA).
</action>